U
U
User15822019-09-24 16:10:16
linux
User1582, 2019-09-24 16:10:16

How to bind physical USB ports to Linux ports in Raspberry Pi?

Good afternoon!
Can you please tell me if it is possible to bind certain physical ports ( Picture with the port numbers on the board ) on the Raspberry Pi 3 board to ports inside the operating system.
For example, so that the internal ttyUSB0 is always associated with the device included in USB #1, ttyUSB1 <-> USB #2, etc.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Andrey Barbolin, 2019-09-24
@dronmaxman

For this, udev is used. This is just an example of how you can implement it, udev has a lot of options to solve your problem.
cat /etc/udev/rules.d/92-dongle.rules
KERNEL=="ttyUSB* - device filter
KERNELS=="3-1:1.0 USB port number
can be viewed in dmesg after connecting the device

# dmesg | grep stor
[42004.660118] usb-storage 3-1:1.0: USB Mass Storage device detected
[42004.660853] scsi7 : usb-storage 3-1:1.0

SYMLINK+="SMS-data0" - symlink to the port
As a result, all ttyUSB devices that connect to this port will always receive the same symlink SMS-data0, which can already be referred to in programs.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question