IF YOU WOULD LIKE TO GET AN ACCOUNT, please write an
email to Administrator. User accounts are meant only to access repo
and report issues and/or generate pull requests.
This is a purpose-specific Git hosting for
BaseALT
projects. Thank you for your understanding!
Только зарегистрированные пользователи имеют доступ к сервису!
Для получения аккаунта, обратитесь к администратору.
As promised yesterday, here is a patch to implement a more advanced
pattern matching instead of the simple '*'.
We can remove the "tty"="tty" line from udev.rules now and
replace "tty*" by "tty[0-9]*" to catch only the vc's.
implement pattern matching in namedev
'*' - to match zero or more chars
'?' - to match exactly one char
'[]' - character classes with ranges '[0-9]'and negation [!A]
the older udev.config file is now called udev.rules.
This allows us to better control configuration values, and move away from
the environment variables.
On Monday 24 November 2003 01:29, Greg KH wrote:
> 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.
udev kept on segfaulting when it was in use, and not having the time
(and building it with DEBUG=true showing nothing), I have not tracked it
until tonight. Seems like I made a type-o, and forgotten the ':'
between one line's group and permission parameters. Attached patch
should stop the segfault, and warn at that at least.
here is a patch for inserting the callout output into NAME=.
ID= supports the usual wildcard to compare with the output.
I've moved all wildcard matching to a function cause this was the third occurrence.
Also attached is the last whitespace cleanup and debug text corrections.
The callout patch depends on the whitespace patch.
CALLOUT, BUS="usb", PROGRAM="/bin/echo -n return", ID="ret*", NAME="webcam-%c-"
results in:
Nov 21 17:33:51 pim udev[20399]: get_major_minor: found major = 81, minor = 0
Nov 21 17:33:51 pim udev[20399]: exec_callout: callout to '/bin/echo -n return'
Nov 21 17:33:51 pim udev[20399]: exec_callout: callout returned 'return'
Nov 21 17:33:51 pim udev[20399]: get_attr: substitute callout output 'return'
Nov 21 17:33:51 pim udev[20399]: udev_add_device: name = webcam-return-
Nov 21 17:33:51 pim udev[20399]: create_node: mknod(/udev/webcam-return-, 020660, 81, 0)
here is argument support for CALLOUT exec:
CALLOUT, PROGRAM="/bin/echo -n xxx", BUS="usb", ID="xxx", NAME="webcam%n"
results in:
Nov 20 02:35:20 pim udev[30422]: get_major_minor: found major = 81, minor = 0
Nov 20 02:35:20 pim udev[30422]: exec_callout: callout to /bin/echo -n xxx
Nov 20 02:35:20 pim udev[30422]: exec_callout: callout returned 'xxx'
Nov 20 02:35:20 pim udev[30422]: get_attr: kernel number appended: 0
The feature is really nice, but the maximum argument count is hard coded to 8.
I want to bring the CALLOUT field ordering in line with the other
methods, cause the current parsing relies on the ordering it's good
to have it like the others. The BUS= is now the first expected field.
Also made the last two remaining field names to uppercase and the man page
callout example is updated.
here is mainly a whitespace cleanup for namedev.c. I changed the
dbg_parse() output a bit for better readability:
current:
Nov 19 19:00:59 pim udev[25582]: do_number: NUMBER path='/sys/devices/pci0000:00/0000:00:1d.1/usb2/2-1/2-1.1'
Nov 19 19:00:59 pim udev[25582]: do_number: NUMBER temp='/2-1.1' id='00:07.1'
Nov 19 19:00:59 pim udev[25582]: do_number: NUMBER temp='/2-1' id='00:07.1'
Nov 19 19:00:59 pim udev[25582]: do_number: NUMBER path='/sys/devices/pci0000:00/0000:00:1d.1/usb2/2-1/2-1.1'
Nov 19 19:00:59 pim udev[25582]: do_number: NUMBER temp='/2-1.1' id='00:0b.0'
Nov 19 19:00:59 pim udev[25582]: do_number: NUMBER temp='/2-1' id='00:0b.0'
Nov 19 19:00:59 pim udev[25582]: do_number: NUMBER path='/sys/devices/pci0000:00/0000:00:1d.1/usb2/2-1/2-1.1'
Nov 19 19:00:59 pim udev[25582]: do_number: NUMBER temp='/2-1.1' id='2-1.1'
Nov 19 19:00:59 pim udev[25582]: do_number: device id '2-1.1' becomes 'webcam%n' - owner='', group ='', mode=0
becomes:
Nov 19 19:23:40 pim udev[26091]: do_number: search '00:07.1' in '/2-1.1', path='/sys/devices/pci0000:00/0000:00:1d.1/usb2/2-1/2-1.1'
Nov 19 19:23:40 pim udev[26091]: do_number: search '00:07.1' in '/2-1', path='/sys/devices/pci0000:00/0000:00:1d.1/usb2/2-1'
Nov 19 19:23:40 pim udev[26091]: do_number: search '00:0b.0' in '/2-1.1', path='/sys/devices/pci0000:00/0000:00:1d.1/usb2/2-1/2-1.1'
Nov 19 19:23:40 pim udev[26091]: do_number: search '00:0b.0' in '/2-1', path='/sys/devices/pci0000:00/0000:00:1d.1/usb2/2-1'
Nov 19 19:23:40 pim udev[26091]: do_number: search '2-1.1' in '/2-1.1', path='/sys/devices/pci0000:00/0000:00:1d.1/usb2/2-1/2-1.1'
Nov 19 19:23:40 pim udev[26091]: do_number: found id '2-1.1', 'video0' becomes 'webcam%n' - owner='', group ='', mode=0
Permissions given in udev.permissions are not applied if no METHOD from
udev.config is found. I've added do_kernelname() to scan for known
permissions if we only use the default method.
Simple support for wildcards is also added:
#name:user:group:mode
hdb*:2702:2702:0660
results in:
drwxr-xr-x 2 root root 240 Nov 19 03:45 .
drwxr-xr-x 23 root root 528 Nov 17 03:36 ..
brw-r--r-- 1 root root 3, 0 Nov 19 03:45 hda
brw-r--r-- 1 root root 3, 1 Nov 19 03:45 hda1
brw-r--r-- 1 root root 3, 2 Nov 19 03:45 hda2
brw-r--r-- 1 root root 3, 4 Nov 19 03:45 hda4
brw-r----- 1 kay kay 3, 64 Nov 19 03:45 hdb
brw-r----- 1 kay kay 3, 65 Nov 19 03:45 hdb1
brw-r--r-- 1 root root 22, 0 Nov 19 03:45 hdc
crw-r--r-- 1 root root 81, 0 Nov 19 03:34 webcam0
After getting a number of different crashes for udev reading broken
udev.config files, I decided to try to make the parser a little
more robust.
The behaviour is changed to stop reading the configuration file
and logging the broken entry instead of silently ignoring it (is
that good? It's easy to just print and continue).
All strcpy()'s to a fixed length string are now implicitly limited
to the bounds of the target string.
I kept the -ENODEV return code for now, not sure if there should be
different ones.
On Tuesday 18 November 2003 02:14, Greg KH wrote:
> On Mon, Nov 17, 2003 at 06:33:32PM +0100, Arnd Bergmann wrote:
> > That would at least be part of the solution I'm looking for. How about
> > extra format characters for bus_id and for the result of a callout
> > program?
>
> Sure, I can see the use for that. Want to send a patch? :)
> Take a look at the current bk tree (which has moved to
> bk://linuxusb.bkbits.net/udev/ ) I've made finding that device a lot
> easier now, and it works for all rule types.
Great, just what I was missing. I didn't see the any link to the bk
repository. Here's the patch for the bus_id. I'll need to think about
the handling of callout results a bit more.
> Problem is, if you use the LABEL rule to match a device, like a SCSI
> vendor, then all of the partitions, as well as the main block device,
> will end up with the same name. That's why I added the "add the number"
> hack to the LABEL rule.
>
> So yes, your patch is correct in that we shouldn't always be adding the
> number to any match for LABEL (like for char devices), but if we do
> that, then we break partitions. Your '%' patch fixes this, but I'd just
> like to extend it a bit. Let me see what I can come up with...
Oh, I see. Do you mean something like this:
LABEL, BUS="usb", model="Creative Labs WebCam 3", NAME="webcam%n-%M:%m-test"
results in: "webcam0-81:0-test"
Nov 15 16:51:53 pim udev[16193]: get_class_dev: looking at /sys/class/video4linux/video0
Nov 15 16:51:53 pim udev[16193]: get_class_dev: class_dev->name = video0
Nov 15 16:51:53 pim udev[16193]: get_major_minor: dev = 81:0
Nov 15 16:51:53 pim udev[16193]: get_major_minor: found major = 81, minor = 0
Nov 15 16:51:53 pim udev[16193]: udev_add_device: name = webcam0-81:0-test
Nov 15 16:51:53 pim udev[16193]: create_node: mknod(/udev/webcam0-81:0-test, 020666, 81, 0)
implement printf-like placeholder support for NAME
%n-kernel number, %M-major number, %m-minor number
Here's the patch applying the latest libsysfs.
- adds the latest libsysfs code to udev
* new code includes dlist implementation, a generic linked list
implementation. Needed our own because LGPL
* rearranged structures
* provided more functions for accessing directory and attributes
- gets rid of ->directory->path references in namedev.c
- replaces sysfs_get_value_from_attributes with sysfs_get_classdev_attr
Unix file modes should be stored in a mode_t, not a standard type. At
the moment it is actually unsigned, in fact, not a signed integer.
Attached patch does an s/int mode/mode_t mode/ and cleans up the
results.
This patch adds a callout config type to udev, so external programs can be
called to get serial numbers or id's that are not available as a sysfs
attribute.