Loading...
Searching...
No Matches
drv_enum.h
Go to the documentation of this file.
#ifndef _DRV_ENUM_H
#define _DRV_ENUM_H
#include <stdint.h>
#include "driver.h"
#ifdef __cplusplus
extern "C" {
#endif
struct drv_enum_udev_what {
const char* idVendor;
const char* idProduct;
const char* subsystem;
const char* parent_subsys;
};
void glob_t_init(glob_t* glob);
void glob_t_add_path(glob_t* glob, const char* path);
void drv_enum_free(glob_t* glob);
void drv_enum_add_udev_info(glob_t* glob);
int drv_enum_glob(glob_t* glob, const char* pattern);
int drv_enum_globs(glob_t* globbuf, const char* const* patterns);
int drv_enum_udev(glob_t* globbuf,
const struct drv_enum_udev_what* what);
int drv_enum_usb(glob_t* glob,
int (*is_device_ok)(uint16_t vendor, uint16_t product));
#ifdef __cplusplus
}
#endif
#endif // _DRV_ENUM_H
driver.h
Interface to the userspace drivers.
drv_enum_free
void drv_enum_free(glob_t *glob)
Free memory obtained using any of the drv_enum_* functions.
Definition drv_enum.c:63
glob_t_init
void glob_t_init(glob_t *glob)
Setup a glob_t variable to empty state.
Definition drv_enum.c:40
drv_enum_add_udev_info
void drv_enum_add_udev_info(glob_t *glob)
Try to add udev info to existing entries in glob.
Definition drv_enum.c:174
drv_enum_glob
int drv_enum_glob(glob_t *glob, const char *pattern)
List all devices matching glob(3) pattern.
Definition drv_enum.c:212
drv_enum_globs
int drv_enum_globs(glob_t *globbuf, const char *const *patterns)
List devices matching any of patterns in null-terminated list.
Definition drv_enum.c:179
drv_enum_udev
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 drv_enum.c:412
drv_enum_usb
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.
Definition drv_enum.c:252
glob_t_add_path
void glob_t_add_path(glob_t *glob, const char *path)
Add a path to glob, allocating memory as necessary.
Definition drv_enum.c:48
drv_enum_udev_what
Condition to match in drv_enum_udev().
Definition drv_enum.h:32
drv_enum_udev_what::subsystem
const char * subsystem
Require given subsystem.
Definition drv_enum.h:35
drv_enum_udev_what::parent_subsys
const char * parent_subsys
Require a given subsystem parent.
Definition drv_enum.h:36