summaryrefslogtreecommitdiffstats
path: root/lib/libusb/libusb10.h
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libusb/libusb10.h')
-rw-r--r--lib/libusb/libusb10.h18
1 files changed, 18 insertions, 0 deletions
diff --git a/lib/libusb/libusb10.h b/lib/libusb/libusb10.h
index f1e5460..d2df6e0 100644
--- a/lib/libusb/libusb10.h
+++ b/lib/libusb/libusb10.h
@@ -36,6 +36,8 @@
#define CTX_LOCK(ctx) pthread_mutex_lock(&(ctx)->ctx_lock)
#define CTX_TRYLOCK(ctx) pthread_mutex_trylock(&(ctx)->ctx_lock)
#define CTX_UNLOCK(ctx) pthread_mutex_unlock(&(ctx)->ctx_lock)
+#define HOTPLUG_LOCK(ctx) pthread_mutex_lock(&(ctx)->hotplug_lock)
+#define HOTPLUG_UNLOCK(ctx) pthread_mutex_unlock(&(ctx)->hotplug_lock)
#define DPRINTF(ctx, dbg, format, args...) do { \
if ((ctx)->debug == dbg) { \
@@ -72,6 +74,16 @@ struct libusb_super_transfer {
#define LIBUSB_SUPER_XFER_ST_PEND 1
};
+struct libusb_hotplug_callback_handle {
+ TAILQ_ENTRY(libusb_hotplug_callback_handle) entry;
+ int events;
+ int vendor;
+ int product;
+ int devclass;
+ libusb_hotplug_callback_fn fn;
+ void *user_data;
+};
+
struct libusb_context {
int debug;
int debug_fixed;
@@ -80,12 +92,16 @@ struct libusb_context {
int tr_done_gen;
pthread_mutex_t ctx_lock;
+ pthread_mutex_t hotplug_lock;
pthread_cond_t ctx_cond;
+ pthread_t hotplug_handler;
pthread_t ctx_handler;
#define NO_THREAD ((pthread_t)-1)
TAILQ_HEAD(, libusb_super_pollfd) pollfds;
TAILQ_HEAD(, libusb_super_transfer) tr_done;
+ TAILQ_HEAD(, libusb_hotplug_callback_handle) hotplug_cbh;
+ TAILQ_HEAD(, libusb_device) hotplug_devs;
struct libusb_super_pollfd ctx_poll;
@@ -103,6 +119,8 @@ struct libusb_device {
struct libusb_context *ctx;
+ TAILQ_ENTRY(libusb_device) hotplug_entry;
+
TAILQ_HEAD(, libusb_super_transfer) tr_head;
struct libusb20_device *os_priv;
OpenPOWER on IntegriCloud