[PATCH] 2.4.20-pre10: make PL-2303 hack work again

From: Barry K. Nathan (barryn@pobox.com)
Date: Sat Oct 12 2002 - 19:42:49 EST


The following patch allows the PL-2303 hack to work again. It applies
to and has been tested with 2.4.20-pre10. Testing included using an ISDN
"modem" connected to the PL-2303 to do some web browsing and some
downloads (including a gzipped Linux 2.5.42 tarball).

The patch resurrects a sanity check (or so it appears to me) which was
removed in 2.4.20-pre2. However, the new version of the check is
contained within the PL-2303 hack #ifdef's, and it no longer relies on
variables like interrupt_pipe which have been removed from the USB
serial code.

Given that 2.4.19 works with my PL-2303 and 2.4 is supposed to be a
"stable" series, I'd appreciate if this patch (or another which fixes my
problem) could be merged. If this patch needs improvements first, please
let me know.

-Barry K. Nathan <barryn@pobox.com>

diff -ru linux-2.4.20-pre10/drivers/usb/serial/usbserial.c linux-2.4.20-pre10-bkn4/drivers/usb/serial/usbserial.c
--- linux-2.4.20-pre10/drivers/usb/serial/usbserial.c 2002-09-26 02:23:00.000000000 -0700
+++ linux-2.4.20-pre10-bkn4/drivers/usb/serial/usbserial.c 2002-10-12 17:21:00.000000000 -0700
@@ -1182,11 +1182,11 @@
 #if defined(CONFIG_USB_SERIAL_PL2303) || defined(CONFIG_USB_SERIAL_PL2303_MODULE)
         /* 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 (((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) {
                         /* check out the endpoints of the other interface*/
                         interface = &dev->actconfig->interface[ifnum ^ 1];
                         iface_desc = &interface->altsetting[0];
@@ -1201,6 +1201,15 @@
                                 }
                         }
                 }
+
+ /* 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
Only in linux-2.4.20-pre10-bkn4/drivers/usb/serial: usbserial.c~
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Tue Oct 15 2002 - 22:00:44 EST