Hi,
Here's a small patch against 2.3.99-pre6-3 that changes the place where
the usb-serial port structures get initialized. This makes it easier for
devices that have more endpoints than physical ports to use those
endpoints (there's a few people working on drivers out there that need
this change.)
Thanks a lot,
greg k-h
[EMAIL PROTECTED]
diff -Naur -X dontdiff linux-2.3.99-pre6-3/drivers/usb/serial/usbserial.c
linux-2.3.99-pre6-3-greg/drivers/usb/serial/usbserial.c
--- linux-2.3.99-pre6-3/drivers/usb/serial/usbserial.c Mon Apr 17 00:08:20 2000
+++ linux-2.3.99-pre6-3-greg/drivers/usb/serial/usbserial.c Mon Apr 17 00:06:44
+2000
@@ -211,6 +211,7 @@
#include "usb-serial.h"
+#define MAX(a,b) ((a>b)?a:b)
/* function prototypes for a "generic" type serial converter (no flow control, not
all endpoints needed) */
/* need to always compile these in, as some of the other devices use these functions
as their own. */
@@ -424,14 +425,9 @@
return -ENODEV;
}
- /* set up our port structure */
+ /* set up our port structure makeing the tty driver remember our port object,
+and us it */
portNumber = MINOR(tty->device) - serial->minor;
port = &serial->port[portNumber];
- port->number = portNumber;
- port->serial = serial;
- port->magic = USB_SERIAL_PORT_MAGIC;
-
- /* make the tty driver remember our port object, and us it */
tty->driver_data = port;
port->tty = tty;
@@ -996,6 +992,7 @@
int num_bulk_in = 0;
int num_bulk_out = 0;
int num_ports;
+ int max_endpoints;
/* loop through our list of known serial converters, and see if this
device matches. */
@@ -1177,7 +1174,17 @@
endpoint->bInterval);
}
-
+ /* initialize some parts of the port structures */
+ /* we don't use num_ports here cauz some devices have more endpoint pairs than
+ports */
+ max_endpoints = MAX(num_bulk_in, num_bulk_out);
+ max_endpoints = MAX(max_endpoints, num_interrupt_in);
+ for (i = 0; i < max_endpoints; ++i) {
+ port = &serial->port[i];
+ port->number = i;
+ port->serial = serial;
+ port->magic = USB_SERIAL_PORT_MAGIC;
+ }
+
for (i = 0; i < serial->num_ports; ++i) {
info("%s converter now attached to ttyUSB%d",
type->name, serial->minor + i);
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]