

This patch make the HUAWEI E220 device to map out three ports instead of only one virtural cd port.

CC: zihan@huawei.com
CC: wanganyu1983@huawei.com
CC: dingjianjian@huawei.com
CC: linlei83@huawei.com
CC: fangxiaozhi <fangxiaozhi60675@huawei.com>
Signed-off-by: fangxiaozhi <fangxiaozhi60675.huawei.com>

----------------------------------------


diff -urN -X linux-2.6.21.1-vanilla/Documentation/dontdiff linux-2.6.21.1-vanilla/drivers/usb/storage/initializers.c linux-2.6.21.1/drivers/usb/storage/initializers.c
--- linux-2.6.21.1-vanilla/drivers/usb/storage/initializers.c	2007-04-28 05:49:26.000000000 +0800
+++ linux-2.6.21.1/drivers/usb/storage/initializers.c	2007-06-21 19:18:48.000000000 +0800
@@ -90,3 +90,14 @@
 
 	return (res ? -1 : 0);
 }
+
+/* This places the HUAWEI E220 devices in multi-port mode */
+int usb_stor_switch_ports_init(struct us_data *us)
+{
+	us->iobuf[0] = 0x1;
+	(void)usb_control_msg(us->pusb_dev, usb_sndctrlpipe(us->pusb_dev, 0),
+		USB_REQ_SET_FEATURE, USB_TYPE_STANDARD | USB_RECIP_DEVICE, 
+		0x01, 0x0, us->iobuf, 0x1, 1000);
+	return 0;
+}
+
diff -urN -X linux-2.6.21.1-vanilla/Documentation/dontdiff linux-2.6.21.1-vanilla/drivers/usb/storage/initializers.h linux-2.6.21.1/drivers/usb/storage/initializers.h
--- linux-2.6.21.1-vanilla/drivers/usb/storage/initializers.h	2007-04-28 05:49:26.000000000 +0800
+++ linux-2.6.21.1/drivers/usb/storage/initializers.h	2007-06-21 19:18:26.000000000 +0800
@@ -47,3 +47,6 @@
 /* This function is required to activate all four slots on the UCR-61S2B
  * flash reader */
 int usb_stor_ucr61s2b_init(struct us_data *us);
+
+/* This places the HUAWEI E220 devices in multi-port mode */
+int usb_stor_switch_ports_init(struct us_data *us);
diff -urN -X linux-2.6.21.1-vanilla/Documentation/dontdiff linux-2.6.21.1-vanilla/drivers/usb/storage/unusual_devs.h linux-2.6.21.1/drivers/usb/storage/unusual_devs.h
--- linux-2.6.21.1-vanilla/drivers/usb/storage/unusual_devs.h	2007-04-28 05:49:26.000000000 +0800
+++ linux-2.6.21.1/drivers/usb/storage/unusual_devs.h	2007-06-21 19:21:30.000000000 +0800
@@ -1371,14 +1371,15 @@
 		US_SC_DEVICE, US_PR_DEVICE, NULL,
 		US_FL_IGNORE_RESIDUE ),
 
-/* This prevents the kernel from detecting the virtual cd-drive with the
- * Windows drivers.  <johann.wilhelm@student.tugraz.at>
+/* This tells the usb driver to place the HUAWEI E220 devices into multi-port mode
+ * Reported by fangxiaozhi <fangxiaozhi60675@huawei.com>
+ * and by linlei <linlei83@huawei.com>
 */
-UNUSUAL_DEV( 0x12d1, 0x1003, 0x0000, 0xffff,
+UNUSUAL_DEV( 0x12d1, 0x1003, 0x0000, 0x0000,
 		"HUAWEI",
-		"E220 USB-UMTS Install",
-		US_SC_DEVICE, US_PR_DEVICE, NULL,
-		US_FL_IGNORE_DEVICE),
+		"HUAWEI MOBILE Mass Storage",
+		US_SC_DEVICE, US_PR_DEVICE, usb_stor_switch_ports_init,
+		0),
 
 /* Reported by Vilius Bilinkevicius <vilisas AT xxx DOT lt) */
 UNUSUAL_DEV(  0x132b, 0x000b, 0x0001, 0x0001,
