Stop device switching ttyusb*

Hi everyone

Im trying to assign

ttyusb1 to my ping device

And

ttyUSB0 to U-Blox AG u-blox GNSS receiver # I no the CH370 channel is on a different port on my PC

I’m using this process which is not working

Can anyone help?

I believe this can help other people on raspberry pi because with multiple devices they can switch tty’s and make your code useless

Thanks

Chris

$ lsusb
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 029: ID 1a86:7523 QinHeng Electronics CH340 serial converter
Bus 001 Device 028: ID 1546:01a9 U-Blox AG u-blox GNSS receiver
Bus 001 Device 027: ID 0424:2512 Microchip Technology, Inc. (formerly SMSC) USB 2.0 Hub
Bus 001 Device 030: ID 0403:6015 Future Technology Devices International, Ltd Bridge(I2C/SPI/UART/FIFO)
Bus 001 Device 002: ID 2109:3431 VIA Labs, Inc. Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
$ cd /etc/udev/rules.d/
$ ls
99-com.rules 99-usb-serial.rules
$ sudo nano 99-com.rules
#add to rules at top
SUBSYSTEM=="tty", ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6015", SYMLINK+="ttyusb1"
SUBSYSTEM=="tty", ATTRS{idVendor}=="1546", ATTRS{idProduct}=="01a9", SYMLINK+="ttyusb0"
$ sudo udevadm control --reload-rules
$ cd -

Hi @cmhopper88, welcome to the forum :slight_smile:

This question is outside what I’m familiar with, but this Raspberry Pi forum topic seems similar to what you’re trying to do, so it may be worth referring to the advice there.

I will also pass this question on internally in case someone else has additional advice for you.

------tried this and did not work-------
sudo nano /etc/udev/rules.d/99-com.rules

SUBSYSTEM==“tty”, ATTRS{idVendor}==“0403”, ATTRS{idProduct}==“6015”, ATTRS{serial}==“DP05Y5V8”, SYMLINK+=“pingusb”, MODE=“0666”

sudo udevadm control --reload-rules

sudo udevadm trigger

#comes up on $ ls /dev/

Error reading Ping data: Failed to open the given serial port: [Errno 16] could not open port /dev/pingusb: [Errno 16] Device or resource busy: ‘/dev/pingusb’

Opening /dev/pingusb at 115200 bps

------Also tried in sudo nano /etc/udev/rules.d/99-serial.rules but doesnt show up on ls /dev/-----

I’m more concerned about the ping switching TTYUSB* then the gps

Saw that my mode is wrong so tried this

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

SUBSYSTEM==“tty”, ATTRS{serial}==“DP05Y5V8”, SYMLINK+=“pingusb2”, MODE=“0660”, OWNER=“root”, GROUP=“dialout”

sudo udevadm control --reload-rules

sudo udevadm trigger

ls -l /dev/pingusb2
lrwxrwxrwx 1 root root 7 May 30 00:29 /dev/pingusb2 → ttyUSB0

I believe this is where the bug is because it should be
crw-rw---- 1 root dialout 188,

I have fixed the issue. Will update on what I believe is the fix

1 Like