# Stop device switching ttyusb\*

**URL:** https://discuss.bluerobotics.com/t/stop-device-switching-ttyusb/16993
**Category:** General Discussion
**Tags:** ping, raspberry
**Created:** [May 29, 2024, 2:32am UTC](https://discuss.bluerobotics.com/t/stop-device-switching-ttyusb/16993 "2024-05-29T02:32:29Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![cmhopper88](https://avatars.discourse-cdn.com/v4/letter/c/2acd7d/32.png) [@cmhopper88](https://discuss.bluerobotics.com/u/cmhopper88)
#### Post date: [May 29, 2024, 2:32am UTC](https://discuss.bluerobotics.com/t/stop-device-switching-ttyusb/16993/1 "2024-05-29T02:32:29Z")

</div>

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

```auto
$ 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 -

```

---

<div class="post-metadata">

### Author: ![EliotBR](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.bluerobotics.com/eliotbr/32/6937_2.png) [@EliotBR](https://discuss.bluerobotics.com/u/EliotBR)
#### Post date: [May 29, 2024, 11:51am UTC](https://discuss.bluerobotics.com/t/stop-device-switching-ttyusb/16993/2 "2024-05-29T11:51:04Z")

</div>

Hi @cmhopper88, welcome to the forum 🙂

This question is outside what I’m familiar with, but [this Raspberry Pi forum topic](https://forums.raspberrypi.com/viewtopic.php?t=157930#p1036696) 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.

---

<div class="post-metadata">

### Author: ![cmhopper88](https://avatars.discourse-cdn.com/v4/letter/c/2acd7d/32.png) [@cmhopper88](https://discuss.bluerobotics.com/u/cmhopper88)
#### Post date: [May 29, 2024, 12:48pm UTC](https://discuss.bluerobotics.com/t/stop-device-switching-ttyusb/16993/3 "2024-05-29T12:48:36Z")

</div>

------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/-----

---

<div class="post-metadata">

### Author: ![cmhopper88](https://avatars.discourse-cdn.com/v4/letter/c/2acd7d/32.png) [@cmhopper88](https://discuss.bluerobotics.com/u/cmhopper88)
#### Post date: [May 29, 2024, 12:50pm UTC](https://discuss.bluerobotics.com/t/stop-device-switching-ttyusb/16993/4 "2024-05-29T12:50:54Z")

</div>

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

---

<div class="post-metadata">

### Author: ![cmhopper88](https://avatars.discourse-cdn.com/v4/letter/c/2acd7d/32.png) [@cmhopper88](https://discuss.bluerobotics.com/u/cmhopper88)
#### Post date: [May 29, 2024, 3:03pm UTC](https://discuss.bluerobotics.com/t/stop-device-switching-ttyusb/16993/5 "2024-05-29T15:03:20Z")

</div>

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,

---

<div class="post-metadata">

### Author: ![cmhopper88](https://avatars.discourse-cdn.com/v4/letter/c/2acd7d/32.png) [@cmhopper88](https://discuss.bluerobotics.com/u/cmhopper88)
#### Post date: [May 30, 2024, 5:11am UTC](https://discuss.bluerobotics.com/t/stop-device-switching-ttyusb/16993/6 "2024-05-30T05:11:13Z")

</div>

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