Assigning an unique name to USB CDC device in /dev

Srinivas Ganji srinivasganji.kernel at gmail.com
Wed Mar 5 01:48:24 EST 2014


Dear All,

We have a USB CDC device which we are connecting it to the Ubuntu system.
Then, we are accessing the device using an application by opening the
device with /dev/ttyACM0 node. The system may have multiple USB CDC devices
already connected before connecting my device, sometimes. In such cases, my
application fails to open the device, because, this time the assigned node
is other than /dev/ttyAMC0, but in my application the device node is
/dev/ttyAMC0 only. Due to these reasons, I want to assign my own device
node in the /dev directory like /dev/mydev. This will enable my application
to identify my device very easily.

The requirement is same as described in the link -
http://marc.info/?l=linux-usb&m=130216901901572&w=2
The answer is available at
http://marc.info/?l=linux-usb&m=130217684009490&w=2

I have tried in different ways as I have also looked at the following
sources. But, still, there is NO luck. When I insert another USB CDC
device, it got /dev/ttyACM0 instead of getting ttyACM1.
http://www.reactivated.net/writing_udev_rules.html
https://www.kernel.org/pub/linux/utils/kernel/hotplug/udev/udev.html
http://unix.stackexchange.com/questions/77476/point-usb-phone-to-specific-dev-ttyacm-using-udev
https://www.pjrc.com/teensy/49-teensy.rules

The kernel version and distribution details are as follows.
Kernel Version --- 3.5.0-17-generic
Distribution details are as follows.
RELEASE=14
CODENAME=nadia
EDITION="MATE 64-bit"
DESCRIPTION="Linux Mint 14 Nadia"

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"

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. But, after this udev
rule, it should not assign, I think.

Please someone, who already used/knows udev rules, suggest me.

Thanks.

Regards,
Srinivas.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20140305/c0092496/attachment-0001.html 


More information about the Kernelnewbies mailing list