USB Serial Port Assignment Overview The usbserial.c driver has been enhanced with a way to explicitly assign serial ports to USB serial devices. Before this enhancement, the ports were assigned based on the order the USB serial devices were enumerated, but this changed depending on when the devices were plugged in, or how the system was booted. Devices like the EdgePort 4/s were particularly troublesome, since they are really two two port devices and these two devices were enumerated in different orders, randomly changing the port assignments of the four ports on the device. The usbserial module now has a module parameter named "reserve_ports". This is an array of strings, one for each USB serial port, beginning at /dev/ttyUSB0 and continuing on up. The string is a pattern that reserves the port for a particular device by serial number, by vendor/product id, or by device path. Syntax Initially the strings NULL for all ports, and these NULL strings leave the port available for any device. The first character of the string determines the type of the pattern: S -- serial number V -- vendor/product id D -- device path ^ -- this port is available for a multiport device that matched the previous pattern - -- this port is not available for any device * -- this port is available for any device The rest of the string is interpreted according to the first character: Serial Number The serial number is an ASCII string that is matched against the serial number reported by the device. An "*" can be used at the beginning or end of this string as a wildcard to match the beginning or ending of any serial number. Vendor/Product ID The vendor/product ids are two hex numbers separated by a ":" or "/". Either number can be replaced by a "*" as a wildcard to match any vendor or product id. The vendor and product ids should not have "0x" at the beginning. Device Path The device path is a "/" separated path of decimal integers. The first integer is the bus number, the rest are the USB port numbers of sequence of hubs leading to the device. Any integer in the path can be replaced by a "*" as a wildcard to match any port. For example, a device path like "D1/2/3" means the device attached to the 3rd port on the hub attached to the 2nd port on the virtual hub on bus 1. When a device is attached the usb subsystem prints an informational message through syslog that gives the device path--be sure syslog is logging informational messages and look for the "new device connect" message to see the path. Specifying the Module Parameters The reserve_ports module parameter can be given on the insmod or modprobe command line, or it can be given in the /etc/modules.conf file, like this add options usbserial 'reserve_ports=V1608:242,S*-0,V1608:242,S*-1' Examples The three examples that follow all assign the first four USB serial ports, /dev/ttyUSB0 through /dev/ttyUSB3, to an EdgePort 4/s. add options usbserial 'reserve_ports=SA32399053-0,^,SA32399053-1,^' This example specifies the serial number of the device. The EdgePort 4/s looks like two different devices, one with a serial number ending in "-0" for the first two ports and another with serial number ending in "-1" for the second two serial ports. add options usbserial 'reserve_ports=D1/2/*/2,D1/2/*/2,D1/2/*/1,D1/2/*/1' This example specifies the device path for an EdgePort 4s attached to any port of a hub attached to the computer's 2nd USB port. Since the EdgePort 4/s looks like two devices behind a hub, the path to the EdgePort 4/s shows one extra port; USB port 2 is used for the first two ports, and USB port 1 is used for the second two ports. add options usbserial 'reserve_ports=V1608:242,S*-0,V1608:242,S*-1' This example specifies the vendor and product id and the trailing part of the serial number. Since EdgePort 4/s looks like two two port devices, the device with the first two ports must match two entries in the reserve_ports array; in this example that means the the vendor id must be 0x1608, the product id must be 0x0242, and the serial number must end in "-0".