|
libusb
|
This page details how to use the libusb hotplug interface. More...
Typedefs | |
| typedef struct libusb_hotplug_callback | libusb_hotplug_callback |
| Structure representing a libusb hotplug callback. | |
| typedef void(* | libusb_hotplug_callback_fn )(libusb_context *ctx, libusb_device *device, libusb_hotplug_event event, void *user_data) |
| Hotplug callback function type. | |
Enumerations | |
| enum | libusb_hotplug_flag { LIBUSB_HOTPLUG_PERSIST = 0, LIBUSB_HOTPLUG_ONCE = 1 } |
| Flags for hotplug events. More... | |
| enum | libusb_hotplug_event { LIBUSB_HOTPLUG_EVENT_DEVICE_ARRIVED = 0x01, LIBUSB_HOTPLUG_EVENT_DEVICE_LEFT = 0x02 } |
| Hotplug events. More... | |
| enum | { LIBUSB_HOTPLUG_CLASS_ANY = -1, LIBUSB_HOTPLUG_VENDORID_ANY = -2, LIBUSB_HOTPLUG_PRODUCTID_ANY = -3 } |
| Wildcard matching for hotplug events. More... | |
Functions | |
| int | libusb_hotplug_register_callback (libusb_context *ctx, libusb_hotplug_event event, 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 **cb) |
| Register a hotplug callback function. | |
| void | libusb_hotplug_deregister_callback (libusb_hotplug_callback *cb) |
| Deregisters a hotplug callback. | |
This page details how to use the libusb hotplug interface.
| typedef struct libusb_hotplug_callback libusb_hotplug_callback |
Structure representing a libusb hotplug callback.
Callbacks are created by libusb_hotplug_alloc_callback() and freed by libusb_hotplug_free_callback().
For more information, see Device hotplug event notification.
| typedef void( * libusb_hotplug_callback_fn)(libusb_context *ctx, libusb_device *device, libusb_hotplug_event event, void *user_data) |
Hotplug callback function type.
When requesting hotplug support, you pass a pointer to a callback function of this type. libusb will call this function later, when a matching device has been connected. See Device hotplug event notification for more information.
| libusb_context | context of this notification |
| device | libusb_device this event occurred on |
| event | event that occurred |
| user_data | user data provided when this callback was registered |
| enum libusb_hotplug_flag |
Flags for hotplug events.
| LIBUSB_HOTPLUG_PERSIST |
The hotplug event will persist until removed with libusb_hotplug_deregister_callback() or libusb_exit() |
| LIBUSB_HOTPLUG_ONCE |
The hotplug callback will fire once and be automatically deregistered. |
| enum libusb_hotplug_event |
Hotplug events.
| anonymous enum |
| int libusb_hotplug_register_callback | ( | libusb_context * | ctx, |
| libusb_hotplug_event | event, | ||
| 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 ** | cb | ||
| ) |
Register a hotplug callback function.
| [in] | ctx | context to register this callback with |
| [in] | event | the events that will trigger this callback |
| [in] | flags | hotplug callback flags (described above) |
| [in] | vendor_id | the vendor id to match or LIBUSB_HOTPLUG_PRODUCTID_ANY |
| [in] | product_id | the product id to match or LIBUSB_HOTPLUG_PRODUCTID_ANY |
| [in] | dev_class | the device class to match or LIBUSB_HOTPLUG_CLASS_ANY |
| [in] | cb_fn | the function to be invoked on a matching event/device |
| [in] | user_data | user data to pass to the callback function |
| [out] | cb | allocated callback on success |
| void libusb_hotplug_deregister_callback | ( | libusb_hotplug_callback * | cb | ) |
Deregisters a hotplug callback.
Do not call this function from within a callback function. This will result in deadlock.
| [in] | cb | the callback to deregister |
1.8.1.1