LIRC libraries
LinuxInfraredRemoteControl
drv_enum.h File Reference

(8736686 2017-08-12 08:35:20 +0200)

dynamic drivers device enumeration support More...

#include <stdint.h>
#include "driver.h"

Go to the source code of this file.

Classes

struct  drv_enum_udev_what
 Condition to match in drv_enum_udev(). More...
 

Functions

void glob_t_init (glob_t *glob)
 Setup a glob_t variable to empty state. More...
 
void glob_t_add_path (glob_t *glob, const char *path)
 Add a path to glob, allocating memory as necessary. More...
 
void drv_enum_free (glob_t *glob)
 Free memory obtained using any of the drv_enum_* functions. More...
 
void drv_enum_add_udev_info (glob_t *glob)
 Try to add udev info to existing entries in glob. More...
 
int drv_enum_glob (glob_t *glob, const char *pattern)
 List all devices matching glob(3) pattern. More...
 
int drv_enum_globs (glob_t *globbuf, const char *const *patterns)
 List devices matching any of patterns in null-terminated list. More...
 
int drv_enum_udev (glob_t *globbuf, const struct drv_enum_udev_what *what)
 List all devices matching any of conditions in {0}-terminated list. More...
 
int drv_enum_usb (glob_t *glob, int(*is_device_ok)(uint16_t vendor, uint16_t product))
 List all available devices matched by is_device_ok() using libusb. More...
 

Detailed Description

dynamic drivers device enumeration support

Author
Alec Leamas
License:
GPL2 or later
Date
December 2016

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

Definition in file drv_enum.h.

Function Documentation

void drv_enum_add_udev_info ( glob_t *  glob)

Try to add udev info to existing entries in glob.

Existing info besides the device path is discarded.

Definition at line 174 of file drv_enum.c.

void drv_enum_free ( glob_t *  glob)

Free memory obtained using any of the drv_enum_* functions.

Free memory obtained using any of the drv_enum_* functions.

Definition at line 63 of file drv_enum.c.

int drv_enum_glob ( glob_t *  glob,
const char *  pattern 
)

List all devices matching glob(3) pattern.

Definition at line 212 of file drv_enum.c.

int drv_enum_globs ( glob_t *  globbuf,
const char *const *  patterns 
)

List devices matching any of patterns in null-terminated list.

Definition at line 179 of file drv_enum.c.

int drv_enum_udev ( glob_t *  globbuf,
const struct drv_enum_udev_what what 
)

List all devices matching any of conditions in {0}-terminated list.

Definition at line 412 of file drv_enum.c.

int drv_enum_usb ( glob_t *  glob,
int(*)(uint16_t vendor, uint16_t product)  is_device_ok 
)

List all available devices matched by is_device_ok() using libusb.

Definition at line 252 of file drv_enum.c.

void glob_t_add_path ( glob_t *  glob,
const char *  path 
)

Add a path to glob, allocating memory as necessary.

Definition at line 48 of file drv_enum.c.

void glob_t_init ( glob_t *  glob)

Setup a glob_t variable to empty state.

Definition at line 40 of file drv_enum.c.