"Fossies" - the Fresh Open Source Software Archive

Member "usbutils-015/usbhid-dump/src/dev_list.h" (22 Feb 2021, 1856 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_list.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 list
    4  *
    5  * Copyright (C) 2010-2011 Nikolai Kondrashov <spbnick@gmail.com>
    6  */
    7 
    8 #ifndef __UHD_DEV_LIST_H__
    9 #define __UHD_DEV_LIST_H__
   10 
   11 #include <stddef.h>
   12 #include <stdint.h>
   13 #include "dev.h"
   14 
   15 #ifdef __cplusplus
   16 extern "C" {
   17 #endif
   18 
   19 /**
   20  * Check if a device list is valid.
   21  *
   22  * @param list  Device list to check.
   23  *
   24  * @return True if the device list is valid, false otherwise.
   25  */
   26 extern bool uhd_dev_list_valid(const uhd_dev *list);
   27 
   28 /**
   29  * Close every device in a device list.
   30  *
   31  * @param list  The device list to close.
   32  */
   33 extern void uhd_dev_list_close(uhd_dev *list);
   34 
   35 /**
   36  * Iterate over a device list.
   37  *
   38  * @param _dev    Loop device variable.
   39  * @param _list     Device list to iterate over.
   40  */
   41 #define UHD_DEV_LIST_FOR_EACH(_dev, _list) \
   42     for (_dev = _list; _dev != NULL; _dev = _dev->next)
   43 
   44 /**
   45  * Open a list of devices optionally matching bus number/device address and
   46  * vendor/product IDs.
   47  *
   48  * @param ctx       Libusb context.
   49  * @param bus_num   Bus number, or 0 for any bus.
   50  * @param dev_addr  Device address, or 0 for any address.
   51  * @param vid       Vendor ID, or 0 for any vendor.
   52  * @param pid       Product ID, or 0 for any product.
   53  * @param plist     Location for the resulting device list head; could be
   54  *                  NULL.
   55  *
   56  * @return Libusb error code.
   57  */
   58 extern enum libusb_error uhd_dev_list_open(libusb_context  *ctx,
   59                                            uint8_t          bus_num,
   60                                            uint8_t          dev_addr,
   61                                            uint16_t         vid,
   62                                            uint16_t         pid,
   63                                            uhd_dev        **plist);
   64 
   65 #ifdef __cplusplus
   66 } /* extern "C" */
   67 #endif
   68 
   69 #endif /* __UHD_DEV_LIST_H__ */