I have a usb modem that creates several ttyACM connections when plugged in. I have made a udev rule to create a symlink to the ttyACM file, however I don't know how to tell which tty file it will link to.

Here is my rule:

SUBSYSTEM=="tty", ATTRS{idVendor}=="1bc7", ATTRS{idProduct}=="0021", SYMLINK="cellmodem0", MODE="0666"

Here is the current output of ls -l /dev

lrwxrwxrwx  1 root   root           7 Feb 11 12:35 cellmodem0 -> ttyACM3

I expect this to be pointing to ttyACM0 not ACM3, as ACM0 is the modem's primary port as shown by the following mmcli output:

System   |         device: '/sys/devices/3530000.xhci/usb1/1-1/1-1.1'
         |        drivers: 'cdc_acm'
         |         plugin: 'Telit'
         |   primary port: 'ttyACM0'
         |          ports: 'ttyACM3 (at), ttyACM0 (at)'

TL;DR: How do you deal with udev rules on devices that use multiple ttyACM ports?


Finally figured it out. Using udevadm info /dev/<relevent port> you are able to see the path of the device. For me it was: /devices/3530000.xhci/usb1/1-1/1-1.1/1-1.1:1.0/tty/ttyACM0 for ttyACM0, the port I actually want to map to. This path would be mostly the same for all the ports created except the index in ttyACMx and 1-1.1:1.x will be different. For my device the primary port will always us x = 0 for 1-1.1:1.x.

So, I added a statement to the udev rule: DEVPATH=="/devices/3530000.xhci/usb1/1-1/1-1.*/1-1.*:1.0/tty/ttyACM*". Only the primary port would statisfy this criteria because I listed 1-1.*:1.0.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.