Persistent names for usb-serial devices
Q: Is there a way in Linux to fix the
/dev/ttyUSBx assignment for a specific FT232 ? When I
have more than one plugged into a system, the /dev/ttyUSBx
assignments get shuffled and this breaks scripts that I
have written.
Fix
ttyUSB0 to ttyCOM1
1. Every USB device
has a Vendor ID and
a Product ID as
seen for instance in lsusb
output:
2. find serial number for each USB serial Port
udevadm info -a -n /dev/ttyUSB0 |
grep '{serial}' | head -n1
3. find other USB device information use
udevadm info --name=/dev/ttyUSB0
--attribute-walk
4. make udev rules
inside the /etc/udev/rules.d make file
99-usb-serial.rules
SUBSYSTEM=="tty",ATTRS{idVendor}=="0403",
ATTRS{idProduct}=="6001", ATTRS{serial}=="A504W0XN",
SYMLINK+="ttyCOM1"
SUBSYSTEM=="tty",ATTRS{idVendor}=="0403",
ATTRS{idProduct}=="6001", ATTRS{serial}=="A504W0XQ",
SYMLINK+="ttyCOM2"
SUBSYSTEM=="tty",ATTRS{idVendor}=="0403",
ATTRS{idProduct}=="6001", ATTRS{serial}=="A504W0XO",
SYMLINK+="ttyCOM3"
SUBSYSTEM=="tty",ATTRS{idVendor}=="0403",
ATTRS{idProduct}=="6001", ATTRS{serial}=="A504W0XP",
SYMLINK+="ttyCOM4"
5 .reboot & check system
use command ls
/dev you will see ttyCOMx
& ttyUSBx
6. use command ls -l
/dev/ttyCOM1 check
*** 4x USB UART/8x USB UART
application
Setting Serial Console Server with
ser2net
1. search USB port in your system
dmesg | grep tty
2.install ser2net software
sudo apt-get install ser2net -y
3. Configuration
sudo nano /etc/ser2net.conf
make ser2net.conf to telnet from other Pi or PC
BANNER:banner:\r\nser2net port \p device \d [\s] (Debian
GNU/Linux)\r\n\r\n
2000:telnet:600:/dev/ttyCOM1:9600 8DATABITS NONE
1STOPBIT banner
2001:telnet:600:/dev/ttyCOM2:9600 8DATABITS NONE
1STOPBIT banner
3000:telnet:600:/dev/ttyCOM3:9600 8DATABITS NONE
1STOPBIT banner
3001:telnet:600:/dev/ttyCOM4:9600 8DATABITS NONE
1STOPBIT banner
4 from another Pi use telnet to the serial port
install telnet use command
sudo apt-get install telent
Host Name
telnet ?
usage: telnet [-l user] [-a] host-name [port]
telnet pi4-4p.local 3000
Download
udev.sh
- collect 4 USB serial number and save
file for udev rules
udev8.sh
- collect 8 USB serial number and
save file for udev rules
p4-send-order.py
- send 4 port in order to make sure
ttyUSB0, ttyUSB1...ttyUSB3
p4-u8-send-order.py
-
send 8 port in order to make sure
ttyUSB0,ttyUSB1....ttyUSB7
VIDEO
Green LED ON in order
TXD,TXD2,TXD3,TXD4 to make sure
ttyUSB0,ttyUSB1..ttyUSB3 in correct order.