Assigning an unique name to USB CDC device in /dev

Srinivas Ganji srinivasganji.kernel at gmail.com
Wed Mar 5 08:32:27 EST 2014


Hi Bjorn,

Yes. It was a TYPO. It should be ttyACM0, but not ttyAMC0. After changing
to ttyACM0, it is working fine without any issues. Thanks.

As you said, yes, if we assign ttyACM*, then it works fine even if we
insert our device later, after inserting other ttyACM devices, also. If we
do not use * then it won't work if we insert our device after inserting
other ttyACM devices.

My issue was resolved by changing the KERNEL=="ttyACM0" instead of
KERNEL=="ttyAMC0". This is a simple TYPO and my overlooking while reading
the rules.

Anyhow, I have changed the rule as shown below.

KERNEL=="ttyACM*", SUBSYSTEM=="tty", ATTRS{serial}=="__0X00124B000148CC78",
SYMLINK+="mydev"

Then, all issues were resolved. It works fine irrespective of the device
insertion, too.

Thank you all.

Regards,
Srinivas.




On Wed, Mar 5, 2014 at 4:29 PM, Bjørn Mork <bjorn at mork.no> wrote:

> 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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20140305/dddc33dd/attachment.html 


More information about the Kernelnewbies mailing list