[RFC] raise the maximum number of usb-serial devices to 512

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

I did a bit more fiddling with the usb-serial stack and got it to
support more than 256 devices. I tested it with up to 281 FTDI
singleport adapters. (After that i ran out of usb cables.. )

Signed-off-by: Jakob-Tobias Winter <tobias@xxxxxxxxxxxxxxx>
---
 include/linux/usb/serial.h |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/include/linux/usb/serial.h b/include/linux/usb/serial.h
index 302ddf5..ab5e01b 100644
--- a/include/linux/usb/serial.h
+++ b/include/linux/usb/serial.h
@@ -20,7 +20,7 @@
 #include <linux/kfifo.h>

 #define SERIAL_TTY_MAJOR       188     /* Nice legal number now */
-#define SERIAL_TTY_MINORS      254     /* loads of devices :) */
+#define SERIAL_TTY_MINORS      512     /* loads of devices :) */
 #define SERIAL_TTY_NO_MINOR    255     /* No minor was assigned */

 /* The maximum number of ports one device can grab at once */
@@ -80,7 +80,7 @@ struct usb_serial_port {
        struct usb_serial       *serial;
        struct tty_port         port;
        spinlock_t              lock;
-       unsigned char           number;
+       unsigned short          number;

        unsigned char           *interrupt_in_buffer;
        struct urb              *interrupt_in_urb;
@@ -159,7 +159,7 @@ struct usb_serial {
        unsigned char                   disconnected:1;
        unsigned char                   suspending:1;
        unsigned char                   attached:1;
-       unsigned char                   minor;
+       unsigned short                  minor;
        unsigned char                   num_ports;
        unsigned char                   num_port_pointers;
        char                            num_interrupt_in;
-- 
1.7.10.4


To avoid possible regressions, I also modified a few drivers:

Signed-off-by: Jakob-Tobias Winter <tobias@xxxxxxxxxxxxxxx>
---
 drivers/usb/serial/io_edgeport.c |    2 +-
 drivers/usb/serial/mos7720.c     |    2 +-
 drivers/usb/serial/mos7840.c     |    2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/usb/serial/io_edgeport.c
b/drivers/usb/serial/io_edgeport.c
index 1477e85..eac8641 100644
--- a/drivers/usb/serial/io_edgeport.c
+++ b/drivers/usb/serial/io_edgeport.c
@@ -2266,7 +2266,7 @@ static int send_cmd_write_baud_rate(struct
edgeport_port *edge_port,
        int cmdLen = 0;
        int divisor;
        int status;
-       unsigned char number =
+       unsigned short number =
                edge_port->port->number - edge_port->port->serial->minor;

        if (edge_serial->is_epic &&
diff --git a/drivers/usb/serial/mos7720.c b/drivers/usb/serial/mos7720.c
index cc0e543..81cbc84 100644
--- a/drivers/usb/serial/mos7720.c
+++ b/drivers/usb/serial/mos7720.c
@@ -1468,7 +1468,7 @@ static int send_cmd_write_baud_rate(struct
moschip_port *mos7720_port,
        struct usb_serial *serial;
        int divisor;
        int status;
-       unsigned char number;
+       unsigned short number;

        if (mos7720_port == NULL)
                return -1;
diff --git a/drivers/usb/serial/mos7840.c b/drivers/usb/serial/mos7840.c
index a0d5ea5..2d62efb 100644
--- a/drivers/usb/serial/mos7840.c
+++ b/drivers/usb/serial/mos7840.c
@@ -1718,7 +1718,7 @@ static int mos7840_send_cmd_write_baud_rate(struct
moschip_port *mos7840_port,
        int divisor = 0;
        int status;
        __u16 Data;
-       unsigned char number;
+       unsigned short number;
        __u16 clk_sel_val;
        struct usb_serial_port *port;

-- 
1.7.10.4

But since I don't have those types of hardware, I can't test it. Also
I'm not sure if I took everything that can break into account as I don't
have any kernel coding experience.

To whom it may concern, here is the kern.log
http://linuxdingsda.de/~wintix/kern.log

and again the output of `lsusb | sort`, now with up to 127 devices on a
single USB root hub:

http://de.pastebin.ca/2383084

Thanks,

Tobias

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux