public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/1]linux-usb: optimize to match the Huawei USB storage devices and support new switch command
@ 2012-12-12 10:20 fangxiaozhi 00110321
  2012-12-12 10:28 ` Felipe Balbi
  2012-12-12 10:51 ` Alan Cox
  0 siblings, 2 replies; 11+ messages in thread
From: fangxiaozhi 00110321 @ 2012-12-12 10:20 UTC (permalink / raw)
  To: linux-usb
  Cc: linux-kernel, zihan, Lin.Lei, greg, neil.yi, wangyuhua, huqiao36

From: fangxiaozhi <huananhu@huawei.com>

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.

Signed-off-by: fangxiaozhi <huananhu@huawei.com>
-------------------------------------------------------------------------------------------------
diff -uprN linux-3.7_bak/drivers/usb/storage/initializers.c linux-3.7/drivers/usb/storage/initializers.c
--- linux-3.7_bak/drivers/usb/storage/initializers.c	2012-12-11 09:56:11.000000000 +0800
+++ linux-3.7/drivers/usb/storage/initializers.c	2012-12-12 16:26:53.000000000 +0800
@@ -92,8 +92,8 @@ int usb_stor_ucr61s2b_init(struct us_dat
 	return 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;
+}
diff -uprN linux-3.7_bak/drivers/usb/storage/initializers.h linux-3.7/drivers/usb/storage/initializers.h
--- linux-3.7_bak/drivers/usb/storage/initializers.h	2012-12-11 09:56:11.000000000 +0800
+++ linux-3.7/drivers/usb/storage/initializers.h	2012-12-12 11:43:58.000000000 +0800
@@ -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.h linux-3.7/drivers/usb/storage/unusual_devs.h
--- linux-3.7_bak/drivers/usb/storage/unusual_devs.h	2012-12-11 09:56:11.000000000 +0800
+++ linux-3.7/drivers/usb/storage/unusual_devs.h	2012-12-12 11:47:34.000000000 +0800
@@ -1527,335 +1527,10 @@ UNUSUAL_DEV(  0x1210, 0x0003, 0x0100, 0x
 /* Reported by fangxiaozhi <huananhu@huawei.com>
  * 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.c linux-3.7/drivers/usb/storage/usb.c
--- linux-3.7_bak/drivers/usb/storage/usb.c	2012-12-11 09:56:11.000000000 +0800
+++ linux-3.7/drivers/usb/storage/usb.c	2012-12-12 11:46:06.000000000 +0800
@@ -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
 
diff -uprN linux-3.7_bak/drivers/usb/storage/usual-tables.c linux-3.7/drivers/usb/storage/usual-tables.c
--- linux-3.7_bak/drivers/usb/storage/usual-tables.c	2012-12-11 09:56:11.000000000 +0800
+++ linux-3.7/drivers/usb/storage/usual-tables.c	2012-12-12 11:47:18.000000000 +0800
@@ -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!
 *****************************************************************************************

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 1/1]linux-usb: optimize to match the Huawei USB storage devices and support new switch command
  2012-12-12 10:20 [PATCH 1/1]linux-usb: optimize " fangxiaozhi 00110321
@ 2012-12-12 10:28 ` Felipe Balbi
  2012-12-12 10:51 ` Alan Cox
  1 sibling, 0 replies; 11+ messages in thread
From: Felipe Balbi @ 2012-12-12 10:28 UTC (permalink / raw)
  To: fangxiaozhi 00110321
  Cc: linux-usb, linux-kernel, zihan, Lin.Lei, greg, neil.yi, wangyuhua,
	huqiao36

[-- Attachment #1: Type: text/plain, Size: 19913 bytes --]

Hi,

ok, let's start.

On Wed, Dec 12, 2012 at 06:20:33PM +0800, fangxiaozhi 00110321 wrote:
> From: fangxiaozhi <huananhu@huawei.com>
> 
> 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.

> Signed-off-by: fangxiaozhi <huananhu@huawei.com>
> -------------------------------------------------------------------------------------------------
> diff -uprN linux-3.7_bak/drivers/usb/storage/initializers.c linux-3.7/drivers/usb/storage/initializers.c
> --- linux-3.7_bak/drivers/usb/storage/initializers.c	2012-12-11 09:56:11.000000000 +0800
> +++ linux-3.7/drivers/usb/storage/initializers.c	2012-12-12 16:26:53.000000000 +0800
> @@ -92,8 +92,8 @@ int usb_stor_ucr61s2b_init(struct us_dat
>  	return 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

>  {
>  	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 */

> +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

> +	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.

> +				if (us->pusb_dev->descriptor.idProduct >= 0x1501 
                                                                                ^
										trailing
										whitespace

> +					&& us->pusb_dev->descriptor.idProduct <= 0x1504) {
> +					ret = 0;

ret is already initialized to zero, why do it again ?

> +				} 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

> +				      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 ?

> +	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

> +	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.

> +	}
> +	return result;
> +}
> diff -uprN linux-3.7_bak/drivers/usb/storage/initializers.h linux-3.7/drivers/usb/storage/initializers.h
> --- linux-3.7_bak/drivers/usb/storage/initializers.h	2012-12-11 09:56:11.000000000 +0800
> +++ linux-3.7/drivers/usb/storage/initializers.h	2012-12-12 11:43:58.000000000 +0800
> @@ -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.h linux-3.7/drivers/usb/storage/unusual_devs.h
> --- linux-3.7_bak/drivers/usb/storage/unusual_devs.h	2012-12-11 09:56:11.000000000 +0800
> +++ linux-3.7/drivers/usb/storage/unusual_devs.h	2012-12-12 11:47:34.000000000 +0800
> @@ -1527,335 +1527,10 @@ UNUSUAL_DEV(  0x1210, 0x0003, 0x0100, 0x
>  /* Reported by fangxiaozhi <huananhu@huawei.com>
>   * 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.c linux-3.7/drivers/usb/storage/usb.c
> --- linux-3.7_bak/drivers/usb/storage/usb.c	2012-12-11 09:56:11.000000000 +0800
> +++ linux-3.7/drivers/usb/storage/usb.c	2012-12-12 11:46:06.000000000 +0800
> @@ -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,	\
> +}

not part of $SUBJECT, should be a separate patch.

> +
>  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.c linux-3.7/drivers/usb/storage/usual-tables.c
> --- linux-3.7_bak/drivers/usb/storage/usual-tables.c	2012-12-11 09:56:11.000000000 +0800
> +++ linux-3.7/drivers/usb/storage/usual-tables.c	2012-12-12 11:47:18.000000000 +0800
> @@ -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.

> +#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.

> +
>  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!
>  *****************************************************************************************

this footer should be removed from your mail when you send mails to
public mailing lists.

-- 
balbi

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 1/1]linux-usb: optimize to match the Huawei USB storage devices and support new switch command
  2012-12-12 10:20 [PATCH 1/1]linux-usb: optimize " fangxiaozhi 00110321
  2012-12-12 10:28 ` Felipe Balbi
@ 2012-12-12 10:51 ` Alan Cox
       [not found]   ` <910F9D9E13B84F4C8FA771DC9BDE99F326FBFB54@szxeml546-mbs.china.huawei.com>
  1 sibling, 1 reply; 11+ messages in thread
From: Alan Cox @ 2012-12-12 10:51 UTC (permalink / raw)
  To: fangxiaozhi 00110321
  Cc: linux-usb, linux-kernel, zihan, Lin.Lei, greg, neil.yi, wangyuhua,
	huqiao36

On Wed, 12 Dec 2012 18:20:33 +0800
fangxiaozhi 00110321 <fangxiaozhi@huawei.com> wrote:

> From: fangxiaozhi <huananhu@huawei.com>
> 
> 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

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 1/1]linux-usb: optimize to match the Huawei USB storage devices and support new switch command
       [not found]   ` <910F9D9E13B84F4C8FA771DC9BDE99F326FBFB54@szxeml546-mbs.china.huawei.com>
@ 2012-12-14  9:31     ` Alan Cox
  2012-12-14  9:33       ` Oliver Neukum
  0 siblings, 1 reply; 11+ messages in thread
From: Alan Cox @ 2012-12-14  9:31 UTC (permalink / raw)
  To: Fangxiaozhi (Franko)
  Cc: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org,
	Xueguiying (Zihan), Linlei (Lei Lin), greg@kroah.com, Yili (Neil),
	Wangyuhua (Roger, Credit), Huqiao

On Fri, 14 Dec 2012 03:01:24 +0000
"Fangxiaozhi (Franko)" <fangxiaozhi@huawei.com> wrote:

> 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

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 1/1]linux-usb: optimize to match the Huawei USB storage devices and support new switch command
  2012-12-14  9:31     ` Alan Cox
@ 2012-12-14  9:33       ` Oliver Neukum
  2012-12-14 10:28         ` Fangxiaozhi (Franko)
  0 siblings, 1 reply; 11+ messages in thread
From: Oliver Neukum @ 2012-12-14  9:33 UTC (permalink / raw)
  To: Alan Cox
  Cc: Fangxiaozhi (Franko), linux-usb@vger.kernel.org,
	linux-kernel@vger.kernel.org, Xueguiying (Zihan),
	Linlei (Lei Lin), greg@kroah.com, Yili (Neil),
	Wangyuhua (Roger, Credit), Huqiao

On Friday 14 December 2012 09:31:41 Alan Cox wrote:
> On Fri, 14 Dec 2012 03:01:24 +0000
> "Fangxiaozhi (Franko)" <fangxiaozhi@huawei.com> wrote:
> 
> > 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 ?

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


^ permalink raw reply	[flat|nested] 11+ messages in thread

* RE: [PATCH 1/1]linux-usb: optimize to match the Huawei USB storage devices and support new switch command
  2012-12-14  9:33       ` Oliver Neukum
@ 2012-12-14 10:28         ` Fangxiaozhi (Franko)
  2012-12-14 10:42           ` Oliver Neukum
  0 siblings, 1 reply; 11+ messages in thread
From: Fangxiaozhi (Franko) @ 2012-12-14 10:28 UTC (permalink / raw)
  To: Oliver Neukum, Alan Cox
  Cc: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org,
	Xueguiying (Zihan), Linlei (Lei Lin), greg@kroah.com, Yili (Neil),
	Wangyuhua (Roger, Credit), Huqiao

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="utf-8", Size: 1777 bytes --]

Dear Oliver:

> -----Original Message-----
> From: Oliver Neukum [mailto:oneukum@suse.de]
> Sent: Friday, December 14, 2012 5:34 PM
> To: Alan Cox
> Cc: Fangxiaozhi (Franko); linux-usb@vger.kernel.org;
> linux-kernel@vger.kernel.org; Xueguiying (Zihan); Linlei (Lei Lin);
> greg@kroah.com; 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 command
> 
> On Friday 14 December 2012 09:31:41 Alan Cox wrote:
> > On Fri, 14 Dec 2012 03:01:24 +0000
> > "Fangxiaozhi (Franko)" <fangxiaozhi@huawei.com> wrote:
> >
> > > 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 ?
> 
> 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.

> 	Regards
> 		Oliver

Best Regards,
Franko Fang

ÿôèº{.nÇ+‰·Ÿ®‰­†+%ŠËÿ±éݶ\x17¥Šwÿº{.nÇ+‰·¥Š{±þG«éÿŠ{ayº\x1dʇڙë,j\a­¢f£¢·hšïêÿ‘êçz_è®\x03(­éšŽŠÝ¢j"ú\x1a¶^[m§ÿÿ¾\a«þG«éÿ¢¸?™¨è­Ú&£ø§~á¶iO•æ¬z·švØ^\x14\x04\x1a¶^[m§ÿÿÃ\fÿ¶ìÿ¢¸?–I¥

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 1/1]linux-usb: optimize to match the Huawei USB storage devices and support new switch command
  2012-12-14 10:28         ` Fangxiaozhi (Franko)
@ 2012-12-14 10:42           ` Oliver Neukum
  0 siblings, 0 replies; 11+ messages in thread
From: Oliver Neukum @ 2012-12-14 10:42 UTC (permalink / raw)
  To: Fangxiaozhi (Franko)
  Cc: Alan Cox, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org,
	Xueguiying (Zihan), Linlei (Lei Lin), greg@kroah.com, Yili (Neil),
	Wangyuhua (Roger, Credit), Huqiao

On Friday 14 December 2012 10:28:31 Fangxiaozhi wrote:

Hi,

> > 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.

> --------------By the way, because our device will response the switching command for once, 
> 			so I think you can do reset_resume() as you want.

What happens if S3 cuts power to the device?

	Regards
		Oliver


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH 1/1]linux-usb:optimize to match the Huawei USB storage devices and support new switch command
@ 2013-01-05  2:57 fangxiaozhi 00110321
  2013-01-08 10:57 ` Sebastian Andrzej Siewior
  0 siblings, 1 reply; 11+ messages in thread
From: fangxiaozhi 00110321 @ 2013-01-05  2:57 UTC (permalink / raw)
  To: linux-usb
  Cc: linux-kernel, zihan, Lin.Lei, greg, neil.yi, wangyuhua, huqiao36,
	balbi, mdharm-usb, sebastian

From: fangxiaozhi <huananhu@huawei.com>

1. Optimize the match rules with new macro for Huawei USB storage devices, 
   to avoid to load USB storage driver for the modem interface 
   with Huawei devices.
2. Add to support new switch command for new Huawei USB dongles.

Signed-off-by: fangxiaozhi <huananhu@huawei.com>
--------------------------------------------------------------------
diff -uprN linux-3.8-rc2_orig/drivers/usb/storage/initializers.c linux-3.8-rc2/drivers/usb/storage/initializers.c
--- linux-3.8-rc2_orig/drivers/usb/storage/initializers.c	2013-01-04 10:12:01.441356344 +0800
+++ linux-3.8-rc2/drivers/usb/storage/initializers.c	2013-01-04 10:55:49.512500933 +0800
@@ -92,8 +92,8 @@ int usb_stor_ucr61s2b_init(struct us_dat
 	return 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,75 @@ int usb_stor_huawei_e220_init(struct us_
 	US_DEBUGP("Huawei mode set result is %d\n", result);
 	return 0;
 }
+
+/* This function will send
+ * a scsi switch command called rewind' to huawei dongle.
+ * When the dongle receives this command at the first time,
+ * it will reboot immediately,
+ * after rebooted, it will ignore this command and do nothing,
+ * if it receives this command again.
+ * So it is  unnecessary to read its response. */
+static int usb_stor_huawei_scsi_init(struct us_data *us)
+{
+	int result = 0;
+	int act_len = 0;
+	struct bulk_cb_wrap *bcbw = (struct bulk_cb_wrap *) us->iobuf;
+	char rewind_cmd[] = {0x11, 0x06, 0x20, 0x00, 0x00, 0x01, 0x01, 0x00,
+			0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
+	
+	memset(bcbw, 0, sizeof(struct bulk_cb_wrap));
+	bcbw->Signature = cpu_to_le32(US_BULK_CB_SIGN);
+	bcbw->Tag = 0;
+	bcbw->DataTransferLength = 0;
+	bcbw->Flags = bcbw->Lun = 0;
+	bcbw->Length = sizeof(rewind_cmd);
+	memcpy(bcbw->CDB, rewind_cmd, sizeof(rewind_cmd));
+
+	result = usb_stor_bulk_transfer_buf(us, us->send_bulk_pipe, bcbw,
+					US_BULK_CB_WRAP_LEN, &act_len);
+	US_DEBUGP("transfer actual length=%d, result=%d\n", act_len, result);
+	return result;
+}
+
+/* usb_stor_huawei_dongles_pid: try to find the supported Huawei USB dongles
+ * In Huawei, they assign the following product IDs
+ * for all of their mobile broadband dongles,
+ * including the new dongles in the future.
+ * So if the product ID is not included in this list,
+ * it means it is not Huawei's mobile broadband dongles.
+ */
+static int usb_stor_huawei_dongles_pid(struct us_data *us)
+{
+	struct usb_interface_descriptor *idesc;
+	int idProduct;
+	
+	idesc = &us->pusb_intf->cur_altsetting->desc;
+	idProduct = us->pusb_dev->descriptor.idProduct;
+	/* The first port is CDROM,
+	 * means the dongle in the single port mode,
+	 * and a switch command is required to be sent. */
+	if (idesc && idesc->bInterfaceNumber == 0) {
+		if ((idProduct == 0x1001)
+			|| (idProduct == 0x1003)
+			|| (idProduct == 0x1004)
+			|| (idProduct >= 0x1401 && idProduct < 0x1501)
+			|| (idProduct > 0x1504 && idProduct <= 0x1600)
+			|| (idProduct >= 0x1c02 && idProduct <= 0x2202)) {
+			return 1;
+		}
+	}
+	return 0;
+}
+
+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;
+}
diff -uprN linux-3.8-rc2_orig/drivers/usb/storage/initializers.h linux-3.8-rc2/drivers/usb/storage/initializers.h
--- linux-3.8-rc2_orig/drivers/usb/storage/initializers.h	2013-01-04 10:12:01.445356294 +0800
+++ linux-3.8-rc2/drivers/usb/storage/initializers.h	2013-01-04 10:35:03.427079144 +0800
@@ -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);
Binary files linux-3.8-rc2_orig/drivers/usb/storage/initializers.o and linux-3.8-rc2/drivers/usb/storage/initializers.o differ
diff -uprN linux-3.8-rc2_orig/drivers/usb/storage/unusual_devs.h linux-3.8-rc2/drivers/usb/storage/unusual_devs.h
--- linux-3.8-rc2_orig/drivers/usb/storage/unusual_devs.h	2013-01-04 10:12:01.445356294 +0800
+++ linux-3.8-rc2/drivers/usb/storage/unusual_devs.h	2013-01-04 10:35:17.120907948 +0800
@@ -1527,335 +1527,10 @@ UNUSUAL_DEV(  0x1210, 0x0003, 0x0100, 0x
 /* Reported by fangxiaozhi <huananhu@huawei.com>
  * 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) */


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 1/1]linux-usb:optimize to match the Huawei USB storage devices and support new switch command
  2013-01-05  2:57 [PATCH 1/1]linux-usb:optimize to match the Huawei USB storage devices and support new switch command fangxiaozhi 00110321
@ 2013-01-08 10:57 ` Sebastian Andrzej Siewior
  2013-01-08 11:58   ` Oliver Neukum
  0 siblings, 1 reply; 11+ messages in thread
From: Sebastian Andrzej Siewior @ 2013-01-08 10:57 UTC (permalink / raw)
  To: fangxiaozhi 00110321
  Cc: linux-usb, linux-kernel, zihan, Lin.Lei, greg, neil.yi, wangyuhua,
	huqiao36, balbi, mdharm-usb

On Sat, Jan 05, 2013 at 10:57:42AM +0800, fangxiaozhi 00110321 wrote:
> From: fangxiaozhi <huananhu@huawei.com>
> 
> 1. Optimize the match rules with new macro for Huawei USB storage devices, 
>    to avoid to load USB storage driver for the modem interface 
>    with Huawei devices.
> 2. Add to support new switch command for new Huawei USB dongles.
> 
> Signed-off-by: fangxiaozhi <huananhu@huawei.com>
> --------------------------------------------------------------------
> diff -uprN linux-3.8-rc2_orig/drivers/usb/storage/initializers.c linux-3.8-rc2/drivers/usb/storage/initializers.c
> --- linux-3.8-rc2_orig/drivers/usb/storage/initializers.c	2013-01-04 10:12:01.441356344 +0800
> +++ linux-3.8-rc2/drivers/usb/storage/initializers.c	2013-01-04 10:55:49.512500933 +0800
> @@ -92,8 +92,8 @@ int usb_stor_ucr61s2b_init(struct us_dat
>  	return 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,75 @@ int usb_stor_huawei_e220_init(struct us_
>  	US_DEBUGP("Huawei mode set result is %d\n", result);
>  	return 0;
>  }
> +
> +/* This function will send
> + * a scsi switch command called rewind' to huawei dongle.
> + * When the dongle receives this command at the first time,
> + * it will reboot immediately,
> + * after rebooted, it will ignore this command and do nothing,
> + * if it receives this command again.
> + * So it is  unnecessary to read its response. */

This is not how a proper multi line comment looks like. The line break in the
middle of the sentence does not look good IMHO.

> +static int usb_stor_huawei_scsi_init(struct us_data *us)
> +{
> +	int result = 0;
> +	int act_len = 0;
> +	struct bulk_cb_wrap *bcbw = (struct bulk_cb_wrap *) us->iobuf;
> +	char rewind_cmd[] = {0x11, 0x06, 0x20, 0x00, 0x00, 0x01, 0x01, 0x00,
> +			0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
> +	
> +	memset(bcbw, 0, sizeof(struct bulk_cb_wrap));
> +	bcbw->Signature = cpu_to_le32(US_BULK_CB_SIGN);
> +	bcbw->Tag = 0;
> +	bcbw->DataTransferLength = 0;
> +	bcbw->Flags = bcbw->Lun = 0;
> +	bcbw->Length = sizeof(rewind_cmd);

I asked earlier and I ask again: why memset to zero followed by init to zero.
Could we stick to one thing?

> +	memcpy(bcbw->CDB, rewind_cmd, sizeof(rewind_cmd));
> +
> +	result = usb_stor_bulk_transfer_buf(us, us->send_bulk_pipe, bcbw,
> +					US_BULK_CB_WRAP_LEN, &act_len);

This looks like it could work. Was it really tested before sending this
time? :P

> +	US_DEBUGP("transfer actual length=%d, result=%d\n", act_len, result);
> +	return result;
> +}
> +
> +/* usb_stor_huawei_dongles_pid: try to find the supported Huawei USB dongles
> + * In Huawei, they assign the following product IDs
> + * for all of their mobile broadband dongles,
> + * including the new dongles in the future.
> + * So if the product ID is not included in this list,
> + * it means it is not Huawei's mobile broadband dongles.
> + */

Not a proper multiple line comment. Kernel doc format is different btw. and is
described in Documentation/kernel-doc-nano-HOWTO.txt 

> +static int usb_stor_huawei_dongles_pid(struct us_data *us)
> +{
> +	struct usb_interface_descriptor *idesc;
> +	int idProduct;
> +	
> +	idesc = &us->pusb_intf->cur_altsetting->desc;
> +	idProduct = us->pusb_dev->descriptor.idProduct;
> +	/* The first port is CDROM,
> +	 * means the dongle in the single port mode,
> +	 * and a switch command is required to be sent. */
> +	if (idesc && idesc->bInterfaceNumber == 0) {
> +		if ((idProduct == 0x1001)
> +			|| (idProduct == 0x1003)
> +			|| (idProduct == 0x1004)
> +			|| (idProduct >= 0x1401 && idProduct < 0x1501)
> +			|| (idProduct > 0x1504 && idProduct <= 0x1600)

why not >= 1505 and <= 1500 instead of the < and > operators? It would look
better. Do you exclude them on purpose or by accident?
On a second look, why not do this instead:

	switch (idProduct)
	case 0x1001:
	case 0x1401 .. 0x1500
		return 1;
	default:
		return 0;

This reads way way beter.

> +			|| (idProduct >= 0x1c02 && idProduct <= 0x2202)) {
> +			return 1;
> +		}
> +	}
> +	return 0;
> +}
> +
> +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;
> +}

Sebastian

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 1/1]linux-usb:optimize to match the Huawei USB storage devices and support new switch command
  2013-01-08 10:57 ` Sebastian Andrzej Siewior
@ 2013-01-08 11:58   ` Oliver Neukum
  0 siblings, 0 replies; 11+ messages in thread
From: Oliver Neukum @ 2013-01-08 11:58 UTC (permalink / raw)
  To: Sebastian Andrzej Siewior
  Cc: fangxiaozhi 00110321, linux-usb, linux-kernel, zihan, Lin.Lei,
	greg, neil.yi, wangyuhua, huqiao36, balbi, mdharm-usb

On Tuesday 08 January 2013 11:57:30 Sebastian Andrzej Siewior wrote:
> > +static int usb_stor_huawei_scsi_init(struct us_data *us)
> > +{
> > +     int result = 0;
> > +     int act_len = 0;
> > +     struct bulk_cb_wrap *bcbw = (struct bulk_cb_wrap *) us->iobuf;
> > +     char rewind_cmd[] = {0x11, 0x06, 0x20, 0x00, 0x00, 0x01, 0x01, 0x00,
> > +                     0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
> > +     
> > +     memset(bcbw, 0, sizeof(struct bulk_cb_wrap));
> > +     bcbw->Signature = cpu_to_le32(US_BULK_CB_SIGN);
> > +     bcbw->Tag = 0;
> > +     bcbw->DataTransferLength = 0;
> > +     bcbw->Flags = bcbw->Lun = 0;
> > +     bcbw->Length = sizeof(rewind_cmd);
> 
> I asked earlier and I ask again: why memset to zero followed by init to zero.
> Could we stick to one thing?

We shouldn't. The compiler will do the right thing. This is for the human
reader. You tell the reader that you want.

a) a clean slate to start with
b) you issue a command with certain parameters specified. That these
parameters are zero is beside the point. The point is telling the reader
which parameters are important here.

	Regards
		Oliver

PS: What about endianness of bcbw->Length?


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH 1/1]linux-usb:optimize to match the Huawei USB storage devices and support new switch command
@ 2013-01-23  6:07 fangxiaozhi 00110321
  0 siblings, 0 replies; 11+ messages in thread
From: fangxiaozhi 00110321 @ 2013-01-23  6:07 UTC (permalink / raw)
  To: linux-usb
  Cc: linux-kernel, zihan, Lin.Lei, greg, neil.yi, wangyuhua, huqiao36,
	balbi, mdharm-usb, sebastian

From: fangxiaozhi <huananhu@huawei.com>

1. Optimize the match rules with new macro for Huawei USB storage devices, 
   to avoid to load USB storage driver for the modem interface 
   with Huawei devices.
2. Add to support new switch command for new Huawei USB dongles.

Signed-off-by: fangxiaozhi <huananhu@huawei.com>
--------------------------------------------------------------------
diff -uprN linux-3.8-rc4_orig/drivers/usb/storage/initializers.c linux-3.8-rc4/drivers/usb/storage/initializers.c
--- linux-3.8-rc4_orig/drivers/usb/storage/initializers.c	2013-01-22 14:12:42.594238726 +0800
+++ linux-3.8-rc4/drivers/usb/storage/initializers.c	2013-01-22 14:28:21.512294889 +0800
@@ -92,8 +92,8 @@ int usb_stor_ucr61s2b_init(struct us_dat
 	return 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,75 @@ int usb_stor_huawei_e220_init(struct us_
 	US_DEBUGP("Huawei mode set result is %d\n", result);
 	return 0;
 }
+
+/*
+ * It will send a scsi switch command called rewind' to huawei dongle.
+ * When the dongle receives this command at the first time,
+ * it will reboot immediately. After rebooted, it will ignore this command.
+ * So it is  unnecessary to read its response.
+ */
+static int usb_stor_huawei_scsi_init(struct us_data *us)
+{
+	int result = 0;
+	int act_len = 0;
+	struct bulk_cb_wrap *bcbw = (struct bulk_cb_wrap *) us->iobuf;
+	char rewind_cmd[] = {0x11, 0x06, 0x20, 0x00, 0x00, 0x01, 0x01, 0x00,
+			0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
+
+	bcbw->Signature = cpu_to_le32(US_BULK_CB_SIGN);
+	bcbw->Tag = 0;
+	bcbw->DataTransferLength = 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,
+					US_BULK_CB_WRAP_LEN, &act_len);
+	US_DEBUGP("transfer actual length=%d, result=%d\n", act_len, result);
+	return result;
+}
+
+/*
+ * It tries to find the supported Huawei USB dongles.
+ * In Huawei, they assign the following product IDs
+ * for all of their mobile broadband dongles,
+ * including the new dongles in the future.
+ * So if the product ID is not included in this list,
+ * it means it is not Huawei's mobile broadband dongles.
+ */
+static int usb_stor_huawei_dongles_pid(struct us_data *us)
+{
+	struct usb_interface_descriptor *idesc;
+	int idProduct;
+
+	idesc = &us->pusb_intf->cur_altsetting->desc;
+	idProduct = us->pusb_dev->descriptor.idProduct;
+	/* The first port is CDROM,
+	 * means the dongle in the single port mode,
+	 * and a switch command is required to be sent. */
+	if (idesc && idesc->bInterfaceNumber == 0) {
+		if ((idProduct == 0x1001)
+			|| (idProduct == 0x1003)
+			|| (idProduct == 0x1004)
+			|| (idProduct >= 0x1401 && idProduct <= 0x1500)
+			|| (idProduct >= 0x1505 && idProduct <= 0x1600)
+			|| (idProduct >= 0x1c02 && idProduct <= 0x2202)) {
+			return 1;
+		}
+	}
+	return 0;
+}
+
+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;
+}
diff -uprN linux-3.8-rc4_orig/drivers/usb/storage/initializers.h linux-3.8-rc4/drivers/usb/storage/initializers.h
--- linux-3.8-rc4_orig/drivers/usb/storage/initializers.h	2013-01-22 14:12:42.595238727 +0800
+++ linux-3.8-rc4/drivers/usb/storage/initializers.h	2013-01-22 14:19:53.208263547 +0800
@@ -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.8-rc4_orig/drivers/usb/storage/unusual_devs.h linux-3.8-rc4/drivers/usb/storage/unusual_devs.h
--- linux-3.8-rc4_orig/drivers/usb/storage/unusual_devs.h	2013-01-22 14:12:42.594238726 +0800
+++ linux-3.8-rc4/drivers/usb/storage/unusual_devs.h	2013-01-22 14:19:53.208263547 +0800
@@ -1527,335 +1527,10 @@ UNUSUAL_DEV(  0x1210, 0x0003, 0x0100, 0x
 /* Reported by fangxiaozhi <huananhu@huawei.com>
  * 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) */

 
 


^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2013-01-23  6:07 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-01-05  2:57 [PATCH 1/1]linux-usb:optimize to match the Huawei USB storage devices and support new switch command fangxiaozhi 00110321
2013-01-08 10:57 ` Sebastian Andrzej Siewior
2013-01-08 11:58   ` Oliver Neukum
  -- strict thread matches above, loose matches on Subject: below --
2013-01-23  6:07 fangxiaozhi 00110321
2012-12-12 10:20 [PATCH 1/1]linux-usb: optimize " fangxiaozhi 00110321
2012-12-12 10:28 ` Felipe Balbi
2012-12-12 10:51 ` Alan Cox
     [not found]   ` <910F9D9E13B84F4C8FA771DC9BDE99F326FBFB54@szxeml546-mbs.china.huawei.com>
2012-12-14  9:31     ` Alan Cox
2012-12-14  9:33       ` Oliver Neukum
2012-12-14 10:28         ` Fangxiaozhi (Franko)
2012-12-14 10:42           ` Oliver Neukum

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox