I have a couple of USB devices connected to my computer:
- An FT232 based USB-UART converter : Used to send and receive data between a microcontroller and the computer using the Serial protocol.
- A YDLidar TG15 : Used for mapping the environment. Product Page
I am running Lubuntu 22.04 LTS on a NUC.
I want to be able to assign the FT232-based device to dev/ttyUSB0 , and the YDLidar, which uses a cp210x serial converter, to dev/ttyUSB1 every time the computer boots up. The configuration I want is shown below:
$ sudo dmesg | grep tty [ 0.095479] printk: console [tty0] enabled [ 6.046918] usb 1-3: FTDI USB Serial Device converter now attached to ttyUSB0 [ 57.282034] usb 1-4: cp210x converter now attached to ttyUSB1 I was able to follow some resources online such as this one, this one, and this one, which helped me to write a custom rule for my use-case, presented below.
$ cat /etc/udev/rules.d/34-usb-serial.rules # Assign FTDI chips to /dev/ttyFTDI SUBSYSTEM=="tty", ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6001", SYMLINK="ttyUSB0" # Assign Silicon Labs UART converters to /dev/ttyUSB1 SUBSYSTEM=="tty", ATTRS{idVendor}=="10c4", ATTRS{idProduct}=="ea60", SYMLINK="ttyUSB1" Problem:
- Even after triggering
udevadmto reload the rules, it does not change the addresses after boot-up. I use
sudo udevadm control --reload-rules sudo udevadm trigger to reload the rules. This should load the rules, or complain if it cannot, right? However, when this substitution does not work, it does not throw any errors. It simply assigns the cp210x device as ttyUSB0 and the FTDI device as ttyUSB1. I can only know this when I do the sudo dmesg | grep tty once again.
- How do I use the udev rule that I wrote to properly assign these devices their appropriate IDs at boot-time?
P.S.: If there is any ambiguity about what is seen as "proper" in this context, I just want something that works in a robust fashion, while adhering as closely as possible to the "best practices" that are followed in editing these files.
Thanks in advance!