Asign mulitple Reach RS+ to a predefined tty number

Hi everybody

For a robot project I need to connect two RS+ to a Linux PC. The devices are connected through USB (output type: serial). I need to assign a deterministic device name (ttyACM0 and ttyACM1) to each of the RS+, since I need to know from which one the position information is coming.

Without any specific udev rules, Linux is assigning /dev/ttyACM0 to the first and /def/ttyACM1 to the second RS+ which is connected (or started). Therefore I am looking for an attribute by which they can be distinguished from one another.

If I hit:
udevadm info --name=/dev/ttyACMx --attribute-walk | grep ATTRS{serial}

I get:
ATTRS{serial}==“0000:3d:00.0”
for both devices, which is not an attribute of the Reach device.

Querying the device information with:
udevadm info --name=/dev/ttyACMx --attribute-walk

there is only:
KERNEL==“ttyACM0”
SUBSYSTEM==“tty”
DRIVER==“”

returned for the device. None parent devices do not show any unique attributes

Is there any attribute by which I can identify the RS+ devices in a udev rule?
Is it possible to set such an identifier on the Reach device, e.g. a serial number?

Any help would be appreciated
(FW v2.18.1)

Hi @ivo.gaertner,

I’ll look into this and write back to you.

2 Likes

I’ve been down this road before with USB/serial adapters, and if you have 2 of the exact same kind there is no way to tell the difference between each adapter.

If you purchase adapters from two different manufacturers (and hope that the internal chip is a different make/model), well then you can differentiate between them.

Otherwise if your adapters are identical, then I believe you can differentiate by detecting which port the adapter is plugged in. The downside is if someone unplugs and plugs them into different USB ports, you would have to adjust your systemd/udev rules or plug them into the correct ports. I suppose this could be solved by labeling the ports USB-01 and USB-02 and also labeling the adapters USB-01 and USB-02.

Hi Ivo,

It seems there are indeed no unique attributes for Reach connected to PC. Unfortunately, such information as serial number is closed for users.

Have you tried the solution proposed by @bide?

Hi everybody,

sorry for the late reply, I had to spend some time on holiday :slight_smile:

Thanks to @bide, I followed your suggestion and could write an udev rule which distinguishes the usb ports. Alongside, I check for the available attributes specific to the RS+ device, so no other device is mapped to my chosen tty number. All the attributes are taken from the second parent device. The rules I am using are:

ACTION==“add”
, KERNELS==“1-3”
, SUBSYSTEMS==“usb”
, DRIVERS==“usb”
, ATTRS{idProduct}==“0010”
, ATTRS{idVendor}==“3032”
, ATTRS{manufacturer}==“Emlid”
, ATTRS{product}==“Reach+”
, SYMLINK+=“ttyACM10”

ACTION==“add”
, KERNELS==“1-1”
, SUBSYSTEMS==“usb”
, DRIVERS==“usb”
, ATTRS{idProduct}==“0010”
, ATTRS{idVendor}==“3032”
, ATTRS{manufacturer}==“Emlid”
, ATTRS{product}==“Reach+”
, SYMLINK+=“ttyACM11”

ACTION==“remove”
, KERNELS==“1-3”
, SUBSYSTEMS==“usb”
, DRIVERS==“usb”
, ATTRS{idProduct}==“0010”
, ATTRS{idVendor}==“3032”
, ATTRS{manufacturer}==“Emlid”
, ATTRS{product}==“Reach+”
, SYMLINK-=“ttyACM10”

ACTION==“remove”
, KERNELS==“1-1”
, SUBSYSTEMS==“usb”
, DRIVERS==“usb”
, ATTRS{idProduct}==“0010”
, ATTRS{idVendor}==“3032”
, ATTRS{manufacturer}==“Emlid”
, ATTRS{product}==“Reach+”
, SYMLINK-=“ttyACM11”

On my laptop it works like a charm. I will have to adapt it to the USB port number of our industrial PC, but I do not see a reason why it should not work.

The attribute KERNELS is referring to the USB port number. On other PC’s this has to be adapted accordingly.

I used the symlinks ttyACM10 and ttyACM11 which can be changed to what ever one prefers of cause.

1 Like

This topic was automatically closed 100 days after the last reply. New replies are no longer allowed.