Skip to contentSkip to conversation

udev 007 release

ANNOUNCE Applied Greg KH 4 participants 14 messages Nov 24, 2003 – Dec 2, 2003

lore
Share & tools
lore

Greg KH

author
#0 lore raw

I've released the 007 version of udev. It can be found at:
kernel.org/pub/linux/utils/kernel/hotplug/udev-007.tar.gz

udev is a implementation of devfs in userspace using sysfs and /sbin/hotplug. It requires a 2.6 kernel to run. Please see the udev FAQ for any questions about it:
kernel.org/pub/linux/utils/kernel/hotplug/udev-FAQ

Note:
The CALLOUT rule format has changed. If you have a config file using this rule, please change it to follow the new order. See the man page for the proper style.

The major changes since the 006 release are:
- better parsing of the udev.permissions file
- string owner and group names in the udev.permissions file will now work if you build against glibc.
- fix the CALLOUT rule to look the same as the other rules.
- add format char for CALLOUT rule output
- support arguments in callout exec
- add ability for CALLOUT program to accept format modifiers.
- drop Makefile.klibc. To build using klibc, use:
make KLIBC=true
- updated man page documenting new changes.

Again, many thanks to Kay Sievers, for lots of great patches in this release. Thanks also to Marco d'Itri and Olaf Hering, both of whom submitted patches for this release.

I think with the ability to capture the output of the CALLOUT rule, combined with the ability to put format modifiers in the CALLOUT program string, we now have everything in place to emulate the existing devfs naming scheme. Anyone want to verify this or not?

The full ChangeLog can be found below.

udev development is done in a BitKeeper repository loacated at:
bk://linuxusb.bkbits.net/udev

Daily snapshots of this tree can be found at:
http://www.codemonkey.org.uk/projects/bitkeeper/udev/
Many thanks to Dave Jones for managing this.

thanks,

greg k-h

Summary of changes from v006 to v007
======================

<md:linux.it>:
o fix segfault in parsing bad udev.permissions file

Greg Kroah-Hartman:
o update default config file with a CALLOUT rule, and more documentation
o updated the man page with the latest format specifier changes
o added ability to put format specifiers in the CALLOUT program string
o tweak udev-test.pl to report '0' errors if that's what happened
o only build klibc_fixups.c if we are actually using klibc
o add support for string group and string user names in udev.permissions
o add getgrnam and getpwnam to klibc_fixups files
o remove Makefile.klibc
o add udev-test perl script from Kay Sievers <[email protected]> which blows away my puny shell scripts
o added debian's version of udev.permissions
o change to 006_bk version

Kay Sievers:
o format char for CALLOUT output
o more namedev whitespace cleanups
o support arguments in callout exec
o namedev.c - change order of fields in CALLOUT
o namedev.c whitespace + debug text cleanup
o man page with udev.permissions wildcard

Olaf Hering:
o static klibc udev does not link against crt0.o

-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program. Does SourceForge.net help you be more productive? Does it help you create better code? SHARE THE LOVE, and help us help YOU! Click Here: http://sourceforge.net/donate/
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

#1 lore raw
Quoted 4 lines · Greg KH

I think with the ability to capture the output of the CALLOUT rule, combined with the ability to put format modifiers in the CALLOUT program string, we now have everything in place to emulate the existing devfs naming scheme. Anyone want to verify this or not?

I would prefer to have the ability of creating partition nodes in devfs style built-in to udev. Devfs used to call the whole disk e.g. "/dev/dasd/0123/disk" and the partitions "/dev/dasd/0123/part[1-3]". This can obviously be done with a CALLOUT rule, but its common enough to make it a format modifier. AFAIK, this scheme has been used for ide, scsi and dasd disks, which is about 99% of all disks ever connected to Linux.

One thing that does not appear to be possible with udev but was common with devfs is to have multiple links for the same device node, e.g. /dev/hda1 as well as /dev/ide/host0/bus0/target0/lun0/part1 and /dev/disk/0/part1.

	Arnd <><

=== namedev.c 1.45 vs edited ==--- 1.45/namedev.c Sun Nov 23 23:25:12 2003
+++ edited/namedev.c Mon Nov 24 04:01:10 2003
@@ -523,6 +523,15 @@
strcat(pos, udev->kernel_number); dbg("substitute kernel number '%s'", udev->kernel_number); break;
+ case 'N':
+ if (strlen(udev->kernel_number) = 0) {
+ strcat(pos, "disk");
+ break;
+ }
+ strcat(pos, "part");
+ strcat(pos, udev->kernel_number);
+ dbg("substitute kernel number '%s'", udev->kernel_number);
+ break;
case 'm':
sprintf(pos, "%u", udev->minor); dbg("substitute minor number '%u'", udev->minor);

-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program. Does SourceForge.net help you be more productive? Does it help you create better code? SHARE THE LOVE, and help us help YOU! Click Here: http://sourceforge.net/donate/
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

author
#2 lore raw
In reply to Greg KH
Quoted 7 lines · Arnd Bergmann
Quoted 4 lines · Greg KH

I think with the ability to capture the output of the CALLOUT rule, combined with the ability to put format modifiers in the CALLOUT program string, we now have everything in place to emulate the existing devfs naming scheme. Anyone want to verify this or not?

Quoted 7 lines

I would prefer to have the ability of creating partition nodes in devfs style built-in to udev. Devfs used to call the whole disk e.g. "/dev/dasd/0123/disk" and the partitions "/dev/dasd/0123/part[1-3]". This can obviously be done with a CALLOUT rule, but its common enough to make it a format modifier. AFAIK, this scheme has been used for ide, scsi and dasd disks, which is about 99% of all disks ever connected to Linux.

Ok, that makes sense. I've applied this patch, but used the 'D' modifier (for Devfs name). Is that ok with you?

Quoted 4 lines

One thing that does not appear to be possible with udev but was common with devfs is to have multiple links for the same device node, e.g. /dev/hda1 as well as /dev/ide/host0/bus0/target0/lun0/part1 and /dev/disk/0/part1.

Yes, we need to add support for both multiple names, and symlinks. It's on the TODO list I think (well the symlinks are, multiple names should be if it isn't.)

thanks,

greg k-h

-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program. Does SourceForge.net help you be more productive? Does it help you create better code? SHARE THE LOVE, and help us help YOU! Click Here: http://sourceforge.net/donate/
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

#3 lore raw
In reply to Greg KH

Review

Quoted 9 lines · Arnd Bergmann
(quoted diff) +9 -0
+			case 'N':
+				if (strlen(udev->kernel_number) = 0) {
+					strcat(pos, "disk");
+					break;
+				}
+				strcat(pos, "part");
+				strcat(pos, udev->kernel_number);
+				dbg("substitute kernel number '%s'", udev->kernel_number);
+				break;

After seeing this I started thinking about devfs-like devices and I tough that, as soon as the kernel will export a node which will allow recognizing CD devices, this could part of the default udev.config shipped by a distribution (I'd like to do this for debian):

NUMBER, BUS="ide", id="0.0", NAME="ide/host0/bus0/target0/lun0/%N" NUMBER, BUS="ide", id="0.1", NAME="ide/host0/bus0/target1/lun0/%N" NUMBER, BUS="ide", id="1.0", NAME="ide/host0/bus1/target0/lun0/%N" NUMBER, BUS="ide", id="1.1", NAME="ide/host0/bus1/target1/lun0/%N" NUMBER, BUS="ide", id="0.0", type="cd", NAME="ide/host0/bus0/target0/lun0/cd" NUMBER, BUS="ide", id="0.1", type="cd", NAME="ide/host0/bus0/target1/lun0/cd" NUMBER, BUS="ide", id="1.0", type="cd", NAME="ide/host0/bus1/target0/lun0/cd" NUMBER, BUS="ide", id="1.1", type="cd", NAME="ide/host0/bus1/target1/lun0/cd"

And this could be a possible syntax for managing symlinks: LINK would work just like NUMBER, but NAME would be a symlink to the device specified:

# a trailing / means that the link will be done to the parent directory
LINK, BUS="ide", id="0.0", NAME="discs/disc0/"
LINK, BUS="ide", id="0.1", NAME="discs/disc1/"
LINK, BUS="ide", id="1.0", NAME="discs/cdrom0"
LINK, BUS="ide", id="1.1", NAME="discs/cdrom1"

Related problem: if the ide-cd driver is modular then at boot time the block device nodes will not appear in sysfs, so udev will not create the devices in /dev. But if there are no devices which applications can open, how can the kernel autoload the module?
Currently no hotplug method deals with this, so I'm not sure about what should load ide-cd at boot time.

BTW, how can I configure udev to create devices like vc/%n instead of tty%n?

Signature · 13 lines
ciao, |
Marco | [3275 fipApyPRskOns]


-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
Does SourceForge.net help you be more productive?  Does it
help you create better code?  SHARE THE LOVE, and help us help
YOU!  Click Here: http://sourceforge.net/donate/
_______________________________________________
Linux-hotplug-devel mailing list  http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
author
#4 lore raw
In reply to Greg KH
Quoted 17 lines · Marco d'Itri

Review

Quoted 9 lines · Arnd Bergmann
(quoted diff) +9 -0
+			case 'N':
+				if (strlen(udev->kernel_number) = 0) {
+					strcat(pos, "disk");
+					break;
+				}
+				strcat(pos, "part");
+				strcat(pos, udev->kernel_number);
+				dbg("substitute kernel number '%s'", udev->kernel_number);
+				break;

After seeing this I started thinking about devfs-like devices and I tough that, as soon as the kernel will export a node which will allow recognizing CD devices, this could part of the default udev.config shipped by a distribution (I'd like to do this for debian):

Quoted 8 lines

NUMBER, BUS="ide", id="0.0", NAME="ide/host0/bus0/target0/lun0/%N" NUMBER, BUS="ide", id="0.1", NAME="ide/host0/bus0/target1/lun0/%N" NUMBER, BUS="ide", id="1.0", NAME="ide/host0/bus1/target0/lun0/%N" NUMBER, BUS="ide", id="1.1", NAME="ide/host0/bus1/target1/lun0/%N" NUMBER, BUS="ide", id="0.0", type="cd", NAME="ide/host0/bus0/target0/lun0/cd" NUMBER, BUS="ide", id="0.1", type="cd", NAME="ide/host0/bus0/target1/lun0/cd" NUMBER, BUS="ide", id="1.0", type="cd", NAME="ide/host0/bus1/target0/lun0/cd" NUMBER, BUS="ide", id="1.1", type="cd", NAME="ide/host0/bus1/target1/lun0/cd"

Hm, two different rules for the same id. Not a good idea, udev can not handle this. How about a LABEL rule for a cd instead.
But you are going to have to do a CALLOUT rule if you want to create names like "ide/host0/bus0/target0/lun0" properly, so you might as well do it all in a external script. Makes it much easier for you :)

Quoted 9 lines

And this could be a possible syntax for managing symlinks: LINK would work just like NUMBER, but NAME would be a symlink to the device specified:

# a trailing / means that the link will be done to the parent directory
LINK, BUS="ide", id="0.0", NAME="discs/disc0/"
LINK, BUS="ide", id="0.1", NAME="discs/disc1/"
LINK, BUS="ide", id="1.0", NAME="discs/cdrom0"
LINK, BUS="ide", id="1.1", NAME="discs/cdrom1"

No, I think multiple NAME values on a line would be the best thing, but that will take some major tweaks to udev to get there. We will get there...

Quoted 6 lines

Related problem: if the ide-cd driver is modular then at boot time the block device nodes will not appear in sysfs, so udev will not create the devices in /dev. But if there are no devices which applications can open, how can the kernel autoload the module?
Currently no hotplug method deals with this, so I'm not sure about what should load ide-cd at boot time.

That's up to your startup scripts :)
Look at how Red Hat does this for an example of this.

Quoted 2 lines

BTW, how can I configure udev to create devices like vc/%n instead of tty%n?

For USB tty devices try:

	REPLACE, KERNEL="ttyUSB*", NAME="usb/%n"
So create such a rule for all of the different tty device types.
And then as your last REPLACE rule do:
	REPLACE, KERNEL="tty*", NAME="vc/%n"

Hope this helps,

greg k-h

-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program. Does SourceForge.net help you be more productive? Does it help you create better code? SHARE THE LOVE, and help us help YOU! Click Here: http://sourceforge.net/donate/
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

#5 lore raw
In reply to Greg KH
Quoted 11 lines · Greg KH
Quoted 8 lines

NUMBER, BUS="ide", id="0.0", NAME="ide/host0/bus0/target0/lun0/%N" NUMBER, BUS="ide", id="0.1", NAME="ide/host0/bus0/target1/lun0/%N" NUMBER, BUS="ide", id="1.0", NAME="ide/host0/bus1/target0/lun0/%N" NUMBER, BUS="ide", id="1.1", NAME="ide/host0/bus1/target1/lun0/%N" NUMBER, BUS="ide", id="0.0", type="cd", NAME="ide/host0/bus0/target0/lun0/cd" NUMBER, BUS="ide", id="0.1", type="cd", NAME="ide/host0/bus0/target1/lun0/cd" NUMBER, BUS="ide", id="1.0", type="cd", NAME="ide/host0/bus1/target0/lun0/cd" NUMBER, BUS="ide", id="1.1", type="cd", NAME="ide/host0/bus1/target1/lun0/cd"

Hm, two different rules for the same id. Not a good idea, udev can not handle this. How about a LABEL rule for a cd instead.

I tought that a sysfs attribute would have been enough to disambiguate the rules.

Quoted 3 lines

But you are going to have to do a CALLOUT rule if you want to create names like "ide/host0/bus0/target0/lun0" properly, so you might as well do it all in a external script. Makes it much easier for you :)

Why? The names do not change, as they depend on the ide bus positions.

Quoted 11 lines
Quoted 10 lines

And this could be a possible syntax for managing symlinks: LINK would work just like NUMBER, but NAME would be a symlink to the device specified:

# a trailing / means that the link will be done to the parent directory
LINK, BUS="ide", id="0.0", NAME="discs/disc0/"
LINK, BUS="ide", id="0.1", NAME="discs/disc1/"
LINK, BUS="ide", id="1.0", NAME="discs/cdrom0"
LINK, BUS="ide", id="1.1", NAME="discs/cdrom1"
Quoted 3 lines

No, I think multiple NAME values on a line would be the best thing, but that will take some major tweaks to udev to get there. We will get there...

Multiple names have the downside that admins will have to modify the "standard" rules, while with different rules they could just add the appropriate aliases at the end of the config file.

Quoted 2 lines

And then as your last REPLACE rule do:

	REPLACE, KERNEL="tty*", NAME="vc/%n"

I tried it, but it does not work. (And what about /dev/tty?)

Signature · 13 lines
ciao, |
Marco | [3389 laQYHWJk.JWkI]


-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
Does SourceForge.net help you be more productive?  Does it
help you create better code?  SHARE THE LOVE, and help us help
YOU!  Click Here: http://sourceforge.net/donate/
_______________________________________________
Linux-hotplug-devel mailing list  http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
author
#6 lore raw
In reply to Greg KH
Quoted 11 lines · Marco d'Itri
Quoted 9 lines · Greg KH
Quoted 8 lines

NUMBER, BUS="ide", id="0.0", NAME="ide/host0/bus0/target0/lun0/%N" NUMBER, BUS="ide", id="0.1", NAME="ide/host0/bus0/target1/lun0/%N" NUMBER, BUS="ide", id="1.0", NAME="ide/host0/bus1/target0/lun0/%N" NUMBER, BUS="ide", id="1.1", NAME="ide/host0/bus1/target1/lun0/%N" NUMBER, BUS="ide", id="0.0", type="cd", NAME="ide/host0/bus0/target0/lun0/cd" NUMBER, BUS="ide", id="0.1", type="cd", NAME="ide/host0/bus0/target1/lun0/cd" NUMBER, BUS="ide", id="1.0", type="cd", NAME="ide/host0/bus1/target0/lun0/cd" NUMBER, BUS="ide", id="1.1", type="cd", NAME="ide/host0/bus1/target1/lun0/cd"

Quoted 4 lines
Quoted 2 lines

Hm, two different rules for the same id. Not a good idea, udev can not handle this. How about a LABEL rule for a cd instead.

I tought that a sysfs attribute would have been enough to disambiguate the rules.

Yeah, that would work. I just fixed a bug where the NAME was the same, but the BUS was different. That previously didn't work at all.

Care to send a patch?

Quoted 10 lines
Quoted 10 lines
Quoted 9 lines

And this could be a possible syntax for managing symlinks: LINK would work just like NUMBER, but NAME would be a symlink to the device specified:

# a trailing / means that the link will be done to the parent directory
LINK, BUS="ide", id="0.0", NAME="discs/disc0/"
LINK, BUS="ide", id="0.1", NAME="discs/disc1/"
LINK, BUS="ide", id="1.0", NAME="discs/cdrom0"
LINK, BUS="ide", id="1.1", NAME="discs/cdrom1"
Quoted 6 lines
Quoted 3 lines

No, I think multiple NAME values on a line would be the best thing, but that will take some major tweaks to udev to get there. We will get there...

Multiple names have the downside that admins will have to modify the "standard" rules, while with different rules they could just add the appropriate aliases at the end of the config file.

True. Ok, well, as neither are implemented yet, it's not really a big deal right now :)

Quoted 3 lines
Quoted 2 lines

And then as your last REPLACE rule do:

	REPLACE, KERNEL="tty*", NAME="vc/%n"

I tried it, but it does not work. (And what about /dev/tty?)

Care to enable DEBUG_PARSE in namedev.c and send me the output when trying this? Along with your config files.

thanks,

greg k-h

-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program. Does SourceForge.net help you be more productive? Does it help you create better code? SHARE THE LOVE, and help us help YOU! Click Here: http://sourceforge.net/donate/
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

#7 lore raw
In reply to Greg KH
Quoted 9 lines · Greg KH
Quoted 5 lines · Marco d'Itri
Quoted 2 lines · Greg KH

And then as your last REPLACE rule do:

	REPLACE, KERNEL="tty*", NAME="vc/%n"

I tried it, but it does not work. (And what about /dev/tty?)

Care to enable DEBUG_PARSE in namedev.c and send me the output when trying this? Along with your config files.

Sorry, but we don't match against a wildcard now.
Please try the following patch:

01-catch--replace-device-by-wildcard.diff
catch device name by wildcard to support a whole class of devices by just one config line like:
REPLACE, KERNEL="tty*", NAME="vc/%n"

thanks,
Kay

namedev.c +2 -2
diff -Nru a/namedev.c b/namedev.c
@@ -860,8 +860,8 @@
 			continue;
 
 		dbg_parse("compare name '%s' with '%s'",
-			  dev->kernel_name, dev->name);
-		if (strcmp(dev->kernel_name, class_dev->name) != 0)
+			  dev->kernel_name, class_dev->name);
+		if (strncmp_wildcard(class_dev->name, dev->kernel_name, NAME_SIZE) != 0)
 			continue;
 
 		strfieldcpy(udev->name, dev->name);
test/udev-test.pl +9 -0
diff -Nru a/test/udev-test.pl b/test/udev-test.pl
@@ -51,6 +51,15 @@
 EOF
 	},
 	{
+		desc     => "catch device by wildcard",
+		subsys   => "tty",
+		devpath  => "class/tty/ttyUSB0",
+		expected => "visor/0" ,
+		conf     => <<EOF
+REPLACE, KERNEL="ttyUSB*", NAME="visor/%n"
+EOF
+	},
+	{
 		desc     => "replace kernel name",
 		subsys   => "tty",
 		devpath  => "class/tty/ttyUSB0",
#8 lore raw
In reply to Greg KH
Quoted 11 lines · Kay Sievers
Quoted 9 lines · Greg KH
Quoted 5 lines · Marco d'Itri
Quoted 2 lines · Greg KH

And then as your last REPLACE rule do:

	REPLACE, KERNEL="tty*", NAME="vc/%n"

I tried it, but it does not work. (And what about /dev/tty?)

Care to enable DEBUG_PARSE in namedev.c and send me the output when trying this? Along with your config files.

Quoted 8 lines

Sorry, but we don't match against a wildcard now.
Please try the following patch:

01-catch--replace-device-by-wildcard.diff
catch device name by wildcard to support a whole class of devices by just one config line like:
REPLACE, KERNEL="tty*", NAME="vc/%n"

Ups, please use these config lines, in this order as a temporary workaround, to catch the other devices starting with tty*, the same is needed for ttyUSB*, ...

REPLACE, KERNEL="tty*", NAME="vc/%n"
REPLACE, KERNEL="ttyS*", NAME="tts/%n"
REPLACE, KERNEL="tty", NAME="tty"

Greg, should we iterate backwards over the lists of methods? It seems a bit confusing to put a catch all line at the beginning of the config file to be precessed after all the others.

A better pattern matching seems unavoidable.
Is anyone already improving namedev's strncpm_wildcard()? If nobody comes up, I will do it until tomorrow night :)

thanks,
Kay

-------------------------------------------------------
This SF.net email is sponsored by OSDN's Audience Survey. Help shape OSDN's sites and tell us what you think. Take this five minute survey and you could win a $250 Gift Certificate.
http://www.wrgsurveys.com/2003/osdntech03.php?site=8

_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

#9 lore raw
In reply to Greg KH
Quoted 3 lines · Kay Sievers

A better pattern matching seems unavoidable.
Is anyone already improving namedev's strncpm_wildcard()? If nobody comes up, I will do it until tomorrow night :)

At least [] characters classes should be implemented. Taking tty* as an example, if you can't match on tty[0-9]+ you would have to individually list 16 "tty<uppercase letter>" serial device names.

If a partial reimplementation of extended regexps is too much complex to be worth it, then a good enough substitute would be the ability to match on one or more numbers.

Signature · 14 lines
ciao, |
Marco | [3418 sezC8T3lqfIbc]


-------------------------------------------------------
This SF.net email is sponsored by OSDN's Audience Survey.
Help shape OSDN's sites and tell us what you think. Take this
five minute survey and you could win a $250 Gift Certificate.
http://www.wrgsurveys.com/2003/osdntech03.php?site=8

_______________________________________________
Linux-hotplug-devel mailing list  http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
#10 lore raw
In reply to Greg KH
Quoted 5 lines · Marco d'Itri
Quoted 3 lines · Kay Sievers

A better pattern matching seems unavoidable.
Is anyone already improving namedev's strncpm_wildcard()? If nobody comes up, I will do it until tomorrow night :)

Quoted 7 lines

At least [] characters classes should be implemented. Taking tty* as an example, if you can't match on tty[0-9]+ you would have to individually list 16 "tty<uppercase letter>" serial device names.

If a partial reimplementation of extended regexps is too much complex to be worth it, then a good enough substitute would be the ability to match on one or more numbers.

Yes, this is already working in my tree:
REPLACE, KERNEL="tty[0-9]*", NAME="vc/%n"

Dec  2 18:30:57 pim udev[10109]: build_kernel_number: kernel_number='49'
Dec  2 18:30:57 pim udev[10109]: strncmp_wildcard: fnmatch p:ttyS* s:tty49 r:1
Dec  2 18:30:57 pim udev[10109]: strncmp_wildcard: fnmatch p:tty[0-9]* s:tty49 r:0
Dec  2 18:30:57 pim udev[10109]: apply_format: substitute kernel number '49'
Dec  2 18:30:57 pim udev[10109]: udev_add_device: name='vc/49'
Dec  2 18:30:57 pim udev[10109]: create_node: mknod(/udev/vc/49, 020666, 4, 49)

It's based on libc's fnmatch(), that supports (*, ?, []).
http://developer.novell.com/ndk/doc/libc/index.html?page=/ndk/doc/libc/libc_enu/data/amsgxku.html

But I have to port it to klibc.
I will do this tomorrow if nobody comes up with a better idea :)

Kay

-------------------------------------------------------
This SF.net email is sponsored by OSDN's Audience Survey. Help shape OSDN's sites and tell us what you think. Take this five minute survey and you could win a $250 Gift Certificate.
http://www.wrgsurveys.com/2003/osdntech03.php?site=8

_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

author
#11 lore raw
In reply to Greg KH
Quoted 5 lines · Kay Sievers

Ups, please use these config lines, in this order as a temporary workaround, to catch the other devices starting with tty*, the same is needed for ttyUSB*, ...

Quoted 8 lines

REPLACE, KERNEL="tty*", NAME="vc/%n"
REPLACE, KERNEL="ttyS*", NAME="tts/%n"
REPLACE, KERNEL="tty", NAME="tty"

Greg, should we iterate backwards over the lists of methods? It seems a bit confusing to put a catch all line at the beginning of the config file to be precessed after all the others.

True, I just fixed this up to handle the rules in the order they are in the config file (within the type of rule.) So

REPLACE, KERNEL="tty", NAME="tty"
REPLACE, KERNEL="ttyS*", NAME="tts/%n"
REPLACE, KERNEL="tty*", NAME="vc/%n"

should work now (well, it does for me...)

thanks,

greg k-h

-------------------------------------------------------
This SF.net email is sponsored by OSDN's Audience Survey. Help shape OSDN's sites and tell us what you think. Take this five minute survey and you could win a $250 Gift Certificate.
http://www.wrgsurveys.com/2003/osdntech03.php?site=8

_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

author Applied
#12 lore raw
In reply to Greg KH
Quoted 11 lines · Kay Sievers
Quoted 9 lines · Greg KH
Quoted 5 lines · Marco d'Itri
Quoted 2 lines · Greg KH

And then as your last REPLACE rule do:

	REPLACE, KERNEL="tty*", NAME="vc/%n"

I tried it, but it does not work. (And what about /dev/tty?)

Care to enable DEBUG_PARSE in namedev.c and send me the output when trying this? Along with your config files.

Quoted 7 lines

Sorry, but we don't match against a wildcard now.
Please try the following patch:

01-catch--replace-device-by-wildcard.diff
catch device name by wildcard to support a whole class of devices by just one config line like:
REPLACE, KERNEL="tty*", NAME="vc/%n"

Applied, thanks.

greg k-h

-------------------------------------------------------
This SF.net email is sponsored by OSDN's Audience Survey. Help shape OSDN's sites and tell us what you think. Take this five minute survey and you could win a $250 Gift Certificate.
http://www.wrgsurveys.com/2003/osdntech03.php?site=8

_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

author
#13 lore raw
In reply to Greg KH
Quoted 12 lines · Kay Sievers

Yes, this is already working in my tree:
REPLACE, KERNEL="tty[0-9]*", NAME="vc/%n"

Dec  2 18:30:57 pim udev[10109]: build_kernel_number: kernel_number='49'
Dec  2 18:30:57 pim udev[10109]: strncmp_wildcard: fnmatch p:ttyS* s:tty49 r:1
Dec  2 18:30:57 pim udev[10109]: strncmp_wildcard: fnmatch p:tty[0-9]* s:tty49 r:0
Dec  2 18:30:57 pim udev[10109]: apply_format: substitute kernel number '49'
Dec  2 18:30:57 pim udev[10109]: udev_add_device: name='vc/49'
Dec  2 18:30:57 pim udev[10109]: create_node: mknod(/udev/vc/49, 020666, 4, 49)
Quoted 5 lines

It's based on libc's fnmatch(), that supports (*, ?, []).
http://developer.novell.com/ndk/doc/libc/index.html?page=/ndk/doc/libc/libc_enu/data/amsgxku.html

But I have to port it to klibc.
I will do this tomorrow if nobody comes up with a better idea :)

That looks like a good idea to me.

thanks,

greg k-h

-------------------------------------------------------
This SF.net email is sponsored by OSDN's Audience Survey. Help shape OSDN's sites and tell us what you think. Take this five minute survey and you could win a $250 Gift Certificate.
http://www.wrgsurveys.com/2003/osdntech03.php?site=8

_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel