linux-usb: optimize to match the Huawei USB storage devices and support new switch command
Subsystems (2)
PATCH 1/1 linux-usb: optimize to match the Huawei USB storage devices and support new switch command
From: fangxiaozhi <[email protected]>
1. To optimize the match rules for the Huawei USB storage devices. Avoid to load USB storage driver for modem interface with Huawei devices.
2. Add to support new switch command for new Huawei USB dongles.
-------------------------------------------------------------------------------------------------
drivers/usb/storage/initializers.c +59 -2
@@ -92,8 +92,8 @@ int usb_stor_ucr61s2b_init(struct us_datreturn 0 ; } -/* This places the HUAWEI E220 devices in multi-port mode */ -int usb_stor_huawei_e220_init (struct us_data *us) +/* This places the HUAWEI usb dongles in multi-port mode */ +static int usb_stor_huawei_feature_init (struct us_data *us) {int result;
@@ -104,3 +104,60 @@ int usb_stor_huawei_e220_init(struct us_US_DEBUGP ("Huawei mode set result is %d\n" , result);return 0 ; } + +/*Find the supported Huawei USB dongles*/ +static int usb_stor_huawei_dongles_pid (struct us_data *us) +{ +int ret =0 ; +struct usb_interface_descriptor *idesc =NULL ; + idesc = &us->pusb_intf->cur_altsetting->desc; +if (idesc !=NULL && idesc->bInterfaceNumber ==0 ) { +if ((us->pusb_dev->descriptor.idProduct >=0x1401 && us->pusb_dev->descriptor.idProduct <=0x1600 ) + || (us->pusb_dev->descriptor.idProduct >=0x1c02 && us->pusb_dev->descriptor.idProduct <=0x2202 ) + || (us->pusb_dev->descriptor.idProduct ==0x1001 ) + || (us->pusb_dev->descriptor.idProduct ==0x1003 ) + || (us->pusb_dev->descriptor.idProduct ==0x1004 )) { + +if (us->pusb_dev->descriptor.idProduct >=0x1501 + && us->pusb_dev->descriptor.idProduct <=0x1504 ) { + ret =0 ; + }else { + ret =1 ; + } + } + } +return ret; +} + +static int usb_stor_huawei_scsi_init (struct us_data *us) +{ +int result =0 ; +int act_len =0 ; +unsigned char rewind_cmd[] = {0x11 ,0x06 ,0x20 ,0x00 ,0x00 ,0x01 ,0x00 ,0x00 , +0x01 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 }; +struct bulk_cb_wrap bcbw = {0 }; + bcbw.Signature =cpu_to_le32 (US_BULK_CB_SIGN ); + bcbw.Tag =0 ; + bcbw.DataTransferLength =cpu_to_le32 (0 ); + bcbw.Flags = bcbw.Lun =0 ; + bcbw.Length =sizeof (rewind_cmd); +memset (bcbw.CDB,0 ,sizeof (bcbw.CDB)); +memcpy (bcbw.CDB, rewind_cmd,sizeof (rewind_cmd)); + + result =usb_stor_bulk_transfer_buf (us, us->send_bulk_pipe, &bcbw,31 , &act_len); +US_DEBUGP ("usb_stor_bulk_transfer_buf performing result is %d, transfer the actual length=%d\n" , result, act_len); +return result; +} + +int usb_stor_huawei_init (struct us_data *us) +{ +int result =0 ; +if (usb_stor_huawei_dongles_pid (us)) { +if ((us->pusb_dev->descriptor.idProduct >=0x1446 )) { + result =usb_stor_huawei_scsi_init (us); + }else { + result =usb_stor_huawei_feature_init (us); + } + } +return result; +}
drivers/usb/storage/initializers.h +2 -2
@@ -46,5 +46,5 @@ int usb_stor_euscsi_init(struct us_data* flash reader */ int usb_stor_ucr61s2b_init (struct us_data *us); -/* This places the HUAWEI E220 devices in multi-port mode */ -int usb_stor_huawei_e220_init (struct us_data *us); +/* This places the HUAWEI usb dongles in multi-port mode */ +int usb_stor_huawei_init (struct us_data *us);
drivers/usb/storage/unusual_devs.h +2 -327
337 lines not on this page · raw message
drivers/usb/storage/usb.c +12 -0
@@ -120,6 +120,17 @@ MODULE_PARM_DESC(quirks, "supplemental l .useTransport = use_transport, \ } +#define UNUSUAL_VENDOR_INTF (idVendor, cl, sc, pr, \ + vendor_name, product_name, use_protocol, use_transport, \ + init_function, Flags) \ +{ \ + .vendorName = vendor_name, \ + .productName = product_name, \ + .useProtocol = use_protocol, \ + .useTransport = use_transport, \ + .initFunction = init_function, \ +} +static struct us_unusual_dev us_unusual_dev_list[] = { # include "unusual_devs.h" { }/* Terminating entry */
@@ -131,6 +142,7 @@ static struct us_unusual_dev for_dynamic#undef UNUSUAL_DEV#undef COMPLIANT_DEV#undef USUAL_DEV +#undef UNUSUAL_VENDOR_INTF#ifdef CONFIG_LOCKDEP
drivers/usb/storage/usual-tables.c +13 -0
@@ -41,6 +41,18 @@#define USUAL_DEV (useProto, useTrans) \ { USB_INTERFACE_INFO(USB_CLASS_MASS_STORAGE, useProto, useTrans) } +/*Define the device is matched with Vendor ID and interface descriptors*/ +#define UNUSUAL_VENDOR_INTF (id_vendor, cl, sc, pr, \ + vendorName, productName,useProtocol, useTransport, \ + initFunction, flags) \ +{ \ + .match_flags = USB_DEVICE_ID_MATCH_INT_INFO | USB_DEVICE_ID_MATCH_VENDOR, \ + .idVendor = (id_vendor), \ + .bInterfaceClass = (cl), \ + .bInterfaceSubClass = (sc), \ + .bInterfaceProtocol = (pr), \ + .driver_info = (flags)} +struct usb_device_id usb_storage_usb_ids[] = { # include "unusual_devs.h" { }/* Terminating entry */
@@ -50,6 +62,7 @@ MODULE_DEVICE_TABLE(usb, usb_storage_usb#undef UNUSUAL_DEV#undef COMPLIANT_DEV#undef USUAL_DEV +#undef UNUSUAL_VENDOR_INTF/* * The table of devices to ignore
******************************************************************************************
This email and its attachments contain confidential information from HUAWEI, which is intended only for the person or entity whose address is listed above. Any use of the information contained here in any way (including, but not limited to, total or partial disclosure, reproduction, or dissemination) by persons other than the intended recipient(s) is prohibited. If you receive this email in error, please notify the sender by phone or email immediately and delete it!
*****************************************************************************************
Hi,
ok, let's start.
Quoted 4 lines · On Wed, Dec 12, 2012 at 06:20:33PM +0800, fangxiaozhi 00110321 wrote:
From: fangxiaozhi <[email protected]>
1. To optimize the match rules for the Huawei USB storage devices. Avoid to load USB storage driver for modem interface with Huawei devices.
2. Add to support new switch command for new Huawei USB dongles.
first of all you're doing a whole lot more than these two things and your commit log is a lot over 72 characters.
drivers/usb/storage/initializers.c int usb_stor_ucr61s2b_init(struct us_dat · line 96
Quoted 13 lines
Signed-off-by fangxiaozhi <[email protected]>-------------------------------------------------------------------------------------------------
diff -uprNlinux-3.7_bak/drivers/usb/storage/initializers.clinux-3.7/drivers/usb/storage/initializers.cdrivers/usb/storage/initializers.c +2
-2@@ -92,8 +92,8 @@ int usb_stor_ucr61s2b_init(struct us_datreturn 0 ; } -/* This places the HUAWEI E220 devices in multi-port mode */ -int usb_stor_huawei_e220_init (struct us_data *us) +/* This places the HUAWEI usb dongles in multi-port mode */ +static int usb_stor_huawei_feature_init (struct us_data *us)
renaming this function doesn't look like is part of $SUBJECT
drivers/usb/storage/initializers.c int usb_stor_huawei_e220_init(struct us_ · line 108
Quoted 9 lines
drivers/usb/storage/initializers.c +2
-0{int result;@@ -104,3 +104,60 @@ int usb_stor_huawei_e220_init(struct us_US_DEBUGP ("Huawei mode set result is %d\n" , result);return 0 ; } + +/*Find the supported Huawei USB dongles*/
comment style is wrong, you miss a space after /* and before */
drivers/usb/storage/initializers.c int usb_stor_huawei_e220_init(struct us_ · line 112
Quoted 4 lines
drivers/usb/storage/initializers.c +4
-0+static int usb_stor_huawei_dongles_pid (struct us_data *us) +{ +int ret =0 ; +struct usb_interface_descriptor *idesc =NULL ;
could add a blank line here to aid readability
drivers/usb/storage/initializers.c int usb_stor_huawei_e220_init(struct us_ · line 119
Quoted 7 lines
drivers/usb/storage/initializers.c +7
-0+ idesc = &us->pusb_intf->cur_altsetting->desc; +if (idesc !=NULL && idesc->bInterfaceNumber ==0 ) { +if ((us->pusb_dev->descriptor.idProduct >=0x1401 && us->pusb_dev->descriptor.idProduct <=0x1600 ) + || (us->pusb_dev->descriptor.idProduct >=0x1c02 && us->pusb_dev->descriptor.idProduct <=0x2202 ) + || (us->pusb_dev->descriptor.idProduct ==0x1001 ) + || (us->pusb_dev->descriptor.idProduct ==0x1003 ) + || (us->pusb_dev->descriptor.idProduct ==0x1004 )) {
clearly you didn't even run checkpatch.pl here.
drivers/usb/storage/initializers.c int usb_stor_huawei_e220_init(struct us_ · line 121
Quoted 1 line
drivers/usb/storage/initializers.c +1
-0+ if (us->pusb_dev->descriptor.idProduct >= 0x1501
^ trailing whitespace
drivers/usb/storage/initializers.c int usb_stor_huawei_e220_init(struct us_ · line 123
Quoted 2 lines
drivers/usb/storage/initializers.c +2
-0+ && us->pusb_dev->descriptor.idProduct <= 0x1504) { + ret =0 ;
ret is already initialized to zero, why do it again ?
drivers/usb/storage/initializers.c int usb_stor_huawei_e220_init(struct us_ · line 136
Quoted 13 lines
drivers/usb/storage/initializers.c +13
-0+ }else { + ret =1 ; + } + } + } +return ret; +} + +static int usb_stor_huawei_scsi_init (struct us_data *us) +{ +int result =0 ; +int act_len =0 ; + unsigned char rewind_cmd[] = {0x11, 0x06, 0x20, 0x00, 0x00, 0x01, 0x00, 0x00,
^ trailing whitespace
drivers/usb/storage/initializers.c int usb_stor_huawei_e220_init(struct us_ · line 144
Quoted 8 lines
drivers/usb/storage/initializers.c +8
-0+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; +struct bulk_cb_wrap bcbw = {0 }; + bcbw.Signature =cpu_to_le32 (US_BULK_CB_SIGN ); + bcbw.Tag =0 ; + bcbw.DataTransferLength =cpu_to_le32 (0 ); + bcbw.Flags = bcbw.Lun =0 ; + bcbw.Length =sizeof (rewind_cmd); +memset (bcbw.CDB,0 ,sizeof (bcbw.CDB));
the entire structure is already initialized to zero, no ?
drivers/usb/storage/initializers.c int usb_stor_huawei_e220_init(struct us_ · line 148
Quoted 4 lines
drivers/usb/storage/initializers.c +4
-0+memcpy (bcbw.CDB, rewind_cmd,sizeof (rewind_cmd)); + + result =usb_stor_bulk_transfer_buf (us, us->send_bulk_pipe, &bcbw,31 , &act_len); +US_DEBUGP ("usb_stor_bulk_transfer_buf performing result is %d, transfer the actual length=%d\n" , result, act_len);
waaaaaay over 80-characters. Run checkpatch.pl
drivers/usb/storage/initializers.c int usb_stor_huawei_e220_init(struct us_ · line 160
Quoted 12 lines
drivers/usb/storage/initializers.c +12
-0+return result; +} + +int usb_stor_huawei_init (struct us_data *us) +{ +int result =0 ; +if (usb_stor_huawei_dongles_pid (us)) { +if ((us->pusb_dev->descriptor.idProduct >=0x1446 )) { + result =usb_stor_huawei_scsi_init (us); + }else { + result =usb_stor_huawei_feature_init (us); + }
read Documentation/CodingStyle, you'll see this is wrong.
Quoted 362 lines
drivers/usb/storage/initializers.c +3
-0+ } +return result; +}diff -uprN
linux-3.7_bak/drivers/usb/storage/initializers.hlinux-3.7/drivers/usb/storage/initializers.hdrivers/usb/storage/initializers.h +2
-2@@ -46,5 +46,5 @@ int usb_stor_euscsi_init(struct us_data* flash reader */ int usb_stor_ucr61s2b_init (struct us_data *us); -/* This places the HUAWEI E220 devices in multi-port mode */ -int usb_stor_huawei_e220_init (struct us_data *us); +/* This places the HUAWEI usb dongles in multi-port mode */ +int usb_stor_huawei_init (struct us_data *us);diff -uprN
linux-3.7_bak/drivers/usb/storage/unusual_devs.hlinux-3.7/drivers/usb/storage/unusual_devs.hdrivers/usb/storage/unusual_devs.h +2
-327@@ -1527,335 +1527,10 @@ UNUSUAL_DEV( 0x1210, 0x0003, 0x0100, 0x/* Reported by fangxiaozhi <[email protected]> * This brings the HUAWEI data card devices into multi-port mode */ -UNUSUAL_DEV (0x12d1 ,0x1001 ,0x0000 ,0x0000 , +UNUSUAL_VENDOR_INTF (0x12d1 ,0x08 ,0x06 ,0x50 ,"HUAWEI MOBILE" ,"Mass Storage" , -USB_SC_DEVICE ,USB_PR_DEVICE , usb_stor_huawei_e220_init, -0 ), -UNUSUAL_DEV (0x12d1 ,0x1003 ,0x0000 ,0x0000 , -"HUAWEI MOBILE" , -"Mass Storage" , -USB_SC_DEVICE ,USB_PR_DEVICE , usb_stor_huawei_e220_init, -0 ), -UNUSUAL_DEV (0x12d1 ,0x1004 ,0x0000 ,0x0000 , -"HUAWEI MOBILE" , -"Mass Storage" , -USB_SC_DEVICE ,USB_PR_DEVICE , usb_stor_huawei_e220_init, -0 ), -UNUSUAL_DEV (0x12d1 ,0x1401 ,0x0000 ,0x0000 , -"HUAWEI MOBILE" , -"Mass Storage" , -USB_SC_DEVICE ,USB_PR_DEVICE , usb_stor_huawei_e220_init, -0 ), -UNUSUAL_DEV (0x12d1 ,0x1402 ,0x0000 ,0x0000 , -"HUAWEI MOBILE" , -"Mass Storage" , -USB_SC_DEVICE ,USB_PR_DEVICE , usb_stor_huawei_e220_init, -0 ), -UNUSUAL_DEV (0x12d1 ,0x1403 ,0x0000 ,0x0000 , -"HUAWEI MOBILE" , -"Mass Storage" , -USB_SC_DEVICE ,USB_PR_DEVICE , usb_stor_huawei_e220_init, -0 ), -UNUSUAL_DEV (0x12d1 ,0x1404 ,0x0000 ,0x0000 , -"HUAWEI MOBILE" , -"Mass Storage" , -USB_SC_DEVICE ,USB_PR_DEVICE , usb_stor_huawei_e220_init, -0 ), -UNUSUAL_DEV (0x12d1 ,0x1405 ,0x0000 ,0x0000 , -"HUAWEI MOBILE" , -"Mass Storage" , -USB_SC_DEVICE ,USB_PR_DEVICE , usb_stor_huawei_e220_init, -0 ), -UNUSUAL_DEV (0x12d1 ,0x1406 ,0x0000 ,0x0000 , -"HUAWEI MOBILE" , -"Mass Storage" , -USB_SC_DEVICE ,USB_PR_DEVICE , usb_stor_huawei_e220_init, -0 ), -UNUSUAL_DEV (0x12d1 ,0x1407 ,0x0000 ,0x0000 , -"HUAWEI MOBILE" , -"Mass Storage" , -USB_SC_DEVICE ,USB_PR_DEVICE , usb_stor_huawei_e220_init, -0 ), -UNUSUAL_DEV (0x12d1 ,0x1408 ,0x0000 ,0x0000 , -"HUAWEI MOBILE" , -"Mass Storage" , -USB_SC_DEVICE ,USB_PR_DEVICE , usb_stor_huawei_e220_init, -0 ), -UNUSUAL_DEV (0x12d1 ,0x1409 ,0x0000 ,0x0000 , -"HUAWEI MOBILE" , -"Mass Storage" , -USB_SC_DEVICE ,USB_PR_DEVICE , usb_stor_huawei_e220_init, -0 ), -UNUSUAL_DEV (0x12d1 ,0x140A ,0x0000 ,0x0000 , -"HUAWEI MOBILE" , -"Mass Storage" , -USB_SC_DEVICE ,USB_PR_DEVICE , usb_stor_huawei_e220_init, -0 ), -UNUSUAL_DEV (0x12d1 ,0x140B ,0x0000 ,0x0000 , -"HUAWEI MOBILE" , -"Mass Storage" , -USB_SC_DEVICE ,USB_PR_DEVICE , usb_stor_huawei_e220_init, -0 ), -UNUSUAL_DEV (0x12d1 ,0x140C ,0x0000 ,0x0000 , -"HUAWEI MOBILE" , -"Mass Storage" , -USB_SC_DEVICE ,USB_PR_DEVICE , usb_stor_huawei_e220_init, -0 ), -UNUSUAL_DEV (0x12d1 ,0x140D ,0x0000 ,0x0000 , -"HUAWEI MOBILE" , -"Mass Storage" , -USB_SC_DEVICE ,USB_PR_DEVICE , usb_stor_huawei_e220_init, -0 ), -UNUSUAL_DEV (0x12d1 ,0x140E ,0x0000 ,0x0000 , -"HUAWEI MOBILE" , -"Mass Storage" , -USB_SC_DEVICE ,USB_PR_DEVICE , usb_stor_huawei_e220_init, -0 ), -UNUSUAL_DEV (0x12d1 ,0x140F ,0x0000 ,0x0000 , -"HUAWEI MOBILE" , -"Mass Storage" , -USB_SC_DEVICE ,USB_PR_DEVICE , usb_stor_huawei_e220_init, -0 ), -UNUSUAL_DEV (0x12d1 ,0x1410 ,0x0000 ,0x0000 , -"HUAWEI MOBILE" , -"Mass Storage" , -USB_SC_DEVICE ,USB_PR_DEVICE , usb_stor_huawei_e220_init, -0 ), -UNUSUAL_DEV (0x12d1 ,0x1411 ,0x0000 ,0x0000 , -"HUAWEI MOBILE" , -"Mass Storage" , -USB_SC_DEVICE ,USB_PR_DEVICE , usb_stor_huawei_e220_init, -0 ), -UNUSUAL_DEV (0x12d1 ,0x1412 ,0x0000 ,0x0000 , -"HUAWEI MOBILE" , -"Mass Storage" , -USB_SC_DEVICE ,USB_PR_DEVICE , usb_stor_huawei_e220_init, -0 ), -UNUSUAL_DEV (0x12d1 ,0x1413 ,0x0000 ,0x0000 , -"HUAWEI MOBILE" , -"Mass Storage" , -USB_SC_DEVICE ,USB_PR_DEVICE , usb_stor_huawei_e220_init, -0 ), -UNUSUAL_DEV (0x12d1 ,0x1414 ,0x0000 ,0x0000 , -"HUAWEI MOBILE" , -"Mass Storage" , -USB_SC_DEVICE ,USB_PR_DEVICE , usb_stor_huawei_e220_init, -0 ), -UNUSUAL_DEV (0x12d1 ,0x1415 ,0x0000 ,0x0000 , -"HUAWEI MOBILE" , -"Mass Storage" , -USB_SC_DEVICE ,USB_PR_DEVICE , usb_stor_huawei_e220_init, -0 ), -UNUSUAL_DEV (0x12d1 ,0x1416 ,0x0000 ,0x0000 , -"HUAWEI MOBILE" , -"Mass Storage" , -USB_SC_DEVICE ,USB_PR_DEVICE , usb_stor_huawei_e220_init, -0 ), -UNUSUAL_DEV (0x12d1 ,0x1417 ,0x0000 ,0x0000 , -"HUAWEI MOBILE" , -"Mass Storage" , -USB_SC_DEVICE ,USB_PR_DEVICE , usb_stor_huawei_e220_init, -0 ), -UNUSUAL_DEV (0x12d1 ,0x1418 ,0x0000 ,0x0000 , -"HUAWEI MOBILE" , -"Mass Storage" , -USB_SC_DEVICE ,USB_PR_DEVICE , usb_stor_huawei_e220_init, -0 ), -UNUSUAL_DEV (0x12d1 ,0x1419 ,0x0000 ,0x0000 , -"HUAWEI MOBILE" , -"Mass Storage" , -USB_SC_DEVICE ,USB_PR_DEVICE , usb_stor_huawei_e220_init, -0 ), -UNUSUAL_DEV (0x12d1 ,0x141A ,0x0000 ,0x0000 , -"HUAWEI MOBILE" , -"Mass Storage" , -USB_SC_DEVICE ,USB_PR_DEVICE , usb_stor_huawei_e220_init, -0 ), -UNUSUAL_DEV (0x12d1 ,0x141B ,0x0000 ,0x0000 , -"HUAWEI MOBILE" , -"Mass Storage" , -USB_SC_DEVICE ,USB_PR_DEVICE , usb_stor_huawei_e220_init, -0 ), -UNUSUAL_DEV (0x12d1 ,0x141C ,0x0000 ,0x0000 , -"HUAWEI MOBILE" , -"Mass Storage" , -USB_SC_DEVICE ,USB_PR_DEVICE , usb_stor_huawei_e220_init, -0 ), -UNUSUAL_DEV (0x12d1 ,0x141D ,0x0000 ,0x0000 , -"HUAWEI MOBILE" , -"Mass Storage" , -USB_SC_DEVICE ,USB_PR_DEVICE , usb_stor_huawei_e220_init, -0 ), -UNUSUAL_DEV (0x12d1 ,0x141E ,0x0000 ,0x0000 , -"HUAWEI MOBILE" , -"Mass Storage" , -USB_SC_DEVICE ,USB_PR_DEVICE , usb_stor_huawei_e220_init, -0 ), -UNUSUAL_DEV (0x12d1 ,0x141F ,0x0000 ,0x0000 , -"HUAWEI MOBILE" , -"Mass Storage" , -USB_SC_DEVICE ,USB_PR_DEVICE , usb_stor_huawei_e220_init, -0 ), -UNUSUAL_DEV (0x12d1 ,0x1420 ,0x0000 ,0x0000 , -"HUAWEI MOBILE" , -"Mass Storage" , -USB_SC_DEVICE ,USB_PR_DEVICE , usb_stor_huawei_e220_init, -0 ), -UNUSUAL_DEV (0x12d1 ,0x1421 ,0x0000 ,0x0000 , -"HUAWEI MOBILE" , -"Mass Storage" , -USB_SC_DEVICE ,USB_PR_DEVICE , usb_stor_huawei_e220_init, -0 ), -UNUSUAL_DEV (0x12d1 ,0x1422 ,0x0000 ,0x0000 , -"HUAWEI MOBILE" , -"Mass Storage" , -USB_SC_DEVICE ,USB_PR_DEVICE , usb_stor_huawei_e220_init, -0 ), -UNUSUAL_DEV (0x12d1 ,0x1423 ,0x0000 ,0x0000 , -"HUAWEI MOBILE" , -"Mass Storage" , -USB_SC_DEVICE ,USB_PR_DEVICE , usb_stor_huawei_e220_init, -0 ), -UNUSUAL_DEV (0x12d1 ,0x1424 ,0x0000 ,0x0000 , -"HUAWEI MOBILE" , -"Mass Storage" , -USB_SC_DEVICE ,USB_PR_DEVICE , usb_stor_huawei_e220_init, -0 ), -UNUSUAL_DEV (0x12d1 ,0x1425 ,0x0000 ,0x0000 , -"HUAWEI MOBILE" , -"Mass Storage" , -USB_SC_DEVICE ,USB_PR_DEVICE , usb_stor_huawei_e220_init, -0 ), -UNUSUAL_DEV (0x12d1 ,0x1426 ,0x0000 ,0x0000 , -"HUAWEI MOBILE" , -"Mass Storage" , -USB_SC_DEVICE ,USB_PR_DEVICE , usb_stor_huawei_e220_init, -0 ), -UNUSUAL_DEV (0x12d1 ,0x1427 ,0x0000 ,0x0000 , -"HUAWEI MOBILE" , -"Mass Storage" , -USB_SC_DEVICE ,USB_PR_DEVICE , usb_stor_huawei_e220_init, -0 ), -UNUSUAL_DEV (0x12d1 ,0x1428 ,0x0000 ,0x0000 , -"HUAWEI MOBILE" , -"Mass Storage" , -USB_SC_DEVICE ,USB_PR_DEVICE , usb_stor_huawei_e220_init, -0 ), -UNUSUAL_DEV (0x12d1 ,0x1429 ,0x0000 ,0x0000 , -"HUAWEI MOBILE" , -"Mass Storage" , -USB_SC_DEVICE ,USB_PR_DEVICE , usb_stor_huawei_e220_init, -0 ), -UNUSUAL_DEV (0x12d1 ,0x142A ,0x0000 ,0x0000 , -"HUAWEI MOBILE" , -"Mass Storage" , -USB_SC_DEVICE ,USB_PR_DEVICE , usb_stor_huawei_e220_init, -0 ), -UNUSUAL_DEV (0x12d1 ,0x142B ,0x0000 ,0x0000 , -"HUAWEI MOBILE" , -"Mass Storage" , -USB_SC_DEVICE ,USB_PR_DEVICE , usb_stor_huawei_e220_init, -0 ), -UNUSUAL_DEV (0x12d1 ,0x142C ,0x0000 ,0x0000 , -"HUAWEI MOBILE" , -"Mass Storage" , -USB_SC_DEVICE ,USB_PR_DEVICE , usb_stor_huawei_e220_init, -0 ), -UNUSUAL_DEV (0x12d1 ,0x142D ,0x0000 ,0x0000 , -"HUAWEI MOBILE" , -"Mass Storage" , -USB_SC_DEVICE ,USB_PR_DEVICE , usb_stor_huawei_e220_init, -0 ), -UNUSUAL_DEV (0x12d1 ,0x142E ,0x0000 ,0x0000 , -"HUAWEI MOBILE" , -"Mass Storage" , -USB_SC_DEVICE ,USB_PR_DEVICE , usb_stor_huawei_e220_init, -0 ), -UNUSUAL_DEV (0x12d1 ,0x142F ,0x0000 ,0x0000 , -"HUAWEI MOBILE" , -"Mass Storage" , -USB_SC_DEVICE ,USB_PR_DEVICE , usb_stor_huawei_e220_init, -0 ), -UNUSUAL_DEV (0x12d1 ,0x1430 ,0x0000 ,0x0000 , -"HUAWEI MOBILE" , -"Mass Storage" , -USB_SC_DEVICE ,USB_PR_DEVICE , usb_stor_huawei_e220_init, -0 ), -UNUSUAL_DEV (0x12d1 ,0x1431 ,0x0000 ,0x0000 , -"HUAWEI MOBILE" , -"Mass Storage" , -USB_SC_DEVICE ,USB_PR_DEVICE , usb_stor_huawei_e220_init, -0 ), -UNUSUAL_DEV (0x12d1 ,0x1432 ,0x0000 ,0x0000 , -"HUAWEI MOBILE" , -"Mass Storage" , -USB_SC_DEVICE ,USB_PR_DEVICE , usb_stor_huawei_e220_init, -0 ), -UNUSUAL_DEV (0x12d1 ,0x1433 ,0x0000 ,0x0000 , -"HUAWEI MOBILE" , -"Mass Storage" , -USB_SC_DEVICE ,USB_PR_DEVICE , usb_stor_huawei_e220_init, -0 ), -UNUSUAL_DEV (0x12d1 ,0x1434 ,0x0000 ,0x0000 , -"HUAWEI MOBILE" , -"Mass Storage" , -USB_SC_DEVICE ,USB_PR_DEVICE , usb_stor_huawei_e220_init, -0 ), -UNUSUAL_DEV (0x12d1 ,0x1435 ,0x0000 ,0x0000 , -"HUAWEI MOBILE" , -"Mass Storage" , -USB_SC_DEVICE ,USB_PR_DEVICE , usb_stor_huawei_e220_init, -0 ), -UNUSUAL_DEV (0x12d1 ,0x1436 ,0x0000 ,0x0000 , -"HUAWEI MOBILE" , -"Mass Storage" , -USB_SC_DEVICE ,USB_PR_DEVICE , usb_stor_huawei_e220_init, -0 ), -UNUSUAL_DEV (0x12d1 ,0x1437 ,0x0000 ,0x0000 , -"HUAWEI MOBILE" , -"Mass Storage" , -USB_SC_DEVICE ,USB_PR_DEVICE , usb_stor_huawei_e220_init, -0 ), -UNUSUAL_DEV (0x12d1 ,0x1438 ,0x0000 ,0x0000 , -"HUAWEI MOBILE" , -"Mass Storage" , -USB_SC_DEVICE ,USB_PR_DEVICE , usb_stor_huawei_e220_init, -0 ), -UNUSUAL_DEV (0x12d1 ,0x1439 ,0x0000 ,0x0000 , -"HUAWEI MOBILE" , -"Mass Storage" , -USB_SC_DEVICE ,USB_PR_DEVICE , usb_stor_huawei_e220_init, -0 ), -UNUSUAL_DEV (0x12d1 ,0x143A ,0x0000 ,0x0000 , -"HUAWEI MOBILE" , -"Mass Storage" , -USB_SC_DEVICE ,USB_PR_DEVICE , usb_stor_huawei_e220_init, -0 ), -UNUSUAL_DEV (0x12d1 ,0x143B ,0x0000 ,0x0000 , -"HUAWEI MOBILE" , -"Mass Storage" , -USB_SC_DEVICE ,USB_PR_DEVICE , usb_stor_huawei_e220_init, -0 ), -UNUSUAL_DEV (0x12d1 ,0x143C ,0x0000 ,0x0000 , -"HUAWEI MOBILE" , -"Mass Storage" , -USB_SC_DEVICE ,USB_PR_DEVICE , usb_stor_huawei_e220_init, -0 ), -UNUSUAL_DEV (0x12d1 ,0x143D ,0x0000 ,0x0000 , -"HUAWEI MOBILE" , -"Mass Storage" , -USB_SC_DEVICE ,USB_PR_DEVICE , usb_stor_huawei_e220_init, -0 ), -UNUSUAL_DEV (0x12d1 ,0x143E ,0x0000 ,0x0000 , -"HUAWEI MOBILE" , -"Mass Storage" , -USB_SC_DEVICE ,USB_PR_DEVICE , usb_stor_huawei_e220_init, -0 ), -UNUSUAL_DEV (0x12d1 ,0x143F ,0x0000 ,0x0000 , -"HUAWEI MOBILE" , -"Mass Storage" , -USB_SC_DEVICE ,USB_PR_DEVICE , usb_stor_huawei_e220_init, +USB_SC_DEVICE ,USB_PR_DEVICE , usb_stor_huawei_init, 0),/* Reported by Vilius Bilinkevicius <vilisas AT xxx DOT lt) */ diff -uprN
linux-3.7_bak/drivers/usb/storage/usb.clinux-3.7/drivers/usb/storage/usb.cdrivers/usb/storage/usb.c +0
-0@@ -120,6 +120,17 @@ MODULE_PARM_DESC(quirks, "supplemental l .useTransport = use_transport, \ }
drivers/usb/storage/usb.c MODULE_PARM_DESC(quirks, "supplemental l · line 132
Quoted 10 lines
drivers/usb/storage/usb.c +10
-0+#define UNUSUAL_VENDOR_INTF (idVendor, cl, sc, pr, \ + vendor_name, product_name, use_protocol, use_transport, \ + init_function, Flags) \ +{ \ + .vendorName = vendor_name, \ + .productName = product_name, \ + .useProtocol = use_protocol, \ + .useTransport = use_transport, \ + .initFunction = init_function, \ +}
not part of $SUBJECT, should be a separate patch.
Quoted 16 lines
drivers/usb/storage/usb.c +2
-0+static struct us_unusual_dev us_unusual_dev_list[] = { # include "unusual_devs.h" { }/* Terminating entry */ @@ -131,6 +142,7 @@ static struct us_unusual_dev for_dynamic#undef UNUSUAL_DEV#undef COMPLIANT_DEV#undef USUAL_DEV +#undef UNUSUAL_VENDOR_INTF#ifdef CONFIG_LOCKDEP diff -uprN
linux-3.7_bak/drivers/usb/storage/usual-tables.clinux-3.7/drivers/usb/storage/usual-tables.c
drivers/usb/storage/usual-tables.c line 44
Quoted 4 lines
drivers/usb/storage/usual-tables.c +1
-0@@ -41,6 +41,18 @@#define USUAL_DEV (useProto, useTrans) \ { USB_INTERFACE_INFO(USB_CLASS_MASS_STORAGE, useProto, useTrans) } +/*Define the device is matched with Vendor ID and interface descriptors*/
missing spaces.
drivers/usb/storage/usual-tables.c line 54
Quoted 10 lines
drivers/usb/storage/usual-tables.c +10
-0+#define UNUSUAL_VENDOR_INTF (id_vendor, cl, sc, pr, \ + vendorName, productName,useProtocol, useTransport, \ + initFunction, flags) \ +{ \ + .match_flags = USB_DEVICE_ID_MATCH_INT_INFO | USB_DEVICE_ID_MATCH_VENDOR, \ + .idVendor = (id_vendor), \ + .bInterfaceClass = (cl), \ + .bInterfaceSubClass = (sc), \ + .bInterfaceProtocol = (pr), \ + .driver_info = (flags)}
this should be properly indented with tabs.
Quoted 15 lines
drivers/usb/storage/usual-tables.c +2
-0+struct usb_device_id usb_storage_usb_ids[] = { # include "unusual_devs.h" { }/* Terminating entry */ @@ -50,6 +62,7 @@ MODULE_DEVICE_TABLE(usb, usb_storage_usb#undef UNUSUAL_DEV#undef COMPLIANT_DEV#undef USUAL_DEV +#undef UNUSUAL_VENDOR_INTF/* * The table of devices to ignore
Quoted 4 lines
******************************************************************************************
This email and its attachments contain confidential information from HUAWEI, which is intended only for the person or entity whose address is listed above. Any use of the information contained here in any way (including, but not limited to, total or partial disclosure, reproduction, or dissemination) by persons other than the intended recipient(s) is prohibited. If you receive this email in error, please notify the sender by phone or email immediately and delete it!
*****************************************************************************************
this footer should be removed from your mail when you send mails to public mailing lists.
Signature · 1 line
balbi
Quoted 4 lines · On Wed, 12 Dec 2012 18:20:33 +0800 fangxiaozhi 00110321…
From: fangxiaozhi <[email protected]>
1. To optimize the match rules for the Huawei USB storage devices. Avoid to load USB storage driver for modem interface with Huawei devices.
2. Add to support new switch command for new Huawei USB dongles.
This prevents people getting access to the storage device if they want. It also means you need to change kernel not simply a user space file to add support for different new identifiers.
So it seems a large step backwards to me.
Why not just teach udev the new switch command then it'll work as a udev update on all sorts of existing kernels as well as being the kind of small safe change you can get into the entprise distributions ?
Alan
A message that is not in the archive (sent off-list or not yet received): 910F9D9E13B84F4C8FA771DC9BDE99F326FBFB54@szxeml546-mbs.china.huawei.com
Quoted 4 lines · On Fri, 14 Dec 2012 03:01:24 +0000 "Fangxiaozhi (Franko)"…
Dear Alan:
This prevents people getting access to the storage device if they want.
----In our device, after its switching, it will keep the cdrom port together with other ports (such as modem port). So you can access the storage device too, after our switch.
Ok so the behaviour is
plug in device
"I am a CD-ROM"
command sent
"I am a CD-ROM, I am a modem, I am other things"
with the newer devices ?
Alan
Quoted 8 lines · On Friday 14 December 2012 09:31:41 Alan Cox wrote:
Quoted 4 lines · On Fri, 14 Dec 2012 03:01:24 +0000 "Fangxiaozhi (Franko)"…
Dear Alan:
This prevents people getting access to the storage device if they want.
----In our device, after its switching, it will keep the cdrom port together with other ports (such as modem port). So you can access the storage device too, after our switch.
Quoted 8 lines
Ok so the behaviour is
plug in device
"I am a CD-ROM"
command sent
"I am a CD-ROM, I am a modem, I am other things"with the newer devices ?
For such devices we should put the switching code into generic code, not a device driver so that we have a chance to do reset_resume() on those devices.
Regards
Oliver
Dear Oliver:
Quoted 28 lines
-----Original Message-----
From: Oliver Neukum [mailto:[email protected]]
Sent: Friday, December 14, 2012 5:34 PM
To: Alan Cox
Cc: Fangxiaozhi (Franko); [email protected]; [email protected]; Xueguiying (Zihan); Linlei (Lei Lin); [email protected]; Yili (Neil); Wangyuhua (Roger, Credit); Huqiao
Subject: Re: [PATCH 1/1]linux-usb: optimize to match the Huawei USB storage devices and support new switch commandQuoted 7 lines · On Friday 14 December 2012 09:31:41 Alan Cox wrote:
Quoted 4 lines · On Fri, 14 Dec 2012 03:01:24 +0000 "Fangxiaozhi (Franko)"…
Dear Alan:
This prevents people getting access to the storage device if they want. ----In our device, after its switching, it will keep the cdrom port
together with other ports (such as modem port). So you can access the storage device too, after our switch.
Quoted 8 lines
Ok so the behaviour is
plug in device
"I am a CD-ROM"
command sent
"I am a CD-ROM, I am a modem, I am other things"
Quoted 5 lines
Quoted 1 line
with the newer devices ?
For such devices we should put the switching code into generic code, not a device driver so that we have a chance to do
reset_resume()on those devices.
--------------Because in many embedded linux system, they don't include such switch tools themselves.
So I think it is better to put the switching code in device driver.
--------------By the way, because our device will response the switching command for once,
so I think you can do reset_resume() as you want.
Quoted 2 lines
Regards
Oliver
Best Regards,
Franko Fang
���{.n�+�������+%�����ݶ��w��{.n�+����{��G�����{ay�ʇڙ�,j��f���h��������z_�(�階�ݢj"���m������G������?����&���~��iO��z��v�^�m����������?�I�
On Friday 14 December 2012 10:28:31 Fangxiaozhi wrote:
Hi,
Quoted 5 lines
Quoted 3 lines
For such devices we should put the switching code into generic code, not a device driver so that we have a chance to do
reset_resume()on those devices.--------------Because in many embedded linux system, they don't include such switch tools themselves.
So I think it is better to put the switching code in device driver.
Well, that argues for doing it in the kernel. Where you do it in the kernel shouldn't matter.
Quoted 2 lines
--------------By the way, because our device will response the switching command for once,
so I think you can doreset_resume()as you want.
What happens if S3 cuts power to the device?
Regards
Oliver
Quoted 24 lines
-----邮件原件-----
发件人: Alan Cox [mailto:[email protected]]
发送时间: 2012年12月14日 17:32
收件人: Fangxiaozhi (Franko)
抄送: [email protected]; [email protected]; Xueguiying (Zihan); Linlei (Lei Lin); [email protected]; Yili (Neil); Wangyuhua (Roger, Credit); Huqiao
主题: Re: [PATCH 1/1]linux-usb: optimize to match the Huawei USB storage devices and support new switch commandQuoted 4 lines · On Fri, 14 Dec 2012 03:01:24 +0000 "Fangxiaozhi (Franko)"…
Dear Alan:
This prevents people getting access to the storage device if they want. ----In our device, after its switching, it will keep the cdrom port
together with other ports (such as modem port). So you can access the storage device too, after our switch.
Ok so the behaviour is
Quoted 8 lines
plug in device
"I am a CD-ROM"
command sent
"I am a CD-ROM, I am a modem, I am other things"with the newer devices ?
Alan
------------Yes, you are right. ���{.n�+�������+%�����ݶ��w��{.n�+����{��G�����{ay�ʇڙ�,j��f���h��������z_�(�階�ݢj"���m������G������?����&���~��iO��z��v�^�m����������?�I�