LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Debian
User Name
Password
Debian This forum is for the discussion of Debian Linux.

Notices



Reply
 
Search this Thread
Old 03-06-2012, 09:56 AM   #1
zkab
Member
 
Registered: Dec 2007
Posts: 113

Rep: Reputation: 15
Naming problem with udev


I am trying to link symbolic names to 2 USB devices with udev as follows:

ad_teknik_reader -> /dev/ttyUSB0
smart_ups -> /dev/ttyUSB1

sudo udevadm info --name=/dev/ttyUSB0 --attribute-walk gives:

looking at parent device '/devices/pci0000:00/0000:00:1a.0/usb2/2-1/2-1.6/2-1.6:1.0/ttyUSB0':
KERNELS=="ttyUSB0"
SUBSYSTEMS=="usb-serial"
DRIVERS=="pl2303"
ATTRS{port_number}=="0"

sudo udevadm info --name=/dev/ttyUSB1 --attribute-walk gives:

looking at parent device '/devices/pci0000:00/0000:00:1a.0/usb2/2-1/2-1.5/2-1.5:1.0/ttyUSB1':
KERNELS=="ttyUSB1"
SUBSYSTEMS=="usb-serial"
DRIVERS=="ftdi_sio"
ATTRS{latency_timer}=="1"
ATTRS{port_number}=="0"

My /etc/udev/rules.d/10-udev.rules looks like:

KERNELS=="ttyUSB0" , SUBSYSTEMS=="usb-serial" , DRIVERS=="ftdi_sio" , SYMLINK+="ad_teknik_reader"
KERNELS=="ttyUSB1" , SUBSYSTEMS=="usb-serial" , DRIVERS=="pl2303" , SYMLINK+="smart_ups"

But I can't get it working.
Sometime I get it right like:

lrwxrwxrwx 1 root root 7 6 mar 15.08 /dev/ad_teknik_reader -> ttyUSB0

after reboot but very often I just get /dev/ad_teknik_reader not pointing at ttyUSB0.

When I delete /dev/ad_teknik_reader and reboot I can get it right but not always ... it is frustrating to reboot since it is also a server.
I have Debian 2.6.32-5-amd64 (server).
 
Old 03-08-2012, 12:43 AM   #2
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Servers: Debian Squeeze and Wheezy. Desktop: Slackware64 14.0. Netbook: Slackware 13.37
Posts: 8,563
Blog Entries: 29

Rep: Reputation: 1179Reputation: 1179Reputation: 1179Reputation: 1179Reputation: 1179Reputation: 1179Reputation: 1179Reputation: 1179Reputation: 1179
Strange that it should not behave the same way on every reboot. Is there a pattern to that, like it's OK every other reboot.

You could try changing SYMLINK+="ad_teknik_reader" to SYMLINK="ad_teknik_reader"

EDIT: can you avoid the need to reboot by using udevadm control --reload-rules and re-plugging the hardware or, for a more complete re-initialisation, run /etc/init.d/udev restart or whatever the equivalent is on your distro.

Last edited by catkin; 03-08-2012 at 12:49 AM.
 
Old 03-08-2012, 04:25 AM   #3
zkab
Member
 
Registered: Dec 2007
Posts: 113

Original Poster
Rep: Reputation: 15
Thanks for your input.
I solved the problem, the rule should be like this:

KERNEL=="ttyUSB[0-1]" , SUBSYSTEMS=="usb-serial" , DRIVERS=="ftdi_sio" , NAME="ad_teknik_reader"
KERNEL=="ttyUSB[0-1]" , SUBSYSTEMS=="usb-serial" , DRIVERS=="pl2303" , NAME="smart_ups"

since /dev/ttyUSB0 and /dev/ttyUSB1 depend on where they are plugged in ...
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Help on naming iscsi devices with udev TheR_ Linux - Server 1 09-09-2009 08:46 AM
Hotswap and udev persisten naming Thure Linux - Server 3 01-26-2009 07:41 AM
Changing UDEV persistent naming schemes orbit Slackware 5 04-21-2008 10:22 PM
Is there a way to have grub translate its own naming to naming scheme under Linux zhjim Linux - Software 6 05-28-2006 09:09 AM
mail server the naming naming convention problem kashan Linux - Newbie 0 07-16-2004 03:08 PM


All times are GMT -5. The time now is 04:07 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration