Tizen Native API
9.0
|
This API is used to handle tasks related to USB interfaces.
This API is used to handle tasks related to USB interfaces
Overview
Data structures and operations described here are related to USB interface. Each interface has number of endpoints used for performing transfer operations.
Related Features
This API is related with the following features:
- http://tizen.org/feature/usb.host
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_claim_interface (usb_host_interface_h interface, bool force) |
Claims a USB interface on a device for further I/O. | |
int | usb_host_release_interface (usb_host_interface_h interface) |
Releases a previously claimed interface on a device. | |
int | usb_host_interface_get_number (usb_host_interface_h interface, int *number) |
Gets the "number" of the given USB interface handle. | |
int | usb_host_interface_get_num_endpoints (usb_host_interface_h interface, int *num_endpoints) |
Gets the number of endpoints in given USB interface. | |
int | usb_host_interface_get_endpoint (usb_host_interface_h interface, int ep_index, usb_host_endpoint_h *ep) |
Gets an endpoint via index from given USB interface. | |
int | usb_host_interface_set_altsetting (usb_host_interface_h interface, int altsetting) |
Sets an alternative setting for given USB interface. | |
int | usb_host_interface_get_altsetting (usb_host_interface_h interface, int *altsetting) |
Gets current alternative setting from an interface. | |
int | usb_host_interface_get_str (usb_host_interface_h interface, int *length, unsigned char *data) |
Gets a string describing the given USB interface into a buffer. | |
Typedefs | |
typedef struct usb_host_interface_s * | usb_host_interface_h |
An opaque handle representing a USB configuration interface. |
Typedef Documentation
typedef struct usb_host_interface_s* usb_host_interface_h |
An opaque handle representing a USB configuration interface.
This type represents USB interface. An interface is a part of configuration and can have multiple endpoints. This handle can be obtained by usb_host_config_get_interface().
- Since :
- 3.0
Function Documentation
int usb_host_claim_interface | ( | usb_host_interface_h | interface, |
bool | force | ||
) |
Claims a USB interface on a device for further I/O.
Claims interface on a device. To perform I/O operations on interface user has to claim it. Remember to call usb_host_release_interface() when communication with the device is finished.
- Since :
- 3.0
- Parameters:
-
[in] interface The bInterfaceNumber of interface to claim [in] force Set to true to auto detach kernel driver, set to false to not detach it
- Returns:
- 0 on success, otherwise a negative error value
- Return values:
-
USB_HOST_ERROR_NONE Successful USB_HOST_ERROR_NOT_FOUND Requested interface does not exist USB_HOST_ERROR_RESOURCE_BUSY Another program or driver has claimed the interface USB_HOST_ERROR_NO_SUCH_DEVICE Device has been disconnected USB_HOST_ERROR_INVALID_PARAMETER Invalid parameter was passed USB_HOST_ERROR_DEVICE_NOT_OPENED The device was not opened
int usb_host_interface_get_altsetting | ( | usb_host_interface_h | interface, |
int * | altsetting | ||
) |
Gets current alternative setting from an interface.
Gets current alternative setting from an interface.
- Since :
- 4.0
- Parameters:
-
[in] interface Interface handle [out] altsetting Index of alternative setting set for the given interface
- Returns:
- 0 on success, otherwise a negative error value
- Return values:
-
USB_HOST_ERROR_NONE Successful USB_HOST_ERROR_NOT_SUPPORTED Not supported USB_HOST_ERROR_INVALID_PARAMETER Invalid parameter was passed
int usb_host_interface_get_endpoint | ( | usb_host_interface_h | interface, |
int | ep_index, | ||
usb_host_endpoint_h * | ep | ||
) |
Gets an endpoint via index from given USB interface.
Gets an endpoint via index from given USB interface.
- Since :
- 3.0
- Parameters:
-
[in] interface Interface handle [in] ep_index index of endpoint to retrieve (counting from 0) [out] ep Endpoint handle
- Remarks:
- ep handle is no longer valid when config will be destroyed. There is no need to destroy it, it is done automatically when the configuration is destroyed.
- Returns:
- 0 on success, otherwise a negative error value
- Return values:
-
USB_HOST_ERROR_NONE Successful USB_HOST_ERROR_INVALID_PARAMETER Invalid parameter was passed
int usb_host_interface_get_num_endpoints | ( | usb_host_interface_h | interface, |
int * | num_endpoints | ||
) |
Gets the number of endpoints in given USB interface.
Gets the number of endpoints in given USB interface.
- Since :
- 3.0
- Parameters:
-
[in] interface An interface [out] num_endpoints Number of endpoints in interface
- Returns:
- 0 on success, otherwise a negative error value
- Return values:
-
USB_HOST_ERROR_NONE Successful USB_HOST_ERROR_NOT_SUPPORTED Not supported USB_HOST_ERROR_INVALID_PARAMETER Invalid parameter was passed
int usb_host_interface_get_number | ( | usb_host_interface_h | interface, |
int * | number | ||
) |
Gets the "number" of the given USB interface handle.
Gets the "number" of the given USB interface handle.
- Since :
- 3.0
- Parameters:
-
[in] interface An interface [out] number Number of given interface
- Returns:
- 0 on success, otherwise a negative error value
- Return values:
-
USB_HOST_ERROR_NONE Successful USB_HOST_ERROR_NOT_SUPPORTED Not supported USB_HOST_ERROR_INVALID_PARAMETER Invalid parameter was passed
int usb_host_interface_get_str | ( | usb_host_interface_h | interface, |
int * | length, | ||
unsigned char * | data | ||
) |
Gets a string describing the given USB interface into a buffer.
Gets a string describing the given USB interface into a buffer.
- Since :
- 3.0
- Parameters:
-
[in] interface An interface [in,out] length Data buffer size/how much was actually used [out] data Buffer to store string
- Returns:
- 0 on success, otherwise a negative error value
- Return values:
-
USB_HOST_ERROR_NONE Successful USB_HOST_ERROR_NOT_SUPPORTED Not supported USB_HOST_ERROR_OVERFLOW There was no space in buffer USB_HOST_ERROR_INVALID_PARAMETER Invalid parameter was passed
- Precondition:
- device which interface is part of must be opened by usb_host_device_open() or usb_host_device_open_with_vid_pid()
int usb_host_interface_set_altsetting | ( | usb_host_interface_h | interface, |
int | altsetting | ||
) |
Sets an alternative setting for given USB interface.
Sets an alternative setting for given USB interface.
- Since :
- 3.0
- Parameters:
-
[in] interface Interface handle [in] altsetting Index of new alternative setting for given interface
- Returns:
- 0 on success, otherwise a negative error value
- Return values:
-
USB_HOST_ERROR_NONE Successful USB_HOST_ERROR_INVALID_PARAMETER Invalid parameter was passed
int usb_host_release_interface | ( | usb_host_interface_h | interface | ) |
Releases a previously claimed interface on a device.
Releases interface previously claimed by usb_host_claim_interface(). This is a blocking function.
- Since :
- 3.0
- Parameters:
-
[in] interface The bInterfaceNumber of interface to release
- Returns:
- 0 on success, otherwise a negative error value
- Return values:
-
USB_HOST_ERROR_NONE Successful USB_HOST_ERROR_NOT_FOUND Interface was not claimed USB_HOST_ERROR_NO_SUCH_DEVICE Device has been disconnected USB_HOST_ERROR_INVALID_PARAMETER Invalid parameter was passed USB_HOST_ERROR_DEVICE_NOT_OPENED The device was not opened USB_HOST_ERROR_NOT_SUPPORTED Not supported