USB/UART problem

Hello, i have installed 2 usb/serial dongle on my navio/raspberry.

One is used for lidar and the second for external GPS.

The one on the lidar is USB0 and the one on the GPS is USB1, they are linked to serial 5 and serial 4 trough the corresponding letters when i launch arducopter.

Everything works fine but sometimes happens that the USB0 and USB1 are swapped and nothing works anymore.

Is there a way to tell linux to always give USB0 and USB1 to the same dongle?

Another little question that still puzzles me, it makes no difference wich letter is used to send data over serial as long as serial port and protocol are configured correctly for that letter/serial right?

regards,

Corrado

Hello Corrado!

Regarding your usb naming problem I may be able to help. A little while ago I faced the same problem, so let’s see wether I manage to remember.
What you want is to create an udev rule that assings a symlink “/dev/choose_a_name” to your device by a device property i.e. serial number or vendor id.
Firstly you have to check whats on your usb with dmesg | grep ttyUSB and according to what device you want to create a rule for, you want to look for an unique identifier in what udevadm info --name=/dev/ttyUSBx --attribute-walk gives you (x for device number). In my case I choose the serial number.
Go ahead and create following file /etc/udev/rules.d/99-usb-serial.rules with SUBSYSTEM=="tty", ATTRS{serial}=="123example", SYMLINK+="choose_a_name" in it. If you want to use a different device property just modify the ATTRS{} part and of course look for a better name.

Finally reboot or type sudo udevadm trigger and you should recognize your device when typing ls -l /dev/choose_a_name.

Maybe I can upload a screenshot of my udev rule tomorrow if it helps you. It’s kind of in the middle of the night here in Germany, I just came home from work and I really want to sleep now.

Regards,

finst

1 Like

Hello, thank you for your explanation.

Obviously when i start the serial i need to use /dev/my_new_name not /dev/ttyUSB0

regards,

Corrado

p.s. anything you can post it would help immensely, since i am not that skilled on linux :slight_smile:

Yeah, right. Did you try it?

Hello, will try in the afternoon and report back.

thanks again

Corrado

Just tried, it looks like i bought some cheap devices and they don’t have different serial, all serials are exactly the same on both devices. Looked at all attributes including parent.

Corrado

Well, maybe there is some other attribute you could use?

Looking for it.

thanks again,

Corrado