Tizen Native API  5.0
USB Configuration

USB configuration-related API.

Overview

Data structures and operations described here are related to USB configuration.

Related Features

This API is related with the following features:

It is recommended to design feature related codes in your application for reliability.

You can check if a device supports the related features for this API by using System Information, thereby controlling the procedure of your application.

To ensure your application is only running on the device with specific features, please define the features in your manifest file using the manifest editor in the SDK.

More details on featuring your application can be found from Feature List.

Functions

int usb_host_config_get_num_interfaces (usb_host_config_h config, int *num_interfaces)
 Gets number of interfaces for given configuration.
int usb_host_config_is_self_powered (usb_host_config_h config, bool *self_powered)
 Checks if device is self-powered in given configuration.
int usb_host_config_support_remote_wakeup (usb_host_config_h config, bool *remote_wakeup)
 Checks if device in given configuration supports remote wakeup.
int usb_host_config_get_max_power (usb_host_config_h config, int *max_power)
 Gets maximum power in given configuration, in mA.
int usb_host_device_get_config_str (usb_host_config_h config, int *length, unsigned char *data)
 Gets string describing a configuration.
int usb_host_config_get_interface (usb_host_config_h config, int interface_index, usb_host_interface_h *interface)
 Gets an interface from configuration.
int usb_host_config_destroy (usb_host_config_h config)
 Frees configuration.

Typedefs

typedef struct usb_host_config_s * usb_host_config_h
 USB config handle.

Typedef Documentation

typedef struct usb_host_config_s* usb_host_config_h

USB config handle.

This type represents USB device configuration. Device can have multiple configurations, a configuration can have multiple interfaces. This handle can be obtained by usb_host_device_get_config().

Since :
3.0

Function Documentation

Frees configuration.

Frees configuration obtained from usb_host_device_get_config().

Since :
3.0
Parameters:
[in]configConfiguration to free
Returns:
0 on success, otherwise a negative error value
Return values:
USB_HOST_ERROR_NONESuccessful
USB_HOST_ERROR_INVALID_PARAMETERInvalid parameter was passed
Precondition:
config must be obtained by usb_host_device_get_config().
int usb_host_config_get_interface ( usb_host_config_h  config,
int  interface_index,
usb_host_interface_h interface 
)

Gets an interface from configuration.

Gets a USB interface from configuration by its index.

Since :
3.0
Parameters:
[in]configConfiguration handle
[in]interface_indexindex of interface to retrieve (counting from 0)
[out]interfaceInterface handle
Remarks:
There is no need to destroy the interface handle. It is no longer valid when config is destroyed.
Returns:
0 on success, otherwise a negative error value
Return values:
USB_HOST_ERROR_NONESuccessful
USB_HOST_ERROR_NOT_FOUNDConfiguration does not exist
USB_HOST_ERROR_NOT_SUPPORTEDNot supported
USB_HOST_ERROR_INVALID_PARAMETERInvalid parameter was passed
int usb_host_config_get_max_power ( usb_host_config_h  config,
int *  max_power 
)

Gets maximum power in given configuration, in mA.

Since :
3.0
Parameters:
[in]configA configuration
[out]max_powerMaximum power, in mA
Returns:
0 on success, otherwise a negative error value
Return values:
USB_HOST_ERROR_NONESuccessful
USB_HOST_ERROR_NOT_SUPPORTEDNot supported
USB_HOST_ERROR_INVALID_PARAMETERInvalid parameter was passed
int usb_host_config_get_num_interfaces ( usb_host_config_h  config,
int *  num_interfaces 
)

Gets number of interfaces for given configuration.

Since :
3.0
Parameters:
[in]configA configuration
[out]num_interfacesNumber of interfaces
Returns:
0 on success, otherwise a negative error value
Return values:
USB_HOST_ERROR_NONESuccessful
USB_HOST_ERROR_NOT_SUPPORTEDNot supported
USB_HOST_ERROR_INVALID_PARAMETERInvalid parameter was passed
int usb_host_config_is_self_powered ( usb_host_config_h  config,
bool *  self_powered 
)

Checks if device is self-powered in given configuration.

Since :
3.0
Parameters:
[in]configA configuration
[out]self_poweredTrue if device is self-powered in given configuration, false otherwise
Returns:
0 on success, negative error code otherwise
Return values:
USB_HOST_ERROR_NONESuccessful
USB_HOST_ERROR_INVALID_PARAMETERInvalid parameter was passed
USB_HOST_ERROR_NOT_SUPPORTEDNot supported
int usb_host_config_support_remote_wakeup ( usb_host_config_h  config,
bool *  remote_wakeup 
)

Checks if device in given configuration supports remote wakeup.

Since :
3.0
Parameters:
[in]configA configuration
[out]remote_wakeupTrue if device supports remote wakeup in given configuration, false otherwise
Returns:
0 on success, negative error code otherwise
Return values:
USB_HOST_ERROR_NONESuccessful
@USB_HOST_ERROR_INVALID_PARAMETERInvalid parameter was passed
USB_HOST_ERROR_NOT_SUPPORTEDNot supported
int usb_host_device_get_config_str ( usb_host_config_h  config,
int *  length,
unsigned char *  data 
)

Gets string describing a configuration.

Since :
3.0
Parameters:
[in]configA configuration
[in,out]lengthData buffer size/how much was actually used
[out]dataBuffer to store string
Returns:
0 on success, otherwise a negative error value
Return values:
USB_HOST_ERROR_NONESuccessful
USB_HOST_ERROR_NOT_SUPPORTEDNot supported
USB_HOST_ERROR_OVERFLOWThere was no space in buffer
USB_HOST_ERROR_OUT_OF_MEMORYOut of memory
USB_HOST_ERROR_INVALID_PARAMETERInvalid parameter was passed
Precondition:
config must be configuration of device opened by usb_host_device_open() or usb_host_device_open_with_vid_pid()