aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/gadget
diff options
context:
space:
mode:
authorSebastian Andrzej Siewior <bigeasy@linutronix.de>2012-09-06 14:11:18 -0400
committerFelipe Balbi <balbi@ti.com>2012-09-10 09:12:52 -0400
commit18786da4853017d983ff6911648543ca617c12d1 (patch)
treed9e4ccb116ab9f6063f0662403462ed451c56a8d /drivers/usb/gadget
parent5a175bb84d7344fbe5e26cf61b597129e7c80564 (diff)
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: Michal Nazarewicz <mina86@mina86.com> Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Signed-off-by: Felipe Balbi <balbi@ti.com>
Diffstat (limited to 'drivers/usb/gadget')
-rw-r--r--drivers/usb/gadget/tcm_usb_gadget.c33
-rw-r--r--drivers/usb/gadget/tcm_usb_gadget.h14
2 files changed, 28 insertions, 19 deletions
diff --git a/drivers/usb/gadget/tcm_usb_gadget.c b/drivers/usb/gadget/tcm_usb_gadget.c
index e64a759f100d..2f4980881a80 100644
--- a/drivers/usb/gadget/tcm_usb_gadget.c
+++ b/drivers/usb/gadget/tcm_usb_gadget.c
@@ -1974,7 +1974,6 @@ static struct usb_interface_descriptor bot_intf_desc = {
1974 .bInterfaceClass = USB_CLASS_MASS_STORAGE, 1974 .bInterfaceClass = USB_CLASS_MASS_STORAGE,
1975 .bInterfaceSubClass = USB_SC_SCSI, 1975 .bInterfaceSubClass = USB_SC_SCSI,
1976 .bInterfaceProtocol = USB_PR_BULK, 1976 .bInterfaceProtocol = USB_PR_BULK,
1977 .iInterface = USB_G_STR_INT_UAS,
1978}; 1977};
1979 1978
1980static struct usb_interface_descriptor uasp_intf_desc = { 1979static struct usb_interface_descriptor uasp_intf_desc = {
@@ -1985,7 +1984,6 @@ static struct usb_interface_descriptor uasp_intf_desc = {
1985 .bInterfaceClass = USB_CLASS_MASS_STORAGE, 1984 .bInterfaceClass = USB_CLASS_MASS_STORAGE,
1986 .bInterfaceSubClass = USB_SC_SCSI, 1985 .bInterfaceSubClass = USB_SC_SCSI,
1987 .bInterfaceProtocol = USB_PR_UAS, 1986 .bInterfaceProtocol = USB_PR_UAS,
1988 .iInterface = USB_G_STR_INT_BBB,
1989}; 1987};
1990 1988
1991static struct usb_endpoint_descriptor uasp_bi_desc = { 1989static struct usb_endpoint_descriptor uasp_bi_desc = {
@@ -2206,20 +2204,16 @@ static struct usb_device_descriptor usbg_device_desc = {
2206 .bDeviceClass = USB_CLASS_PER_INTERFACE, 2204 .bDeviceClass = USB_CLASS_PER_INTERFACE,
2207 .idVendor = cpu_to_le16(UAS_VENDOR_ID), 2205 .idVendor = cpu_to_le16(UAS_VENDOR_ID),
2208 .idProduct = cpu_to_le16(UAS_PRODUCT_ID), 2206 .idProduct = cpu_to_le16(UAS_PRODUCT_ID),
2209 .iManufacturer = USB_G_STR_MANUFACTOR,
2210 .iProduct = USB_G_STR_PRODUCT,
2211 .iSerialNumber = USB_G_STR_SERIAL,
2212
2213 .bNumConfigurations = 1, 2207 .bNumConfigurations = 1,
2214}; 2208};
2215 2209
2216static struct usb_string usbg_us_strings[] = { 2210static struct usb_string usbg_us_strings[] = {
2217 { USB_G_STR_MANUFACTOR, "Target Manufactor"}, 2211 [USB_G_STR_MANUFACTOR].s = "Target Manufactor",
2218 { USB_G_STR_PRODUCT, "Target Product"}, 2212 [USB_G_STR_PRODUCT].s = "Target Product",
2219 { USB_G_STR_SERIAL, "000000000001"}, 2213 [USB_G_STR_SERIAL].s = "000000000001",
2220 { USB_G_STR_CONFIG, "default config"}, 2214 [USB_G_STR_CONFIG].s = "default config",
2221 { USB_G_STR_INT_UAS, "USB Attached SCSI"}, 2215 [USB_G_STR_INT_UAS].s = "USB Attached SCSI",
2222 { USB_G_STR_INT_BBB, "Bulk Only Transport"}, 2216 [USB_G_STR_INT_BBB].s = "Bulk Only Transport",
2223 { }, 2217 { },
2224}; 2218};
2225 2219
@@ -2241,7 +2235,6 @@ static int guas_unbind(struct usb_composite_dev *cdev)
2241static struct usb_configuration usbg_config_driver = { 2235static struct usb_configuration usbg_config_driver = {
2242 .label = "Linux Target", 2236 .label = "Linux Target",
2243 .bConfigurationValue = 1, 2237 .bConfigurationValue = 1,
2244 .iConfiguration = USB_G_STR_CONFIG,
2245 .bmAttributes = USB_CONFIG_ATT_SELFPOWER, 2238 .bmAttributes = USB_CONFIG_ATT_SELFPOWER,
2246}; 2239};
2247 2240
@@ -2414,6 +2407,9 @@ static int usbg_cfg_bind(struct usb_configuration *c)
2414 fu->function.disable = usbg_disable; 2407 fu->function.disable = usbg_disable;
2415 fu->tpg = the_only_tpg_I_currently_have; 2408 fu->tpg = the_only_tpg_I_currently_have;
2416 2409
2410 bot_intf_desc.iInterface = usbg_us_strings[USB_G_STR_INT_BBB].id;
2411 uasp_intf_desc.iInterface = usbg_us_strings[USB_G_STR_INT_UAS].id;
2412
2417 ret = usb_add_function(c, &fu->function); 2413 ret = usb_add_function(c, &fu->function);
2418 if (ret) 2414 if (ret)
2419 goto err; 2415 goto err;
@@ -2428,6 +2424,17 @@ static int usb_target_bind(struct usb_composite_dev *cdev)
2428{ 2424{
2429 int ret; 2425 int ret;
2430 2426
2427 ret = usb_string_ids_tab(cdev, usbg_us_strings);
2428 if (ret)
2429 return ret;
2430
2431 usbg_device_desc.iManufacturer =
2432 usbg_us_strings[USB_G_STR_MANUFACTOR].id;
2433 usbg_device_desc.iProduct = usbg_us_strings[USB_G_STR_PRODUCT].id;
2434 usbg_device_desc.iSerialNumber = usbg_us_strings[USB_G_STR_SERIAL].id;
2435 usbg_config_driver.iConfiguration =
2436 usbg_us_strings[USB_G_STR_CONFIG].id;
2437
2431 ret = usb_add_config(cdev, &usbg_config_driver, 2438 ret = usb_add_config(cdev, &usbg_config_driver,
2432 usbg_cfg_bind); 2439 usbg_cfg_bind);
2433 return 0; 2440 return 0;
diff --git a/drivers/usb/gadget/tcm_usb_gadget.h b/drivers/usb/gadget/tcm_usb_gadget.h
index bb18999a9a8d..9d32ec30f4e4 100644
--- a/drivers/usb/gadget/tcm_usb_gadget.h
+++ b/drivers/usb/gadget/tcm_usb_gadget.h
@@ -16,12 +16,14 @@
16#define UASP_SS_EP_COMP_LOG_STREAMS 4 16#define UASP_SS_EP_COMP_LOG_STREAMS 4
17#define UASP_SS_EP_COMP_NUM_STREAMS (1 << UASP_SS_EP_COMP_LOG_STREAMS) 17#define UASP_SS_EP_COMP_NUM_STREAMS (1 << UASP_SS_EP_COMP_LOG_STREAMS)
18 18
19#define USB_G_STR_MANUFACTOR 1 19enum {
20#define USB_G_STR_PRODUCT 2 20 USB_G_STR_MANUFACTOR,
21#define USB_G_STR_SERIAL 3 21 USB_G_STR_PRODUCT,
22#define USB_G_STR_CONFIG 4 22 USB_G_STR_SERIAL,
23#define USB_G_STR_INT_UAS 5 23 USB_G_STR_CONFIG,
24#define USB_G_STR_INT_BBB 6 24 USB_G_STR_INT_UAS,
25 USB_G_STR_INT_BBB,
26};
25 27
26#define USB_G_ALT_INT_BBB 0 28#define USB_G_ALT_INT_BBB 0
27#define USB_G_ALT_INT_UAS 1 29#define USB_G_ALT_INT_UAS 1