diff options
Diffstat (limited to 'lib/libusb/libusb.h')
-rw-r--r-- | lib/libusb/libusb.h | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/lib/libusb/libusb.h b/lib/libusb/libusb.h index d446830..1738301 100644 --- a/lib/libusb/libusb.h +++ b/lib/libusb/libusb.h @@ -236,12 +236,25 @@ enum libusb_debug_level { LIBUSB_DEBUG_TRANSFER=2, }; +#define LIBUSB_HOTPLUG_MATCH_ANY -1 + +typedef enum { + LIBUSB_HOTPLUG_NO_FLAGS = 0, + LIBUSB_HOTPLUG_ENUMERATE = 1 << 0, +} libusb_hotplug_flag; + +typedef enum { + LIBUSB_HOTPLUG_EVENT_DEVICE_ARRIVED = 1, + LIBUSB_HOTPLUG_EVENT_DEVICE_LEFT = 2, +} libusb_hotplug_event; + /* libusb structures */ struct libusb_context; struct libusb_device; struct libusb_transfer; struct libusb_device_handle; +struct libusb_hotplug_callback_handle; struct libusb_pollfd { int fd; @@ -263,6 +276,7 @@ typedef struct libusb_device_handle libusb_device_handle; typedef struct libusb_pollfd libusb_pollfd; typedef void (*libusb_pollfd_added_cb) (int fd, short events, void *user_data); typedef void (*libusb_pollfd_removed_cb) (int fd, void *user_data); +typedef struct libusb_hotplug_callback_handle *libusb_hotplug_callback_handle; typedef struct libusb_device_descriptor { uint8_t bLength; @@ -539,6 +553,14 @@ int libusb_interrupt_transfer(libusb_device_handle * devh, uint8_t endpoint, uin uint16_t libusb_cpu_to_le16(uint16_t x); uint16_t libusb_le16_to_cpu(uint16_t x); +/* Hotplug support */ + +typedef int (*libusb_hotplug_callback_fn)(libusb_context *ctx, + libusb_device *device, libusb_hotplug_event event, void *user_data); + +int libusb_hotplug_register_callback(libusb_context *ctx, libusb_hotplug_event events, libusb_hotplug_flag flags, int vendor_id, int product_id, int dev_class, libusb_hotplug_callback_fn cb_fn, void *user_data, libusb_hotplug_callback_handle *handle); +void libusb_hotplug_deregister_callback(libusb_context *ctx, libusb_hotplug_callback_handle handle); + #if 0 { /* indent fix */ #endif |