This API is used to register callbacks to be called when devices are connected or disconnected.
Overview
Functions described here can be used to register callbacks to be called on events such as device connection or disconnection.
Typedef Documentation
Device connected/disconnected event handler.
The device handle should be unreffed with usb_host_unref_device() when no longer needed.
- Since :
- 4.0
- Parameters:
-
[in] | dev | Device which was connected/disconnected |
[in] | user_data | User data pointer passed on callback registration |
USB hotplug callback handle.
This handle is used for managing registered hotplug callbacks.
- Since :
- 4.0
Enumeration Type Documentation
Enumeration of hotplug event types.
- Since :
- 4.0
- Enumerator:
USB_HOST_HOTPLUG_EVENT_ATTACH |
Device was connected
|
USB_HOST_HOTPLUG_EVENT_DETACH |
Device was disconnected
|
USB_HOST_HOTPLUG_EVENT_ANY |
Any event
|
Function Documentation
Sets a callback function to be invoked when a device is connected or disconnected.
- Since :
- 4.0
- Parameters:
-
[in] | ctx | Context handle |
[in] | cb | The callback function to be registered |
[in] | event | Event that will trigger registered callback |
[in] | user_data | The user data to be passed to the callback function |
[out] | handle | Handle of the registered callback |
- Returns:
- 0 on success, negative error code on error
- Return values:
-
Unsets the hotplug callback function.
- Since :
- 4.0
- Parameters:
-
[in] | handle | Handle of the callback to be unregistered |
- Returns:
- 0 on success, negative error code on error
- Return values:
-