"Fossies" - the Fresh Open Source Software Archive

Member "usbutils-015/usbhid-dump/src/dev.h" (22 Feb 2021, 1130 Bytes) of package /linux/misc/usbutils-015.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "dev.h" see the Fossies "Dox" file reference documentation and the last Fossies "Diffs" side-by-side code changes report: 013_vs_014.

    1 // SPDX-License-Identifier: GPL-2.0-or-later
    2 /*
    3  * usbhid-dump - device
    4  *
    5  * Copyright (C) 2010-2011 Nikolai Kondrashov <spbnick@gmail.com>
    6  */
    7 
    8 #ifndef __UHD_DEV_H__
    9 #define __UHD_DEV_H__
   10 
   11 #include <stdbool.h>
   12 #include <libusb.h>
   13 
   14 #ifdef __cplusplus
   15 extern "C" {
   16 #endif
   17 
   18 /** usbhid-dump device */
   19 typedef struct uhd_dev uhd_dev;
   20 
   21 struct uhd_dev {
   22     uhd_dev                *next;       /**< Next device in the list */
   23     libusb_device_handle   *handle;     /**< Handle */
   24 };
   25 
   26 /**
   27  * Check if a device is valid.
   28  *
   29  * @param dev Device to check.
   30  *
   31  * @return True if the device is valid, false otherwise.
   32  */
   33 extern bool uhd_dev_valid(const uhd_dev *dev);
   34 
   35 /**
   36  * Open a device.
   37  *
   38  * @param lusb_dev  Libusb device.
   39  * @param pdev      Location for the opened device pointer.
   40  *
   41  * @return Libusb error code.
   42  */
   43 extern enum libusb_error uhd_dev_open(libusb_device    *lusb_dev,
   44                                       uhd_dev         **pdev);
   45 
   46 /**
   47  * Close a device.
   48  *
   49  * @param dev   The device to close.
   50  */
   51 extern void uhd_dev_close(uhd_dev *dev);
   52 
   53 #ifdef __cplusplus
   54 } /* extern "C" */
   55 #endif
   56 
   57 #endif /* __UHD_DEV_H__ */