Assigning an unique name to USB CDC device in /dev
Bjørn Mork
bjorn at mork.no
Wed Mar 5 05:59:30 EST 2014
Srinivas Ganji <srinivasganji.kernel at gmail.com> writes:
> I have created a file, named 11-ttyACM.rules, under /etc/udev/rules.d
> directory. The contents of the file as follows.
> KERNEL=="ttyAMC0", SUBSYSTEM=="tty", ATTRS{serial}=="__0X00124B000148CC78",
> SYMLINK+="mydev"
So this rule will create a symlink from /dev/mydev -> /dev/ttyAMC0 if
all these conditions are met:
a) KERNEL=="ttyAMC0"
b) SUBSYSTEM=="tty"
c) ATTRS{serial}=="__0X00124B000148CC78"
I believe the a) condition is not exactly what you want. Firstly, the
spelling makes it likely to never match...
Secondly, even if you correct it to ACM, you really want this rule to
match regardless of which ttyACMx device is assigned. That way you can
ignore the device name and use the static /dev/mydev symlink.
So you'd want to do something like this instead:
KERNEL=="ttyACM*", SUBSYSTEM=="tty", ATTRS{serial}=="__0X00124B000148CC78", SYMLINK+="mydev"
> I got the above information from the following command
> udevadm info -q all -n /dev/ttyACM0 --attribute-walk
>
> This is what I did. But, no luck. If I insert a different serial numbered
> device, then it is assigning ttyACM0 to that device.
Yes. There is nothing in the rule controlling which name the kernel
assigns. You cannot change this in any case. It's already decided at
the point where the udev rule runs.
Bjørn
More information about the Kernelnewbies
mailing list