All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2]linux-usb:Define a new macro for USB storage match rules
@ 2012-12-18  2:42 fangxiaozhi 00110321
  2012-12-18  2:44 ` [PATCH 2/2]linux-usb:optimize to match the Huawei USB storage devices and support new switch command fangxiaozhi 00110321
  0 siblings, 1 reply; 14+ messages in thread
From: fangxiaozhi 00110321 @ 2012-12-18  2:42 UTC (permalink / raw)
  To: linux-usb
  Cc: linux-kernel, zihan, Lin.Lei, greg, neil.yi, wangyuhua, huqiao36, balbi

From: fangxiaozhi <huananhu@huawei.com>

1. Define a new macro for USB storage match rules: 
    matching with Vendor ID and interface descriptors.

Signed-off-by: fangxiaozhi <huananhu@huawei.com>
--------------------------------------------------------------------

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-13 20:51:27.000000000 +0800
@@ -41,6 +41,19 @@
 #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 +63,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


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

* [PATCH 2/2]linux-usb:optimize to match the Huawei USB storage devices and support new switch command
  2012-12-18  2:42 [PATCH 1/2]linux-usb:Define a new macro for USB storage match rules fangxiaozhi 00110321
@ 2012-12-18  2:44 ` fangxiaozhi 00110321
  2012-12-18 14:10   ` Sebastian Andrzej Siewior
  0 siblings, 1 reply; 14+ messages in thread
From: fangxiaozhi 00110321 @ 2012-12-18  2:44 UTC (permalink / raw)
  To: linux-usb
  Cc: linux-kernel, zihan, Lin.Lei, greg, neil.yi, wangyuhua, huqiao36, balbi

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.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-17 11:12:12.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,59 @@ 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)
+{
+	struct usb_interface_descriptor *idesc;
+	int idProduct;
+	
+	idesc = &us->pusb_intf->cur_altsetting->desc;
+	idProduct = us->pusb_dev->descriptor.idProduct;
+	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;
+}
+
+static int usb_stor_huawei_scsi_init(struct us_data *us)
+{
+	int result = 0;
+	int act_len = 0;
+	char rewind_cmd[] = {0x11, 0x06, 0x20, 0x00, 0x00, 0x01, 0x01, 0x00,
+			0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
+	struct bulk_cb_wrap *bcbw = (struct bulk_cb_wrap *) us->iobuf;
+	
+	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_CS_WRAP_LEN, &act_len);
+	US_DEBUGP("transfer actual length=%d, result=%d\n", act_len, result);
+	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-17 10:39:55.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);
Binary files linux-3.7_bak/drivers/usb/storage/initializers.o and linux-3.7/drivers/usb/storage/initializers.o differ
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-17 10:40:10.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) */


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

* Re: [PATCH 2/2]linux-usb:optimize to match the Huawei USB storage devices and support new switch command
  2012-12-18  2:44 ` [PATCH 2/2]linux-usb:optimize to match the Huawei USB storage devices and support new switch command fangxiaozhi 00110321
@ 2012-12-18 14:10   ` Sebastian Andrzej Siewior
  2012-12-19  3:13     ` Fangxiaozhi (Franko)
  0 siblings, 1 reply; 14+ messages in thread
From: Sebastian Andrzej Siewior @ 2012-12-18 14:10 UTC (permalink / raw)
  To: fangxiaozhi 00110321
  Cc: linux-usb, linux-kernel, zihan, Lin.Lei, greg, neil.yi,
	wangyuhua, huqiao36, balbi

On Tue, Dec 18, 2012 at 10:44:19AM +0800, fangxiaozhi 00110321 wrote:
> 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-17 11:12:12.000000000 +0800
>  	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)
> +{
> +	struct usb_interface_descriptor *idesc;
> +	int idProduct;
> +	
> +	idesc = &us->pusb_intf->cur_altsetting->desc;
> +	idProduct = us->pusb_dev->descriptor.idProduct;
> +	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;
> +}
> +
> +static int usb_stor_huawei_scsi_init(struct us_data *us)
> +{
> +	int result = 0;
> +	int act_len = 0;
> +	char rewind_cmd[] = {0x11, 0x06, 0x20, 0x00, 0x00, 0x01, 0x01, 0x00,
> +			0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};

Has this something to do with the SPACE command as defined in SSC-2? I don't
see the code (0x6 here) to be defined. But then you name is rewind.

> +	struct bulk_cb_wrap *bcbw = (struct bulk_cb_wrap *) us->iobuf;
> +	
> +	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;

A memset() followed by an init of each member of the struct. Could please
chose one side?

> +	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_CS_WRAP_LEN, &act_len);

I am a little confused here. Shouldn't this be bcbw aka us->iobuf and not
&bcbw ?

And shouldn't you read something from the us->recv_bulk_pipe after that?

> +	US_DEBUGP("transfer actual length=%d, result=%d\n", act_len, result);
> +	return result;
> +}
> +

Sebastian

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

* RE: [PATCH 2/2]linux-usb:optimize to match the Huawei USB storage devices and support new switch command
  2012-12-18 14:10   ` Sebastian Andrzej Siewior
@ 2012-12-19  3:13     ` Fangxiaozhi (Franko)
  2012-12-19  8:34       ` Sebastian Andrzej Siewior
  0 siblings, 1 reply; 14+ messages in thread
From: Fangxiaozhi (Franko) @ 2012-12-19  3:13 UTC (permalink / raw)
  To: Sebastian Andrzej Siewior
  Cc: linux-usb, linux-kernel, Xueguiying (Zihan), Linlei (Lei Lin),
	greg, Yili (Neil), Wangyuhua (Roger, Credit),
	Huqiao, balbi

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

Dear Sebastian:
	Please see the comments follows yours.
	
	By the way, I found the kernel is updated to 3.7.1 today. So I have to update my patch based on 3.7.1, and resubmit it?
	Right?

Best Regards,
Franko Fang

> -----Original Message-----
> From: Sebastian Andrzej Siewior [mailto:sebastian@breakpoint.cc]
> Sent: Tuesday, December 18, 2012 10:10 PM
> 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; balbi@ti.com
> Subject: Re: [PATCH 2/2]linux-usb:optimize to match the Huawei USB
> storage devices and support new switch command
> 
> On Tue, Dec 18, 2012 at 10:44:19AM +0800, fangxiaozhi 00110321 wrote:
> > 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-17
> 11:12:12.000000000 +0800
> >  	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) {
> > +	struct usb_interface_descriptor *idesc;
> > +	int idProduct;
> > +
> > +	idesc = &us->pusb_intf->cur_altsetting->desc;
> > +	idProduct = us->pusb_dev->descriptor.idProduct;
> > +	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;
> > +}
> > +
> > +static int usb_stor_huawei_scsi_init(struct us_data *us) {
> > +	int result = 0;
> > +	int act_len = 0;
> > +	char rewind_cmd[] = {0x11, 0x06, 0x20, 0x00, 0x00, 0x01, 0x01, 0x00,
> > +			0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
> 
> Has this something to do with the SPACE command as defined in SSC-2? I
> don't see the code (0x6 here) to be defined. But then you name is rewind.

	Yes, we redefine the SPACE based on our need, and named it "rewind"

> 
> > +	struct bulk_cb_wrap *bcbw = (struct bulk_cb_wrap *) us->iobuf;
> > +
> > +	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;
> 
> A memset() followed by an init of each member of the struct. Could please
> chose one side?
> 
> > +	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_CS_WRAP_LEN, &act_len);
> 
> I am a little confused here. Shouldn't this be bcbw aka us->iobuf and not
> &bcbw ?
	Yes, you are right.
> 
> And shouldn't you read something from the us->recv_bulk_pipe after
> that?
	Well, because our device will re-connect to switch the ports if it receives the command.
	So it is not necessary to read the response of the command.
> 
> > +	US_DEBUGP("transfer actual length=%d, result=%d\n", act_len,
> result);
> > +	return result;
> > +}
> > +
> 
> Sebastian
ÿôèº{.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] 14+ messages in thread

* Re: [PATCH 2/2]linux-usb:optimize to match the Huawei USB storage devices and support new switch command
  2012-12-19  3:13     ` Fangxiaozhi (Franko)
@ 2012-12-19  8:34       ` Sebastian Andrzej Siewior
  2012-12-19 15:40         ` Matthew Dharm
  0 siblings, 1 reply; 14+ messages in thread
From: Sebastian Andrzej Siewior @ 2012-12-19  8:34 UTC (permalink / raw)
  To: Fangxiaozhi (Franko)
  Cc: linux-usb, linux-kernel, Xueguiying (Zihan), Linlei (Lei Lin),
	greg, Yili (Neil), Wangyuhua (Roger, Credit),
	Huqiao, balbi

On Wed, Dec 19, 2012 at 03:13:32AM +0000, Fangxiaozhi (Franko) wrote:
> 	By the way, I found the kernel is updated to 3.7.1 today. So I have to update my patch based on 3.7.1, and resubmit it?
> 	Right?

You should rebase your patch on top of Greg's usb-next branch of his usb tree.
 http://git.kernel.org/?p=linux/kernel/git/gregkh/usb.git;a=shortlog;h=refs/heads/usb-next

but I guess that there are hardly any changes in that area. The last change in
drivers/usb/storage/initializers.* is yours "USB: usb-storage fails to attach
to Huawei Datacard cdrom device".

If you call ./scripts/get_maintainer.pl on your patch you should learn that
you miss
|Matthew Dharm <mdharm-usb@one-eyed-alien.net>
|usb-storage@lists.one-eyed-alien.net

> > And shouldn't you read something from the us->recv_bulk_pipe after
> > that?
> 	Well, because our device will re-connect to switch the ports if it receives the command.
> 	So it is not necessary to read the response of the command.

Hmm. I guess this for Matthew / Greg to decide, I don't insist on anything.
Maybe a comment would be nice because now it looks, atleast to me, that
something is missing.

Sebastian

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

* Re: [PATCH 2/2]linux-usb:optimize to match the Huawei USB storage devices and support new switch command
  2012-12-19  8:34       ` Sebastian Andrzej Siewior
@ 2012-12-19 15:40         ` Matthew Dharm
  2013-01-04  7:30           ` Fangxiaozhi (Franko)
  0 siblings, 1 reply; 14+ messages in thread
From: Matthew Dharm @ 2012-12-19 15:40 UTC (permalink / raw)
  To: Sebastian Andrzej Siewior
  Cc: Fangxiaozhi (Franko), linux-usb, linux-kernel, Xueguiying (Zihan),
	Linlei (Lei Lin), greg, Yili (Neil), Wangyuhua (Roger, Credit),
	Huqiao, balbi

On Wed, Dec 19, 2012 at 12:34 AM, Sebastian Andrzej Siewior
<sebastian@breakpoint.cc> wrote:
> On Wed, Dec 19, 2012 at 03:13:32AM +0000, Fangxiaozhi (Franko) wrote:
>> > And shouldn't you read something from the us->recv_bulk_pipe after
>> > that?
>>       Well, because our device will re-connect to switch the ports if it receives the command.
>>       So it is not necessary to read the response of the command.
>
> Hmm. I guess this for Matthew / Greg to decide, I don't insist on anything.
> Maybe a comment would be nice because now it looks, atleast to me, that
> something is missing.

I think an unusual situation like that deserves a comment that
explains that the device is about to disconnect / reconnect, so
reading status is not necessary.

I am also concerned about the error of using &bcbw instead of bcbw.  I
doubt this code would have worked with that typo in place.  How was
this patch tested?

Also, the dongles_pid function is really just a different
implementation of the unusual_devs.h table.  I think that it is much
easier for people to add new entries to the table, rather than edit
your code, when new dongles are released.  BUT, your code includes
many more PIDs than the table did.  Again, how was this tested for the
new PIDs covered?  At a minimum, some comment in dongles_pid is
required to highlight this area of code for possible future expansion
as new devices are released.

Matt

-- 
Matthew Dharm
Maintainer, USB Mass Storage driver for Linux

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

* RE: [PATCH 2/2]linux-usb:optimize to match the Huawei USB storage devices and support new switch command
  2012-12-19 15:40         ` Matthew Dharm
@ 2013-01-04  7:30           ` Fangxiaozhi (Franko)
  0 siblings, 0 replies; 14+ messages in thread
From: Fangxiaozhi (Franko) @ 2013-01-04  7:30 UTC (permalink / raw)
  To: Matthew Dharm, Sebastian Andrzej Siewior
  Cc: linux-usb, linux-kernel, Xueguiying (Zihan), Linlei (Lei Lin),
	greg, Yili (Neil), Wangyuhua (Roger, Credit), Huqiao (C),
	balbi

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

Dear Matthew:


> -----Original Message-----
> From: Matthew Dharm [mailto:mdharm-usb@one-eyed-alien.net]
> Sent: Wednesday, December 19, 2012 11:41 PM
> To: Sebastian Andrzej Siewior
> 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; balbi@ti.com
> Subject: Re: [PATCH 2/2]linux-usb:optimize to match the Huawei USB storage
> devices and support new switch command
> 
> On Wed, Dec 19, 2012 at 12:34 AM, Sebastian Andrzej Siewior
> <sebastian@breakpoint.cc> wrote:
> > On Wed, Dec 19, 2012 at 03:13:32AM +0000, Fangxiaozhi (Franko) wrote:
> >> > And shouldn't you read something from the us->recv_bulk_pipe after
> >> > that?
> >>       Well, because our device will re-connect to switch the ports if it
> receives the command.
> >>       So it is not necessary to read the response of the command.
> >
> > Hmm. I guess this for Matthew / Greg to decide, I don't insist on anything.
> > Maybe a comment would be nice because now it looks, atleast to me,
> > that something is missing.
> 
> I think an unusual situation like that deserves a comment that explains that the
> device is about to disconnect / reconnect, so reading status is not necessary.
	You mean that we have to add some comment in the source code, 
to explain why we don't read the response. Right?
	
> 
> I am also concerned about the error of using &bcbw instead of bcbw.  I doubt
> this code would have worked with that typo in place.  How was this patch
> tested?
> 
> Also, the dongles_pid function is really just a different implementation of the
> unusual_devs.h table.  I think that it is much easier for people to add new
> entries to the table, rather than edit your code, when new dongles are released.
> BUT, your code includes many more PIDs than the table did.  Again, how was
> this tested for the new PIDs covered?  
	In the dongles_pid function, we have check all the product IDs for our dongles, which is assigned for all of our Mobile Broadband products in our company. So the product ID of our new dongle in future, will also be included in this list.
	In our lab, we can configure our dongle firmware to support all of these product ID. We have test them(cover all the product ID), and this function works fine.

>At a minimum, some comment in
> dongles_pid is required to highlight this area of code for possible future
> expansion as new devices are released.
	As far as I know, the product ID list in dongles_pid function includes all. We will not add any other product ID for our dongle. So we need not update the product ID list in dongles_pid function in future.
	However, I also will add the comment to highlight the area of code, as your advice did.
> 
> Matt
> 
> --
> Matthew Dharm
> Maintainer, USB Mass Storage driver for Linux

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] 14+ messages in thread

* [PATCH 2/2]linux-usb:optimize to match the Huawei USB storage devices and support new switch command
@ 2013-02-04  7:16 fangxiaozhi 00110321
  0 siblings, 0 replies; 14+ messages in thread
From: fangxiaozhi 00110321 @ 2013-02-04  7:16 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-rc6_orig/drivers/usb/storage/initializers.c linux-3.8-rc6/drivers/usb/storage/initializers.c
--- linux-3.8-rc6_orig/drivers/usb/storage/initializers.c	2013-02-04 14:38:34.268154216 +0800
+++ linux-3.8-rc6/drivers/usb/storage/initializers.c	2013-02-04 14:52:19.947201855 +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-rc6_orig/drivers/usb/storage/initializers.h linux-3.8-rc6/drivers/usb/storage/initializers.h
--- linux-3.8-rc6_orig/drivers/usb/storage/initializers.h	2013-02-04 14:38:34.269154217 +0800
+++ linux-3.8-rc6/drivers/usb/storage/initializers.h	2013-02-04 14:52:19.947201855 +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-rc6_orig/drivers/usb/storage/unusual_devs.h linux-3.8-rc6/drivers/usb/storage/unusual_devs.h
--- linux-3.8-rc6_orig/drivers/usb/storage/unusual_devs.h	2013-02-04 14:38:34.267154216 +0800
+++ linux-3.8-rc6/drivers/usb/storage/unusual_devs.h	2013-02-04 14:52:19.949201855 +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] 14+ messages in thread

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

On Fri, Jan 25, 2013 at 10:46:13AM +0800, fangxiaozhi 00110321 wrote:
> 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
> @@ -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));

First you memset() 16 bytes of CDB to 0
> + memcpy(bcbw->CDB, rewind_cmd, sizeof(rewind_cmd));
And now you copy 16 bytes from rewind_cmd to CDB. So the memset is not really
required, is it?

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

Sebastian

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

* [PATCH 2/2]linux-usb:optimize to match the Huawei USB storage devices and support new switch command
@ 2013-01-25  2:46 fangxiaozhi 00110321
  2013-01-27 18:48 ` Sebastian Andrzej Siewior
  0 siblings, 1 reply; 14+ messages in thread
From: fangxiaozhi 00110321 @ 2013-01-25  2:46 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] 14+ messages in thread

* RE: [PATCH 2/2]linux-usb:optimize to match the Huawei USB storage devices and support new switch command
  2013-01-12  0:22 ` Greg KH
@ 2013-01-14  2:29   ` Fangxiaozhi (Franko)
  0 siblings, 0 replies; 14+ messages in thread
From: Fangxiaozhi (Franko) @ 2013-01-14  2:29 UTC (permalink / raw)
  To: Greg KH
  Cc: linux-usb, linux-kernel, Xueguiying (Zihan), Linlei (Lei Lin),
	Yili (Neil), Wangyuhua (Roger, Credit), Huqiao (C),
	balbi, mdharm-usb, sebastian

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

Dear Greg:

> -----Original Message-----
> From: Greg KH [mailto:greg@kroah.com]
> Sent: Saturday, January 12, 2013 8:22 AM
> To: Fangxiaozhi (Franko)
> Cc: linux-usb@vger.kernel.org; linux-kernel@vger.kernel.org; Xueguiying (Zihan);
> Linlei (Lei Lin); Yili (Neil); Wangyuhua (Roger, Credit); Huqiao (C); balbi@ti.com;
> mdharm-usb@one-eyed-alien.net; sebastian@breakpoint.cc
> Subject: Re: [PATCH 2/2]linux-usb:optimize to match the Huawei USB storage
> devices and support new switch command
> 
> On Fri, Jan 11, 2013 at 05:57:44PM +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.
> 
> I don't see a 1/2 patch in this series, yet I see two different 1/1 patches.
--Yes, this email includes the entire patch. 
--I mask the "2/2" to distinguish it from the previous email, which mask 1/1.

> 
> Can you resend all of your outstanding patchs, in the correct order, with the
> correct numbering, so I know what order to apply them in?
> 
-----This email is the whole patch, so can I resend it again?

> thanks,
> 
> greg k-h

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] 14+ messages in thread

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

On Fri, Jan 11, 2013 at 05:57:44PM +0800, fangxiaozhi 00110321 wrote:
> diff -uprN linux-3.8-rc3_orig/drivers/usb/storage/initializers.c linux-3.8-rc3/drivers/usb/storage/initializers.c
> --- linux-3.8-rc3_orig/drivers/usb/storage/initializers.c	2013-01-11 17:53:19.757842845 +0800
> +++ linux-3.8-rc3/drivers/usb/storage/initializers.c	2013-01-11 17:55:04.137841849 +0800
> @@ -104,3 +104,71 @@ 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. */
This multiline comment is wrong. See Documentation/CodingStyle Chapter 8:
Commenting

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

You asked me about this, and just replied.

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

multiline comment again.

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

Multiline comment + means fits in the first line, doesn't it?

> +	if (idesc && idesc->bInterfaceNumber == 0) {
if you do

	if (!idesc || idesc-> != 0)
		return 0;

then you lose one ident level.

> +		if ((idProduct == 0x1001)
> +			|| (idProduct == 0x1003)
> +			|| (idProduct == 0x1004)
> +			|| (idProduct >= 0x1401 && idProduct <= 0x1500)
> +			|| (idProduct >= 0x1505 && idProduct <= 0x1600)
> +			|| (idProduct >= 0x1c02 && idProduct <= 0x2202)) {
> +			return 1;

what about the switch case here?

> +		}
> +	}
> +	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;
> +}
> Binary files linux-3.8-rc3_orig/drivers/usb/storage/initializers.o and linux-3.8-rc3/drivers/usb/storage/initializers.o differ
^^^

Sebastian

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

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

On Fri, Jan 11, 2013 at 05:57:44PM +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.

I don't see a 1/2 patch in this series, yet I see two different 1/1
patches.

Can you resend all of your outstanding patchs, in the correct order,
with the correct numbering, so I know what order to apply them in?

thanks,

greg k-h

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

* [PATCH 2/2]linux-usb:optimize to match the Huawei USB storage devices and support new switch command
@ 2013-01-11  9:57 fangxiaozhi 00110321
  2013-01-12  0:22 ` Greg KH
  2013-01-13 22:05 ` Sebastian Andrzej Siewior
  0 siblings, 2 replies; 14+ messages in thread
From: fangxiaozhi 00110321 @ 2013-01-11  9: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-rc3_orig/drivers/usb/storage/initializers.c linux-3.8-rc3/drivers/usb/storage/initializers.c
--- linux-3.8-rc3_orig/drivers/usb/storage/initializers.c	2013-01-11 17:53:19.757842845 +0800
+++ linux-3.8-rc3/drivers/usb/storage/initializers.c	2013-01-11 17:55:04.137841849 +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,71 @@ 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-rc3_orig/drivers/usb/storage/initializers.h linux-3.8-rc3/drivers/usb/storage/initializers.h
--- linux-3.8-rc3_orig/drivers/usb/storage/initializers.h	2013-01-11 17:53:19.758842845 +0800
+++ linux-3.8-rc3/drivers/usb/storage/initializers.h	2013-01-11 17:55:04.767841843 +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-rc3_orig/drivers/usb/storage/initializers.o and linux-3.8-rc3/drivers/usb/storage/initializers.o differ
diff -uprN linux-3.8-rc3_orig/drivers/usb/storage/unusual_devs.h linux-3.8-rc3/drivers/usb/storage/unusual_devs.h
--- linux-3.8-rc3_orig/drivers/usb/storage/unusual_devs.h	2013-01-11 17:53:19.757842845 +0800
+++ linux-3.8-rc3/drivers/usb/storage/unusual_devs.h	2013-01-11 17:55:15.964841737 +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] 14+ messages in thread

end of thread, other threads:[~2013-02-04  7:16 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-12-18  2:42 [PATCH 1/2]linux-usb:Define a new macro for USB storage match rules fangxiaozhi 00110321
2012-12-18  2:44 ` [PATCH 2/2]linux-usb:optimize to match the Huawei USB storage devices and support new switch command fangxiaozhi 00110321
2012-12-18 14:10   ` Sebastian Andrzej Siewior
2012-12-19  3:13     ` Fangxiaozhi (Franko)
2012-12-19  8:34       ` Sebastian Andrzej Siewior
2012-12-19 15:40         ` Matthew Dharm
2013-01-04  7:30           ` Fangxiaozhi (Franko)
2013-01-11  9:57 fangxiaozhi 00110321
2013-01-12  0:22 ` Greg KH
2013-01-14  2:29   ` Fangxiaozhi (Franko)
2013-01-13 22:05 ` Sebastian Andrzej Siewior
2013-01-25  2:46 fangxiaozhi 00110321
2013-01-27 18:48 ` Sebastian Andrzej Siewior
2013-02-04  7:16 fangxiaozhi 00110321

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.