On 12/04/2008 08:53:46 PM, Kay Sievers wrote:
On Thu, Dec 4, 2008 at 20:11, Greg KH <greg@xxxxxxxxx> wrote:
Yeah, that's intentional for by-id/, it should be independent of the order of plug-in and the physical location it is plugged in, so the usual case where you have only one device, or devices with proper serial numbers, you always find it with exactly the same link name.
> $ tree /dev/serial/ > /dev/serial/ > |-- by-id > | |-- usb-Inside_Out_Networks_Edgeport_8_V12124599-if00-port0 -> ../../ttyUSB8
Why is it that the symlink is a single name, and not a path? On the one hand it's probably because that's the way other parts of udev work, which is a good reason to leave the design well enough alone. But I'm drawn to having a path like: /dev/serial/by-id/usb/Inside_Out_Networks/Edgeport_8/V12124559/if00/port0 The last component would be the actual symlink. It makes the name painless to parse and is just as easy to type. To parse the one-big-name approach, in the general case, you'd have to be sure that - does not appear in the strings supplied by the device. (The answer's probably obvious to someone who's read the udev manual, but still....) Come to think of it even better would be (shamelessly adding a new "kind" of tree): /dev/serial/by-label/bus.usb/make.Inside_Out_Networks/model.Edgeport_8/serial.V12124559/iface.if00/port.port0 What's nice here is that if a component is missing it still can have an element in the tree. If you wanted to omit missing elements, if there was a missing serial number for instance, then it'd be more basename friendly to put the labels into the directory components as suffixes, like: /dev/serial/by-label/usb.bug/Inside_Out_Networks.make/Edgeport_8.model/V12124559.serial/if00.iface/port0.port Maybe this info is exposed elsewhere. This is from the perspective of someone who always winds up going in circles when rooting through /sys/. Karl <kop@xxxxxxxx> Free Software: "You don't pay back, you pay forward." -- Robert A. Heinlein -- To unsubscribe from this list: send the line "unsubscribe linux-hotplug" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html