/usr/include/lirc/drv_enum.h is in liblirc-dev 0.10.0-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 | #ifndef _DRV_ENUM_H
#define _DRV_ENUM_H
/**
* @brief dynamic drivers device enumeration support
* @file drv_enum.h
* @author Alec Leamas
* @license GPL2 or later
* @date December 2016
* @ingroup driver_api
*
* Functions in this file provides support for enumerating devices
* i. e., DRVCTL_GET_DEVICES. If libudev is available, all functions
* adds udev info to the output.
*
* All drv_enum functions returns data in a glob_t* with matched devices in
* gl_pathv, one device per entry. The first word in each entry is
* the mandatory device path. The optional remainder is more info
* on device, usable in user interfaces.
*
* Return codes are DRV_ERR_ constants as of driver.h, or 0 for no errors.
*
* @since 0.10.0
*/
#include <stdint.h>
#include "driver.h"
#ifdef __cplusplus
extern "C" {
#endif
/** Condition to match in drv_enum_udev(). Null fields are ignored. */
struct drv_enum_udev_what {
const char* idVendor;
const char* idProduct;
const char* subsystem; /**< Require given subsystem. */
const char* parent_subsys; /**< Require a given subsystem parent. */
};
/** Setup a glob_t variable to empty state. */
void glob_t_init(glob_t* glob);
/** Add a path to glob, allocating memory as necessary. */
void glob_t_add_path(glob_t* glob, const char* path);
/** Free memory obtained using any of the drv_enum_* functions */
void drv_enum_free(glob_t* glob);
/**
* Try to add udev info to existing entries in glob. Existing
* info besides the device path is discarded.
*/
void drv_enum_add_udev_info(glob_t* glob);
/** List all devices matching glob(3) pattern. */
int drv_enum_glob(glob_t* glob, const char* pattern);
/** List devices matching any of patterns in null-terminated list. */
int drv_enum_globs(glob_t* globbuf, const char* const* patterns);
/** List all devices matching any of conditions in {0}-terminated list. */
int drv_enum_udev(glob_t* globbuf,
const struct drv_enum_udev_what* what);
/** List all available devices matched by is_device_ok() using libusb. */
int drv_enum_usb(glob_t* glob,
int (*is_device_ok)(uint16_t vendor, uint16_t product));
#ifdef __cplusplus
}
#endif
#endif // _DRV_ENUM_H
|