linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Add the infamous Huawei E220 to option.c
@ 2007-11-29  0:13 Pete Zaitcev
  2007-11-29  6:33 ` Johann Wilhelm
                   ` (2 more replies)
  0 siblings, 3 replies; 31+ messages in thread
From: Pete Zaitcev @ 2007-11-29  0:13 UTC (permalink / raw)
  To: linux-usb
  Cc: zaitcev, preining, kristoffer.ericson, drussell, johann.wilhelm,
	linux-kernel

Hi, All:

It looks like the Huawei E220 saga is not over yet. A collegue of mine,
David Russll, reported that the modem does not work reliably on Fedora 8,
which does have the initializer in usb-storage.

The problem stems from the fact that both option and usb-storage can bind
to the modem when in storage mode: the former binds because of the storage
class, the latter binds because of VID/PID match. The modprobe loads both,
it's random which wins. If usb-storage wins, everything is fine. If option
wins, it binds to modem still in storage mode and does not work.

I propose we add the same initializer that usb-storage has to the option.
This way no matter which driver wins the modem gets initialized. The
patch is tested on David's modem, but I would like someone give it more
testing.

I dunno, do we want some kind of code sharing between storage and option?
They both could use the normal usb_control_msg, I think.

Also, from archives it looks like Johann may need PID 0x1004 added.

Since we're on topic, David's modem has exactly same IDs as Norbert's,
but works fine with the length of 1. Although it's possible that the
firmware is different without different firmware reported in USB desc-
riptors. Does anyone know a magic AT command? ATI or something?
Norbert, please try my patch, maybe it'll work this time.

And finally, pleas stop using that script from the polish website and
above all quit using the generic serial subdriver. The option must
work now with the patch. Please let me know if it fails.

Thanks in advance,
-- Pete

diff -urp -X dontdiff linux-2.6.23.1-42.fc8/drivers/usb/serial/option.c linux-2.6.23.1-42.fc8.e220.1/drivers/usb/serial/option.c
--- linux-2.6.23.1-42.fc8/drivers/usb/serial/option.c	2007-10-09 13:31:38.000000000 -0700
+++ linux-2.6.23.1-42.fc8.e220.1/drivers/usb/serial/option.c	2007-11-27 21:36:11.000000000 -0800
@@ -448,7 +448,7 @@ static void option_indat_callback(struct
 			err = usb_submit_urb(urb, GFP_ATOMIC);
 			if (err)
 				printk(KERN_ERR "%s: resubmit read urb failed. "
-					"(%d)", __FUNCTION__, err);
+					"(%d)\n", __FUNCTION__, err);
 		}
 	}
 	return;
@@ -728,6 +728,35 @@ static int option_send_setup(struct usb_
 	return 0;
 }
 
+static void option_start_huawei(struct usb_serial *serial)
+{
+	struct usb_device *dev = serial->dev;
+	char *buf;
+	int rc;
+
+	if (!(le16_to_cpu(dev->descriptor.idVendor) == HUAWEI_VENDOR_ID &&
+	    le16_to_cpu(dev->descriptor.idProduct) == HUAWEI_PRODUCT_E220))
+		return;
+
+	if ((buf = kmalloc(1, GFP_KERNEL)) == 0)
+		goto err_buf;
+
+	buf[0] = 0x1;
+	rc = usb_control_msg(dev, usb_sndctrlpipe(dev, 0),
+		USB_REQ_SET_FEATURE, USB_TYPE_STANDARD | USB_RECIP_DEVICE,
+		0x01, 0x0, buf, 1, 1000);
+	if (rc) {
+		printk(KERN_ERR "%s: HUAWEI E220 setup failed (%d)\n",
+		    __FUNCTION__, rc);
+	}
+
+	kfree(buf);
+	return;
+
+err_buf:
+	;
+}
+
 static int option_startup(struct usb_serial *serial)
 {
 	int i, err;
@@ -736,6 +765,8 @@ static int option_startup(struct usb_ser
 
 	dbg("%s", __FUNCTION__);
 
+	option_start_huawei(serial);
+
 	/* Now setup per port private data */
 	for (i = 0; i < serial->num_ports; i++) {
 		port = serial->port[i];

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

end of thread, other threads:[~2007-12-05 19:15 UTC | newest]

Thread overview: 31+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-11-29  0:13 Add the infamous Huawei E220 to option.c Pete Zaitcev
2007-11-29  6:33 ` Johann Wilhelm
2007-11-29  7:44   ` Oliver Neukum
2007-11-29  8:01     ` Pete Zaitcev
2007-11-29  8:14       ` Oliver Neukum
2007-11-29  9:09         ` Matthew Dharm
2007-11-29 10:01           ` Rui Santos
2007-11-29 10:49             ` Oliver Neukum
2007-11-29 11:07               ` Rui Santos
2007-11-29 11:55                 ` Oliver Neukum
2007-11-29 14:05                   ` Johann Wilhelm
2007-11-29 14:36                     ` Kristoffer Ericson
2007-11-29 14:41                       ` Oliver Neukum
2007-11-29 18:53                     ` Jaime Velasco Juan
2007-11-29 23:23                       ` Oliver Neukum
2007-11-30 16:30                         ` [PATCH] USB: option: Bind to the correct interface of the Huawei E220 Jaime Velasco Juan
2007-12-01  8:07                           ` Norbert Preining
2007-12-01  8:34                             ` Pete Zaitcev
2007-12-01 10:04                               ` Norbert Preining
2007-12-01 18:36                           ` Borislav Petkov
2007-12-05 16:34                           ` Pete Zaitcev
2007-12-05 18:23                             ` Oliver Neukum
2007-12-05 19:14                               ` Pete Zaitcev
2007-11-29 19:12                   ` Add the infamous Huawei E220 to option.c Rui Santos
2007-11-29 17:08       ` Greg KH
2007-11-29  7:38 ` Oliver Neukum
2007-11-29  7:52   ` Pete Zaitcev
2007-11-29  8:04     ` Oliver Neukum
2007-11-29  8:10       ` Pete Zaitcev
2007-11-29 14:14 ` Norbert Preining
2007-11-29 14:16   ` Norbert Preining

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).