Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I have an arduino which sometimes gets bound to /dev/ttyUSB0 and other times to /dev/ttyUSB1 making my script fail.

I do not want to enumerate all the possibilities of where my device could be, but I rather have it be bound somewhere static, e.g. /dev/arduinio.

How do I achieve that?

share|improve this question
3  
Just write a simple udev-rule which will assign symlink /dev/arduino to right devise by its VID & PID. –  Eddy_Em Mar 5 '13 at 8:00
    
Check arch-wiki: wiki.archlinux.org/index.php/Udev#Writing_udev_rules –  uzsolt Mar 5 '13 at 10:01
1  
After you've changed the rules, see How to reload udev rules without reboot? –  Gilles Mar 5 '13 at 22:00

1 Answer 1

up vote 5 down vote accepted

As suggested, you can add some udev rules. I edited the /etc/udev/rules.d/10-local.rules to contain:

ACTION=="add", ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6001", SYMLINK+="my_uart"

You can check for the variables of your device by running

udevadm info -a -p  $(udevadm info -q path -n /dev/ttyUSB0)

There is a more in depth guide you can read on http://www.reactivated.net/writing_udev_rules.html

share|improve this answer
    
Worked like a charm. One question: How to exit udevam? And it is important to note that my_uart creates the symlink under /dev/my_uart. I first wrote /dev/arduino the first time and it failed whilst arduino is sufficient. –  k0pernikus Mar 7 '13 at 19:11
    
udevadm should exit by itself when it's done. –  Kotte Mar 8 '13 at 7:31
    
Then for some unknown reason it froze the terminal session to my Raspberry Pi while generating the report. –  k0pernikus Mar 8 '13 at 12:19

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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