Tizen Native API  5.0
Hotplug event notification

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.

Functions

int usb_host_set_hotplug_cb (usb_host_context_h ctx, usb_host_hotplug_cb cb, usb_host_hotplug_event_e event, void *user_data, usb_host_hotplug_h *handle)
 Sets a callback function to be invoked when a device is connected or disconnected.
int usb_host_unset_hotplug_cb (usb_host_hotplug_h handle)
 Unsets the hotplug callback function.

Typedefs

typedef struct usb_host_hotplug_s * usb_host_hotplug_h
 USB hotplug callback handle.
typedef void(* usb_host_hotplug_cb )(usb_host_device_h dev, void *user_data)
 Device connected/disconnected event handler.

Typedef Documentation

typedef void(* usb_host_hotplug_cb)(usb_host_device_h dev, void *user_data)

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]devDevice which was connected/disconnected
[in]user_dataUser data pointer passed on callback registration
typedef struct usb_host_hotplug_s* usb_host_hotplug_h

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

int usb_host_set_hotplug_cb ( usb_host_context_h  ctx,
usb_host_hotplug_cb  cb,
usb_host_hotplug_event_e  event,
void *  user_data,
usb_host_hotplug_h handle 
)

Sets a callback function to be invoked when a device is connected or disconnected.

Since :
4.0
Parameters:
[in]ctxContext handle
[in]cbThe callback function to be registered
[in]eventEvent that will trigger registered callback
[in]user_dataThe user data to be passed to the callback function
[out]handleHandle of the registered callback
Returns:
0 on success, negative error code on error
Return values:
USB_HOST_ERROR_NONESuccessful
USB_HOST_ERROR_NOT_SUPPORTEDNot supported
USB_HOST_ERROR_INVALID_PARAMETERInvalid parameter was passed
USB_HOST_ERROR_OUT_OF_MEMORYOut of memory

Unsets the hotplug callback function.

Since :
4.0
Parameters:
[in]handleHandle of the callback to be unregistered
Returns:
0 on success, negative error code on error
Return values:
USB_HOST_ERROR_NONESuccessful
USB_HOST_ERROR_INVALID_PARAMETERInvalid parameter was passed
USB_HOST_ERROR_NOT_SUPPORTEDNot supported