CM Panel technical documentation Buy

How to configure serial port adapters on the USB port

Insert one device at a time on a USB port:

$ lsusb

With the following command we will see idProduct and idVendor of each connected device.

Result:

Bus 001 Device 009: ID 0403:6001 Future Technology Devices International, Ltd FT232 Serial (UART) IC
Bus 001 Device 008: ID 067b:2303 Prolific Technology, Inc. PL2303 Serial Port
Bus 001 Device 007: ID 067b:2303 Prolific Technology, Inc. PL2303 Serial Port
Bus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp. SMSC9512/9514 Fast Ethernet Adapter
Bus 001 Device 002: ID 0424:9514 Standard Microsystems Corp. SMC9514 Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

ID 0403:6001 the first number is idVendor and the second is idProduct.

With this command you can see on which number of ports is connected:

$ lsusb -t

Result:

/:  Bus 01.Port 1: Dev 1, Class=root_hub, Driver=dwc_otg/1p, 480M
    |__ Port 1: Dev 2, If 0, Class=Hub, Driver=hub/5p, 480M
        |__ Port 1: Dev 3, If 0, Class=Vendor Specific Class, Driver=smsc95xx, 480M
        |__ Port 2: Dev 7, If 0, Class=Vendor Specific Class, Driver=pl2303, 12M

Now we want port 2 for example to become /dev/ttyS1:

$ sudo nano /etc/udev/rules.d/99-usb-serial.rules

Insert the following instruction:

# -----------------------------------------------------------------------
# Fix USB serial port
# -----------------------------------------------------------------------

# /dev/ttyS1 serial TTL
ATTRS{devpath}=="1.2", SUBSYSTEM=="tty", ATTRS{idVendor}=="067b", ATTRS{idProduct}=="2303", SYMLINK+="ttyS1", GROUP="dialout", MODE="0666"

Eventually, once the device is connected to the USB port, we will have a serial communication port called /dev/ttyS1.

If we have 2 adapters with the same idVendor and idProduct, we can fix the device on that specific USB port:

$ lsusb -t

Result:

/:  Bus 01.Port 1: Dev 1, Class=root_hub, Driver=dwc_otg/1p, 480M
    |__ Port 1: Dev 2, If 0, Class=Hub, Driver=hub/5p, 480M
        |__ Port 1: Dev 3, If 0, Class=Vendor Specific Class, Driver=smsc95xx, 480M
        |__ Port 2: Dev 7, If 0, Class=Vendor Specific Class, Driver=pl2303, 12M
        |__ Port 3: Dev 8, If 0, Class=Vendor Specific Class, Driver=pl2303, 12M
        |__ Port 4: Dev 9, If 0, Class=Vendor Specific Class, Driver=ftdi_sio, 12M

Edit file:

$ sudo nano /etc/udev/rules.d/99-usb-serial.rules

Result:

# -----------------------------------------------------------------------
# Fix USB serial port
# -----------------------------------------------------------------------

# /dev/ttyS1 serial TTL
ATTRS{devpath}=="1.2", SUBSYSTEM=="tty", ATTRS{idVendor}=="067b", ATTRS{idProduct}=="2303", SYMLINK+="ttyS1", GROUP="dialout", MODE="0666"

# /dev/ttyS2 serial TTL
ATTRS{devpath}=="1.3", SUBSYSTEM=="tty", ATTRS{idVendor}=="067b", ATTRS{idProduct}=="2303", SYMLINK+="ttyS2", GROUP="dialout", MODE="0666"

Home page CM Panel technical documentation Buy