Using udev-extras for hardware-specific quirks?
Martin Pitt
martin.pitt at ubuntu.com
Wed Jun 3 06:39:22 PDT 2009
Hello Dan,
Dan Streetman [2009-06-01 12:13 -0400]:
> I am creating udev rules for some system units I'm responsible for
> enabling Linux on; specifically these systems have multiple serial
> ports with labels on the ports like "A", "B", "C", etc. However on
> many of the units the hardware doesn't match the labelling so ports
> "C" and above usually do not match the right serial node, i.e. while a
> port labeled "C" should be /dev/ttyS2 it isn't.
This is just a general property of current Linux, which is pretty much
fully "hotplug" based. You cant't rely at all on any particular device
ordering in general. Distributions special-case some device classes
such as network devices where (for historical reasons) eth0 must
always be the same device. E. g. Ubuntu's installer creates a file
/etc/udev/rules.d/70-persistent-net.rules which looks like
# PCI device 0x14e4:0x1600 (tg3)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:1c:23:14:1c:2a", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"
You can apply a similar "persistent naming" rule on your system.
> Anyway, my question is, is udev-extras the appropriate place for this
> to live?
I'm afraid not. Programs need to be fixed to not rely on a particular
device name instead.
> DEVPATH=="/devices/pci0000:00/0000:00:13.1/0000:04:0b.1/tty/ttyS2", NAME="ttyS6"
This really looks wrong. Since the initial naming isn't stable, the
mapping isn't either. You need to identify a particular device on
stable properties such as device names, serial numbers, or other
constant properties.
Martin
--
Martin Pitt | http://www.piware.de
Ubuntu Developer (www.ubuntu.com) | Debian Developer (www.debian.org)
More information about the devkit-devel
mailing list