On Fri, 14 Dec 2012 11:30:05 +0100 "Kay Sievers" <k...@vrfy.org> wrote:
> On Fri, Dec 14, 2012 at 9:11 AM, Robert Milasan <rmila...@suse.com> > wrote: > > Is there some kind of a counting mechanism which can be used in a > > udev rule? > > > > I got this rule: > > > > ACTION=="add", SUBSYSTEM=="3270", KERNEL=="tty0.0.[0-9]*", > > SYMLINK+="3270/ttycons-%n" > > > > and the result of this rule looks like this: > > > > lrwxrwxrwx 1 root root 14 Dec 13 15:28 ttycons-0500 > > -> ../tty0.0.0500 lrwxrwxrwx 1 root root 14 Dec 13 15:28 > > ttycons-0501 -> ../tty0.0.0501 lrwxrwxrwx 1 root root 14 Dec 13 > > 15:28 ttycons-0502 -> ../tty0.0.0502 lrwxrwxrwx 1 root root 14 Dec > > 13 15:28 ttycons-0503 -> ../tty0.0.0503 > > > > But I would like instead of '%n' to use a counting variable that > > would make the result look something like this: > > > > lrwxrwxrwx 1 root root 14 Dec 13 15:28 ttycons0 -> ../tty0.0.0500 > > lrwxrwxrwx 1 root root 14 Dec 13 15:28 ttycons1 -> ../tty0.0.0501 > > lrwxrwxrwx 1 root root 14 Dec 13 15:28 ttycons2 -> ../tty0.0.0502 > > lrwxrwxrwx 1 root root 14 Dec 13 15:28 ttycons3 -> ../tty0.0.0503 > > > > Would this be possible in udev, if so what '%' option can I use? > > There is intentionally no enumeration facility in udev. Udev-provided > enumeration would not be much better than the kernel-provided > enumeration. > > In general, all sorts of device inter-dependencies in device names > should be avoided, and names should be provided by properties derived > from the device itself, the bus location it is connected to, or be > supported by the firmware, and not by unreliable enumeration. > > "Inventing" new numbers in a device hotplug path cannot really work, > and udev does not want to give the impression it could. > > Kay > OK, I understand, but if I would like to achieve what I wrote, how would I go and do that? -- Robert Milasan L3 Support Engineer SUSE Linux (http://www.suse.com) email: rmila...@suse.com GPG fingerprint: B6FE F4A8 0FA3 3040 3402 6FE7 2F64 167C 1909 6D1A _______________________________________________ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel