*/
int usb_host_device_get_serial_number_str(usb_host_device_h dev, int *length, unsigned char *data);
-/**
- * @ingroup CAPI_USB_HOST_DEV_MODULE
- * @brief Gets string descriptor.
- * @details Retrieves a string descriptor in ASCII.
- * @since_tizen 3.0
- * @param[in] dev An opened device
- * @param[in] desc_index Index of descriptor to retrieve
- * @param[in, out] length Data buffer size/how much was actually used
- * @param[out] data Out buffer for ASCII string descriptor
- * @return 0 on success, otherwise a negative error value
- * @retval #USB_HOST_ERROR_NONE Successful
- * @retval #USB_HOST_ERROR_OVERFLOW There was no space in buffer
- * @retval #USB_HOST_ERROR_NOT_SUPPORTED Not supported
- * @retval #USB_HOST_ERROR_INVALID_PARAMETER Invalid parameter was passed
- * @retval #USB_HOST_ERROR_PERMISSION_DENIED Permission denied
- * @pre dev must point to device opened by usb_host_device_open() or usb_host_device_open_with_vid_pid().
- */
-int usb_host_device_get_string_descriptor_ascii(usb_host_device_h dev,
- int desc_index, int *length, unsigned char *data);
-
/**
* @ingroup CAPI_USB_HOST_CONFIG_MODULE
* @brief Gets number of interfaces for given configuration.
return USB_HOST_ERROR_NONE;
}
+static int usb_host_device_get_string_descriptor_ascii(usb_host_device_h dev,
+ int desc_index, int *length, unsigned char *data)
+{
+ int ret;
+
+ if (!usb_host_feature_enabled())
+ return USB_HOST_ERROR_NOT_SUPPORTED;
+
+ if (!dev || !data || !length) {
+ _E("Invalid parameter was passed");
+ return USB_HOST_ERROR_INVALID_PARAMETER;
+ }
+
+ if (dev->lusb_dev_handle == NULL) {
+ _E("Device is not opened");
+ return USB_HOST_ERROR_DEVICE_NOT_OPENED;
+ }
+
+ ret = libusb_get_string_descriptor_ascii(dev->lusb_dev_handle, desc_index, data, *length);
+ if (ret < 0) {
+ ret = translate_error(ret);
+ _E("Failed to get descriptor(%d)", ret);
+ return ret;
+ }
+
+ *length = ret;
+ return USB_HOST_ERROR_NONE;
+}
+
int usb_host_device_get_manufacturer_str(usb_host_device_h dev, int *length, unsigned char *data)
{
if (!usb_host_feature_enabled())
return ret;
}
-int usb_host_device_get_string_descriptor_ascii(usb_host_device_h dev,
- int desc_index, int *length, unsigned char *data)
-{
- int ret;
-
- if (!usb_host_feature_enabled())
- return USB_HOST_ERROR_NOT_SUPPORTED;
-
- if (!dev || !data || !length) {
- _E("Invalid parameter was passed");
- return USB_HOST_ERROR_INVALID_PARAMETER;
- }
-
- if (dev->lusb_dev_handle == NULL) {
- _E("Device is not opened");
- return USB_HOST_ERROR_DEVICE_NOT_OPENED;
- }
-
- ret = libusb_get_string_descriptor_ascii(dev->lusb_dev_handle, desc_index, data, *length);
- if (ret < 0) {
- ret = translate_error(ret);
- _E("Failed to get descriptor(%d)", ret);
- return ret;
- }
-
- *length = ret;
- return USB_HOST_ERROR_NONE;
-}
-
int usb_host_control_transfer(usb_host_device_h dev, uint8_t bmRequestType,
uint8_t bRequest, uint16_t wValue, uint16_t wIndex,
unsigned char *data, uint16_t wLength, unsigned int timeout, int *transfered)