提交 18786da4 编写于 作者: S Sebastian Andrzej Siewior 提交者: Felipe Balbi

usb: gadget: initialize the strings in tcm_usb_gadget properly

I have no idea what I've been thinking while I was doing this in the first
place. Now the strings are initialized properly and reported by lsusb.

Cc: stable@vger.kernel.org # v3.5
Acked-by: NMichal Nazarewicz <mina86@mina86.com>
Signed-off-by: NSebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: NFelipe Balbi <balbi@ti.com>
上级 5a175bb8
...@@ -1974,7 +1974,6 @@ static struct usb_interface_descriptor bot_intf_desc = { ...@@ -1974,7 +1974,6 @@ static struct usb_interface_descriptor bot_intf_desc = {
.bInterfaceClass = USB_CLASS_MASS_STORAGE, .bInterfaceClass = USB_CLASS_MASS_STORAGE,
.bInterfaceSubClass = USB_SC_SCSI, .bInterfaceSubClass = USB_SC_SCSI,
.bInterfaceProtocol = USB_PR_BULK, .bInterfaceProtocol = USB_PR_BULK,
.iInterface = USB_G_STR_INT_UAS,
}; };
static struct usb_interface_descriptor uasp_intf_desc = { static struct usb_interface_descriptor uasp_intf_desc = {
...@@ -1985,7 +1984,6 @@ static struct usb_interface_descriptor uasp_intf_desc = { ...@@ -1985,7 +1984,6 @@ static struct usb_interface_descriptor uasp_intf_desc = {
.bInterfaceClass = USB_CLASS_MASS_STORAGE, .bInterfaceClass = USB_CLASS_MASS_STORAGE,
.bInterfaceSubClass = USB_SC_SCSI, .bInterfaceSubClass = USB_SC_SCSI,
.bInterfaceProtocol = USB_PR_UAS, .bInterfaceProtocol = USB_PR_UAS,
.iInterface = USB_G_STR_INT_BBB,
}; };
static struct usb_endpoint_descriptor uasp_bi_desc = { static struct usb_endpoint_descriptor uasp_bi_desc = {
...@@ -2206,20 +2204,16 @@ static struct usb_device_descriptor usbg_device_desc = { ...@@ -2206,20 +2204,16 @@ static struct usb_device_descriptor usbg_device_desc = {
.bDeviceClass = USB_CLASS_PER_INTERFACE, .bDeviceClass = USB_CLASS_PER_INTERFACE,
.idVendor = cpu_to_le16(UAS_VENDOR_ID), .idVendor = cpu_to_le16(UAS_VENDOR_ID),
.idProduct = cpu_to_le16(UAS_PRODUCT_ID), .idProduct = cpu_to_le16(UAS_PRODUCT_ID),
.iManufacturer = USB_G_STR_MANUFACTOR,
.iProduct = USB_G_STR_PRODUCT,
.iSerialNumber = USB_G_STR_SERIAL,
.bNumConfigurations = 1, .bNumConfigurations = 1,
}; };
static struct usb_string usbg_us_strings[] = { static struct usb_string usbg_us_strings[] = {
{ USB_G_STR_MANUFACTOR, "Target Manufactor"}, [USB_G_STR_MANUFACTOR].s = "Target Manufactor",
{ USB_G_STR_PRODUCT, "Target Product"}, [USB_G_STR_PRODUCT].s = "Target Product",
{ USB_G_STR_SERIAL, "000000000001"}, [USB_G_STR_SERIAL].s = "000000000001",
{ USB_G_STR_CONFIG, "default config"}, [USB_G_STR_CONFIG].s = "default config",
{ USB_G_STR_INT_UAS, "USB Attached SCSI"}, [USB_G_STR_INT_UAS].s = "USB Attached SCSI",
{ USB_G_STR_INT_BBB, "Bulk Only Transport"}, [USB_G_STR_INT_BBB].s = "Bulk Only Transport",
{ }, { },
}; };
...@@ -2241,7 +2235,6 @@ static int guas_unbind(struct usb_composite_dev *cdev) ...@@ -2241,7 +2235,6 @@ static int guas_unbind(struct usb_composite_dev *cdev)
static struct usb_configuration usbg_config_driver = { static struct usb_configuration usbg_config_driver = {
.label = "Linux Target", .label = "Linux Target",
.bConfigurationValue = 1, .bConfigurationValue = 1,
.iConfiguration = USB_G_STR_CONFIG,
.bmAttributes = USB_CONFIG_ATT_SELFPOWER, .bmAttributes = USB_CONFIG_ATT_SELFPOWER,
}; };
...@@ -2414,6 +2407,9 @@ static int usbg_cfg_bind(struct usb_configuration *c) ...@@ -2414,6 +2407,9 @@ static int usbg_cfg_bind(struct usb_configuration *c)
fu->function.disable = usbg_disable; fu->function.disable = usbg_disable;
fu->tpg = the_only_tpg_I_currently_have; fu->tpg = the_only_tpg_I_currently_have;
bot_intf_desc.iInterface = usbg_us_strings[USB_G_STR_INT_BBB].id;
uasp_intf_desc.iInterface = usbg_us_strings[USB_G_STR_INT_UAS].id;
ret = usb_add_function(c, &fu->function); ret = usb_add_function(c, &fu->function);
if (ret) if (ret)
goto err; goto err;
...@@ -2428,6 +2424,17 @@ static int usb_target_bind(struct usb_composite_dev *cdev) ...@@ -2428,6 +2424,17 @@ static int usb_target_bind(struct usb_composite_dev *cdev)
{ {
int ret; int ret;
ret = usb_string_ids_tab(cdev, usbg_us_strings);
if (ret)
return ret;
usbg_device_desc.iManufacturer =
usbg_us_strings[USB_G_STR_MANUFACTOR].id;
usbg_device_desc.iProduct = usbg_us_strings[USB_G_STR_PRODUCT].id;
usbg_device_desc.iSerialNumber = usbg_us_strings[USB_G_STR_SERIAL].id;
usbg_config_driver.iConfiguration =
usbg_us_strings[USB_G_STR_CONFIG].id;
ret = usb_add_config(cdev, &usbg_config_driver, ret = usb_add_config(cdev, &usbg_config_driver,
usbg_cfg_bind); usbg_cfg_bind);
return 0; return 0;
......
...@@ -16,12 +16,14 @@ ...@@ -16,12 +16,14 @@
#define UASP_SS_EP_COMP_LOG_STREAMS 4 #define UASP_SS_EP_COMP_LOG_STREAMS 4
#define UASP_SS_EP_COMP_NUM_STREAMS (1 << UASP_SS_EP_COMP_LOG_STREAMS) #define UASP_SS_EP_COMP_NUM_STREAMS (1 << UASP_SS_EP_COMP_LOG_STREAMS)
#define USB_G_STR_MANUFACTOR 1 enum {
#define USB_G_STR_PRODUCT 2 USB_G_STR_MANUFACTOR,
#define USB_G_STR_SERIAL 3 USB_G_STR_PRODUCT,
#define USB_G_STR_CONFIG 4 USB_G_STR_SERIAL,
#define USB_G_STR_INT_UAS 5 USB_G_STR_CONFIG,
#define USB_G_STR_INT_BBB 6 USB_G_STR_INT_UAS,
USB_G_STR_INT_BBB,
};
#define USB_G_ALT_INT_BBB 0 #define USB_G_ALT_INT_BBB 0
#define USB_G_ALT_INT_UAS 1 #define USB_G_ALT_INT_UAS 1
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册