[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Stic device naming with udev, help please



On Thu, Nov 13, 2008 at 12:12:08 -0600, Nate Bargmann wrote:
> Hopefully there is a udev guru on board.
> 
> I have two USB to RS232 dongles that seem to get their names swapped
> with every system restart (not often, but enough to make me search for
> a solution).  Both devices are the same and ID the same to lsusb:
> 
> Bus 008 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
> Bus 005 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
> Bus 007 Device 005: ID 067b:2303 Prolific Technology, Inc. PL2303 Serial Port
> Bus 007 Device 004: ID 051d:0002 American Power Conversion Uninterruptible Power Supply
> Bus 007 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
> Bus 006 Device 003: ID 067b:2303 Prolific Technology, Inc. PL2303 Serial Port
> Bus 006 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
> Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
> Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
> Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
> Bus 001 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
> 
> Since the vendor and device ID are identical, 067b:2303, is there a way
> to tell udev that the dongle on Bus 006 Device 003 should be ttyUSB0
> and the other on Bus 007 Device 005 should be ttyUSB1?  If so, I've not
> found the docs that describe this.

Try

udevinfo -a --name=/dev/usb/ttyUSB0 
udevinfo -a --name=/dev/usb/ttyUSB1 

These commands list all known attributes of the devices and of their
parent devices. The parent devices will have attributes which allow to
identify each dongle (for example ATTRS{busnum} and ATTRS{devnum} in the
usb subsystem). You can write a udev rule with the properties of a
device itself combined the properties of (only) one parent device: 

file:///usr/share/doc/udev/writing_udev_rules/index.html#udevinfo

This should make it possible to find a combination of device and parent
attributes that is unique for each dongle.

It may even be the case that the devices themselves have properties that
can be used to distinguish them without having to refer to parent
devices, for example unique serial numbers.

-- 
Regards,            | http://users.icfo.es/Florian.Kulzer
          Florian   |


Reply to: