Commit 4972af26 authored by Barry K. Nathan's avatar Barry K. Nathan Committed by Linus Torvalds

[PATCH] USB: 2.5.42 partial fix for older pl2303

On Sat, Oct 12, 2002 at 06:16:44PM -0700, Greg KH wrote:
> Now, would you mind taking a look at 2.5, and fixing this there too? :)

Here's a half-successful attempt. With this patch, the device no longer
appears twice, and it always works on the first open (at least, so I've
observed up to this point). The open following a successful open usually
fails (roughly speaking, it appears to play dead), and the open following
a failed open usually (always?) succeeds.

So, on my PL-2303, it's not perfect but it's certainly livable.

This patch is based on the one I did for 2.4, and in fact, this code
functions when it's plugged into 2.4.20-pre10 instead of 2.5.42. In that
scenario, the opens work 100% of the time.

I'd be interested in suggestions or comments regarding this patch.
Anyone who has a PL-2303 working under 2.5 might want to try this patch
just to make sure it doesn't kill their working setup.

-Barry K. Nathan <barryn@pobox.com>
parent 0f261868
......@@ -1237,16 +1237,18 @@ int usb_serial_probe(struct usb_interface *interface,
}
#if defined(CONFIG_USB_SERIAL_PL2303) || defined(CONFIG_USB_SERIAL_PL2303_MODULE)
#if 0
#if 1
/* BEGIN HORRIBLE HACK FOR PL2303 */
/* this is needed due to the looney way its endpoints are set up */
if (ifnum == 1) {
if (((dev->descriptor.idVendor == PL2303_VENDOR_ID) &&
(dev->descriptor.idProduct == PL2303_PRODUCT_ID)) ||
((dev->descriptor.idVendor == ATEN_VENDOR_ID) &&
(dev->descriptor.idProduct == ATEN_PRODUCT_ID))) {
//if (ifnum == 1) {
if (interface != &dev->actconfig->interface[0]) {
/* check out the endpoints of the other interface*/
interface = &dev->actconfig->interface[ifnum ^ 1];
//interface = &dev->actconfig->interface[ifnum ^ 1];
interface = &dev->actconfig->interface[0];
iface_desc = &interface->altsetting[0];
for (i = 0; i < iface_desc->bNumEndpoints; ++i) {
endpoint = &iface_desc->endpoint[i];
......@@ -1259,6 +1261,15 @@ int usb_serial_probe(struct usb_interface *interface,
}
}
}
/* Now make sure the PL-2303 is configured correctly.
* If not, give up now and hope this hack will work
* properly during a later invocation of usb_serial_probe
*/
if (num_bulk_in == 0 || num_bulk_out == 0) {
info("PL-2303 hack: descriptors matched but endpoints did not");
return NULL;
}
}
/* END HORRIBLE HACK FOR PL2303 */
#endif
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment