Skip to contentSkip to conversation

udev 013 release

ANNOUNCE Greg KH 8 participants 25 messages Jan 13, 2004 – Jan 19, 2004 Kbuild

lore
Share & tools
lore

Greg KH

author
#0 lore raw

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

rpms built against Red Hat FC1 are available at:

	kernel.org/pub/linux/utils/kernel/hotplug/udev-013-1.i386.rpm

with the source rpm at:
kernel.org/pub/linux/utils/kernel/hotplug/udev-013-1.src.rpm

udev allows users to have a dynamic /dev and provides the ability to have persistent device names. It uses sysfs and /sbin/hotplug and runs entirely in userspace. It requires a 2.6 kernel with CONFIG_HOTPLUG enabled to run. Please see the udev FAQ for any questions about it:
kernel.org/pub/linux/utils/kernel/hotplug/udev-FAQ

For any udev vs devfs questions anyone might have, please see:
kernel.org/pub/linux/utils/kernel/hotplug/udev_vs_devfs

NOTE: The udev.rules file format has changed! If you have a modified config file it MUST be changed in order to work properly. Here's what needs to be done:
- The "<METHOD>, " at the beginning of the line should be removed. <METHOD> is one of the following: LABEL, CALLOUT, NUMBER, TOPOLOGY, REPLACE.
- The result of the externel program is matched with RESULT instead if ID - The PROGRAM= key is only valid if the program exits with zero
(just exit with nozero in a script if the rule should not match)

Also note the following changes in the way the udev.rules file is processed:
- Rules are processed in order they appear in the file. There are no priorities anymore.
- if NAME="" is given, udev is instructed to ignore this device, no node or symlink will be created.

As a result of these changes, we can now create much more powerful rules by combining multiple key fields. Here's two new rules that show how you can do this:

  # combined BUS, SYSFS and KERNEL
  BUS="usb", KERNEL="video*", SYSFS_model="Creative Labs WebCam*", NAME="test/webcam%n"
  # exec script only for the first ide drive (hda), all other will be skipped
  BUS="ide", KERNEL="hda*", PROGRAM="/sbin/ide-devfs.sh %k %b %n", RESULT="hd*", NAME="%1c", SYMLINK="%2c %3c"

Also, the result of the PROGRAM call is now cached accross multiple rules as long as a new PROGRAM key is not specified. As an example:

    PROGRAM="/bin/echo abc", RESULT="no_match", NAME="web-no-2"
    KERNEL="video*", RESULT="123", NAME="web-no-3"
    KERNEL="video*", RESULT="abc", NAME="web-yes"

The last rule would match properly.

Many thanks for these changes go to Kay Sievers. I really appreciate all of the development effort.

If anyone has any problems converting existing rules files, please see the example rules that are in the udev tarball, and feel free to ask questions on the linux-hotplug-devel mailing list.

Thanks again to everyone who has send me patches for this release, a full list of everyone, and their changes is below.

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

Daily snapshots of udev from the BitKeeper tree can be found at:
http://www.codemonkey.org.uk/projects/bitkeeper/udev/
If anyone ever wants a tarball of the current bk tree, just email me.

thanks,

greg k-h

Summary of changes from v012 to v013
======================

<eike-hotplug:sf-tec.de>:
o LSB init script and other stuff

<elkropac:students.zcu.cz>:
o fix udev directory for Debian init script

<tiggi:infa.abo.fi>:
o udev 012 old gcc fixup

Christophe Saout:
o add IGNORE rule type
o small cleanup

Greg Kroah-Hartman:
o update TODO with some new, small items

  o Cset exclude: [email protected]|ChangeSet|20040113010256|48515

o update the README in a few places
o fix -d typo in the manpage update
o Fix stupid gcc "optimization" of 1 character printk() calls.... Ick
o oops, forgot to fix up the PROGRAM result from ID to RESULT in the config files
o Add alsa device rules and a few other devfs rules
o fix a few stale comments in namedev.c
o convert the default rules files to the new format
o convert the test shell scripts to the config file format
o add bus test for usb-serial bus
o Add some helpful messages if the user uses the older config file format
o added dri rule to the default config file
o added init.d udev script for debian
o add a script that tests the IGNORE rule
o add silly script that names cdrom drives based on the cd in them
o add cdrom rule for ide cdrom
o replace list_for_each with list_for_each_entry, saving a few lines of code
o add a blacklist of class devices we do not want to look at
o 012_bk change
o v012 release TAG: v012

Kay Sievers:
o fix klibc with printf() and gcc
o udev - small script optimization
o udev - introduce format escape char
o udev - more CALLOUT is PROGRAM now
o udev - CALLOUT is PROGRAM now
o update documentation for new config file format
o more advanced user query options
o udev - simple debug tweak
o udev - drop all methods :)
o udev - advanced user query options
o udev - Makefile error
o udev - make exec_callout() reusable
o udev - exec status fix for klibc
o fix Silly udev script

-------------------------------------------------------
This SF.net email is sponsored by: Perforce Software. Perforce is the Fast Software Configuration Management System offering advanced branching capabilities and atomic changes on 50+ platforms. Free Eval! http://www.perforce.com/perforce/loadprog.html
_______________________________________________
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 2 lines · Greg KH

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

Is it intentional to leave all those BitKeeper/ and SCCS/ directories ? I thought they'd only be in the snapshots. A tarball without them is around 30% the size of the original.

Signature · 12 lines
http://www.pervalidus.net/contact.html


-------------------------------------------------------
This SF.net email is sponsored by: Perforce Software.
Perforce is the Fast Software Configuration Management System offering
advanced branching capabilities and atomic changes on 50+ platforms.
Free Eval! http://www.perforce.com/perforce/loadprog.html
_______________________________________________
Linux-hotplug-devel mailing list  http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
#2 lore raw
In reply to Greg KH

The fedora rpm --erase script errors out when you run it. Not a fatal problem.

[root@smirl jonsmirl]# rpm --erase udev
error reading information on service udev: No such file or directory
error: %postun(udev-013-1) scriptlet failed, exit status 1

Quoted 5 lines · --- Greg KH

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

rpms built against Red Hat FC1 are available at:

	kernel.org/pub/linux/utils/kernel/hotplug/udev-013-1.i386.rpm
Quoted 8 lines

with the source rpm at:
kernel.org/pub/linux/utils/kernel/hotplug/udev-013-1.src.rpm

udev allows users to have a dynamic /dev and provides the ability to have persistent device names. It uses sysfs and /sbin/hotplug and runs entirely in userspace. It requires a 2.6 kernel with CONFIG_HOTPLUG enabled to run. Please see the udev FAQ for any questions about it:
kernel.org/pub/linux/utils/kernel/hotplug/udev-FAQ

==Jon Smirl
[email protected]

__________________________________
Do you Yahoo!?
Yahoo! Hotjobs: Enter the "Signing Bonus" Sweepstakes
http://hotjobs.sweepstakes.yahoo.com/signingbonus

-------------------------------------------------------
This SF.net email is sponsored by: Perforce Software. Perforce is the Fast Software Configuration Management System offering advanced branching capabilities and atomic changes on 50+ platforms. Free Eval! http://www.perforce.com/perforce/loadprog.html
_______________________________________________
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

[I'm in lkml, but not in linux-hotplug-devel, so please CC: me]

Hi!

I'm trying udev for the first time and I must say good work!

A sugestion and a question:

- Make udev print a /etc/udev/udev.rules line every time a device is found because default behaviour is too silent and "make DEBUG=true" is too noisy. This would make adding our private/static entries easily. Something like:

udev[1234]: found device BUS="scsi", SYSFS_model="CD-Writer cd4f", KERNEL="sr0", SYSFS_serial="AAAAAAAA"

This way one can easily make entries for a device with copy+paste, remove a few parameters and adding a few *'s

- I have a USB cd-writer and udev makes /udev/sr0 but it doesn't create /udev/sg0. In the first run I had the hotplug packege from debian but I just installed hotplug-2004_01_05 and it's the same, no sg0 is created.

The kernel detects it:

Jan 14 05:04:40 puma kernel: sr0: scsi3-mmc drive: 20x/20x writer cd/rw xa/form2 cdda pop-up
Jan 14 05:04:40 puma kernel: Attached scsi CD-ROM sr0 at scsi19, channel 0, id 0, lun 0
Jan 14 05:04:40 puma kernel: Attached scsi generic sg0 at scsi19, channel 0, id 0, lun 0,  type 5
Jan 14 05:04:40 puma kernel: WARNING: USB Mass Storage data integrity not assured
Jan 14 05:04:40 puma kernel: USB Mass Storage device found at 20

The full udev run, from syslog, is attached.

Do I need a new rule? The log sugests that in that single run udev only cares about sr0, but I can be reading it wrong :) Or sysfs/udev doesn't support scsi_generic yet?

Thanks,
Nuno Silva

Quoted 2 lines · Greg KH

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

Jan 14 05:04:36 puma kernel: hub 4-0:1.0: new USB device on port 1, assigned address 20
Jan 14 05:04:37 puma udev[15057]: main: version 013
Jan 14 05:04:37 puma udev[15057]: get_dirs: sysfs_path='/sys'
Jan 14 05:04:37 puma udev[15057]: parse_config_file: reading '/etc/udev/udev.conf' as config file
Jan 14 05:04:37 puma udev[15057]: main: called by hotplug
Jan 14 05:04:37 puma udev[15057]: udev_hotplug: looking at '/devices/pci0000:00/0000:00:1d.2/usb4/4-1/4-1:1.0'
Jan 14 05:04:37 puma udev[15057]: udev_hotplug: not a block or class device
Jan 14 05:04:38 puma udev[15059]: main: version 013
Jan 14 05:04:38 puma udev[15059]: get_dirs: sysfs_path='/sys'
Jan 14 05:04:38 puma udev[15059]: parse_config_file: reading '/etc/udev/udev.conf' as config file
Jan 14 05:04:38 puma udev[15059]: main: called by hotplug
Jan 14 05:04:38 puma udev[15059]: udev_hotplug: looking at '/devices/pci0000:00/0000:00:1d.2/usb4/4-1'
Jan 14 05:04:38 puma udev[15059]: udev_hotplug: not a block or class device
Jan 14 05:04:40 puma udev[15069]: main: version 013
Jan 14 05:04:40 puma udev[15069]: get_dirs: sysfs_path='/sys'
Jan 14 05:04:40 puma udev[15069]: parse_config_file: reading '/etc/udev/udev.conf' as config file
Jan 14 05:04:40 puma udev[15069]: main: called by hotplug
Jan 14 05:04:40 puma udev[15069]: udev_hotplug: looking at '/class/scsi_host/host19'
Jan 14 05:04:40 puma udev[15069]: udev_hotplug: don't care about 'scsi_host' devices
Jan 14 05:04:40 puma kernel: scsi19 : SCSI emulation for USB Mass Storage devices
Jan 14 05:04:40 puma scsi.agent[15071]: how to add device type= at /devices/pci0000:00/0000:00:1d.2/usb4/4-1/4-1:1.0/host19/19:0:0:0 ??
Jan 14 05:04:40 puma udev[15082]: main: version 013
Jan 14 05:04:40 puma udev[15082]: get_dirs: sysfs_path='/sys'
Jan 14 05:04:40 puma udev[15082]: parse_config_file: reading '/etc/udev/udev.conf' as config file
Jan 14 05:04:40 puma udev[15082]: main: called by hotplug
Jan 14 05:04:40 puma udev[15082]: udev_hotplug: looking at '/devices/pci0000:00/0000:00:1d.2/usb4/4-1/4-1:1.0/host19/19:0:0:0'
Jan 14 05:04:40 puma udev[15082]: udev_hotplug: not a block or class device
Jan 14 05:04:40 puma kernel:   Vendor: HP        Model: CD-Writer cd4f    Rev: 1.0A
Jan 14 05:04:40 puma kernel:   Type:   CD-ROM                             ANSI SCSI revision: 02
Jan 14 05:04:40 puma udev[15089]: main: version 013
Jan 14 05:04:40 puma udev[15089]: get_dirs: sysfs_path='/sys'
Jan 14 05:04:40 puma udev[15089]: parse_config_file: reading '/etc/udev/udev.conf' as config file
Jan 14 05:04:40 puma udev[15089]: main: called by hotplug
Jan 14 05:04:40 puma udev[15089]: udev_hotplug: looking at '/block/sr0'
Jan 14 05:04:40 puma udev[15089]: namedev_init_rules: reading '/etc/udev/udev.rules' as rules file
Jan 14 05:04:40 puma udev[15089]: namedev_init_permissions: reading '/etc/udev/udev.permissions' as permissions file
Jan 14 05:04:40 puma udev[15089]: sleep_for_dev: looking for '/sys/block/sr0/dev'
Jan 14 05:04:40 puma udev[15089]: get_class_dev: looking at '/sys/block/sr0'
Jan 14 05:04:40 puma udev[15089]: get_class_dev: class_dev->name='sr0'
Jan 14 05:04:40 puma udev[15089]: get_major_minor: dev='11:0 '
Jan 14 05:04:40 puma udev[15089]: get_major_minor: found major=11, minor=0
Jan 14 05:04:40 puma udev[15096]: main: version 013
Jan 14 05:04:40 puma udev[15096]: get_dirs: sysfs_path='/sys'
Jan 14 05:04:40 puma udev[15089]: get_sysfs_device: filename = /sys/block/sr0
Jan 14 05:04:40 puma udev[15096]: parse_config_file: reading '/etc/udev/udev.conf' as config file
Jan 14 05:04:40 puma udev[15089]: get_sysfs_device: temp2 = 
Jan 14 05:04:40 puma udev[15096]: main: called by hotplug
Jan 14 05:04:40 puma udev[15089]: get_sysfs_device: looking for '/sys/block/device'
Jan 14 05:04:40 puma udev[15096]: udev_hotplug: looking at '/class/scsi_device/19:0:0:0'
Jan 14 05:04:40 puma udev[15096]: udev_hotplug: don't care about 'scsi_device' devices
Jan 14 05:04:40 puma kernel: sr0: scsi3-mmc drive: 20x/20x writer cd/rw xa/form2 cdda pop-up
Jan 14 05:04:40 puma kernel: Attached scsi CD-ROM sr0 at scsi19, channel 0, id 0, lun 0
Jan 14 05:04:40 puma kernel: Attached scsi generic sg0 at scsi19, channel 0, id 0, lun 0,  type 5
Jan 14 05:04:40 puma kernel: WARNING: USB Mass Storage data integrity not assured
Jan 14 05:04:40 puma kernel: USB Mass Storage device found at 20
Jan 14 05:04:41 puma udev[15089]: get_sysfs_device: looking for '/sys/block/device'
Jan 14 05:04:42 puma udev[15089]: sysfs_path_is_link: stat() failed 
Jan 14 05:04:42 puma udev[15089]: sysfs_path_is_link: stat() failed 
Jan 14 05:04:42 puma udev[15089]: namedev_name_device: sysfs_device->path='/sys/devices/pci0000:00/0000:00:1d.2/usb4/4-1/4-1:1.0/host19/19:0:0:0'
Jan 14 05:04:42 puma udev[15089]: namedev_name_device: sysfs_device->bus_id='19:0:0:0'
Jan 14 05:04:42 puma udev[15089]: namedev_name_device: sysfs_device->bus='scsi'
Jan 14 05:04:42 puma udev[15089]: wait_for_device_to_initialize: looking for file 'vendor' on bus 'scsi'
Jan 14 05:04:42 puma udev[15089]: namedev_name_device: kernel_number='0'
Jan 14 05:04:42 puma udev[15089]: namedev_name_device: process rule
Jan 14 05:04:42 puma udev[15089]: namedev_name_device: check for BUS dev->bus='scsi' sysfs_device->bus='scsi'
Jan 14 05:04:42 puma udev[15089]: namedev_name_device: BUS matches
Jan 14 05:04:42 puma udev[15089]: namedev_name_device: check PROGRAM
Jan 14 05:04:42 puma udev[15089]: apply_format: substitute bus_id '19:0:0:0'
Jan 14 05:04:42 puma udev[15089]: execute_program: executing '/bin/echo -n test-19:0:0:0'
Jan 14 05:04:43 puma udev[15089]: execute_program: result is 'test-19:0:0:0'
Jan 14 05:04:43 puma udev[15089]: namedev_name_device: PROGRAM returned successful
Jan 14 05:04:43 puma udev[15089]: namedev_name_device: check for RESULT dev->result='test-42:0:0:1', udev->program_result='test-19:0:0:0'
Jan 14 05:04:43 puma udev[15089]: namedev_name_device: RESULT is not matching
Jan 14 05:04:43 puma udev[15089]: namedev_name_device: process rule
Jan 14 05:04:43 puma udev[15089]: namedev_name_device: check for BUS dev->bus='usb' sysfs_device->bus='scsi'
Jan 14 05:04:43 puma udev[15089]: namedev_name_device: BUS is not matching
Jan 14 05:04:43 puma udev[15089]: namedev_name_device: process rule
Jan 14 05:04:43 puma udev[15089]: namedev_name_device: check for BUS dev->bus='usb' sysfs_device->bus='scsi'
Jan 14 05:04:43 puma udev[15089]: namedev_name_device: BUS is not matching
Jan 14 05:04:43 puma udev[15089]: namedev_name_device: process rule
Jan 14 05:04:43 puma udev[15089]: namedev_name_device: check for BUS dev->bus='usb' sysfs_device->bus='scsi'
Jan 14 05:04:43 puma udev[15089]: namedev_name_device: BUS is not matching
Jan 14 05:04:43 puma udev[15089]: namedev_name_device: process rule
Jan 14 05:04:43 puma udev[15089]: namedev_name_device: check for BUS dev->bus='pci' sysfs_device->bus='scsi'
Jan 14 05:04:43 puma udev[15089]: namedev_name_device: BUS is not matching
Jan 14 05:04:43 puma udev[15089]: namedev_name_device: process rule
Jan 14 05:04:43 puma udev[15089]: namedev_name_device: check for BUS dev->bus='pci' sysfs_device->bus='scsi'
Jan 14 05:04:43 puma udev[15089]: namedev_name_device: BUS is not matching
Jan 14 05:04:43 puma udev[15089]: namedev_name_device: process rule
Jan 14 05:04:43 puma udev[15089]: namedev_name_device: check for BUS dev->bus='usb' sysfs_device->bus='scsi'
Jan 14 05:04:43 puma udev[15089]: namedev_name_device: BUS is not matching
Jan 14 05:04:43 puma udev[15089]: namedev_name_device: process rule
Jan 14 05:04:43 puma udev[15089]: namedev_name_device: check for BUS dev->bus='usb' sysfs_device->bus='scsi'
Jan 14 05:04:43 puma udev[15089]: namedev_name_device: BUS is not matching
Jan 14 05:04:43 puma udev[15089]: namedev_name_device: process rule
Jan 14 05:04:43 puma udev[15089]: namedev_name_device: check for BUS dev->bus='usb' sysfs_device->bus='scsi'
Jan 14 05:04:43 puma udev[15089]: namedev_name_device: BUS is not matching
Jan 14 05:04:43 puma udev[15089]: namedev_name_device: process rule
Jan 14 05:04:43 puma udev[15089]: namedev_name_device: check for KERNEL dev->kernel='ttyUSB1' class_dev->name='sr0'
Jan 14 05:04:43 puma udev[15089]: namedev_name_device: KERNEL is not matching
Jan 14 05:04:43 puma udev[15089]: namedev_name_device: process rule
Jan 14 05:04:43 puma udev[15089]: namedev_name_device: check for KERNEL dev->kernel='ttyUSB0' class_dev->name='sr0'
Jan 14 05:04:43 puma udev[15089]: namedev_name_device: KERNEL is not matching
Jan 14 05:04:43 puma udev[15089]: namedev_name_device: process rule
Jan 14 05:04:43 puma udev[15089]: namedev_name_device: check for BUS dev->bus='ide' sysfs_device->bus='scsi'
Jan 14 05:04:43 puma udev[15089]: namedev_name_device: BUS is not matching
Jan 14 05:04:43 puma udev[15089]: namedev_name_device: process rule
Jan 14 05:04:43 puma udev[15089]: namedev_name_device: check for KERNEL dev->kernel='dm-[0-9]*' class_dev->name='sr0'
Jan 14 05:04:43 puma udev[15089]: namedev_name_device: KERNEL is not matching
Jan 14 05:04:43 puma udev[15089]: namedev_name_device: process rule
Jan 14 05:04:43 puma udev[15089]: namedev_name_device: check for KERNEL dev->kernel='card*' class_dev->name='sr0'
Jan 14 05:04:43 puma udev[15089]: namedev_name_device: KERNEL is not matching
Jan 14 05:04:43 puma udev[15089]: namedev_name_device: process rule
Jan 14 05:04:43 puma udev[15089]: namedev_name_device: check for KERNEL dev->kernel='controlC[0-9]*' class_dev->name='sr0'
Jan 14 05:04:43 puma udev[15089]: namedev_name_device: KERNEL is not matching
Jan 14 05:04:43 puma udev[15089]: namedev_name_device: process rule
Jan 14 05:04:43 puma udev[15089]: namedev_name_device: check for KERNEL dev->kernel='hw[CD0-9]*' class_dev->name='sr0'
Jan 14 05:04:43 puma udev[15089]: namedev_name_device: KERNEL is not matching
Jan 14 05:04:43 puma udev[15089]: namedev_name_device: process rule
Jan 14 05:04:43 puma udev[15089]: namedev_name_device: check for KERNEL dev->kernel='pcm[CD0-9cp]*' class_dev->name='sr0'
Jan 14 05:04:43 puma udev[15089]: namedev_name_device: KERNEL is not matching
Jan 14 05:04:43 puma udev[15089]: namedev_name_device: process rule
Jan 14 05:04:43 puma udev[15089]: namedev_name_device: check for KERNEL dev->kernel='midi[CD0-9]*' class_dev->name='sr0'
Jan 14 05:04:43 puma udev[15089]: namedev_name_device: KERNEL is not matching
Jan 14 05:04:43 puma udev[15089]: namedev_name_device: process rule
Jan 14 05:04:43 puma udev[15089]: namedev_name_device: check for KERNEL dev->kernel='timer' class_dev->name='sr0'
Jan 14 05:04:43 puma udev[15089]: namedev_name_device: KERNEL is not matching
Jan 14 05:04:43 puma udev[15089]: namedev_name_device: process rule
Jan 14 05:04:43 puma udev[15089]: namedev_name_device: check for KERNEL dev->kernel='seq' class_dev->name='sr0'
Jan 14 05:04:43 puma udev[15089]: namedev_name_device: KERNEL is not matching
Jan 14 05:04:43 puma udev[15089]: namedev_name_device: name, 'sr0' is going to have owner='', group='', mode = 0600
Jan 14 05:04:43 puma udev[15089]: udev_add_device: name='sr0'
Jan 14 05:04:43 puma udev[15089]: create_node: mknod(/udev/sr0, 060600, 11, 0)
Jan 14 05:04:43 puma udev[15089]: create_node: chmod(/udev/sr0, 060600)
author
#4 lore raw
Quoted 1 line · Nuno Silva

I'm trying udev for the first time and I must say good work!

Thanks.

Quoted 7 lines

A sugestion and a question:

- Make udev print a /etc/udev/udev.rules line every time a device is found because default behaviour is too silent and "make DEBUG=true" is too noisy. This would make adding our private/static entries easily. Something like:

Quoted 5 lines

udev[1234]: found device BUS="scsi", SYSFS_model="CD-Writer cd4f", KERNEL="sr0", SYSFS_serial="AAAAAAAA"

This way one can easily make entries for a device with copy+paste, remove a few parameters and adding a few *'s

Yeah, but what exactly would udev print out? All of the sysfs files in the device it found? Would it print it out for every device that comes through? Or just for ones that no rule applied to?

Quoted 3 lines

- I have a USB cd-writer and udev makes /udev/sr0 but it doesn't create /udev/sg0. In the first run I had the hotplug packege from debian but I just installed hotplug-2004_01_05 and it's the same, no sg0 is created.

There is currently no sg sysfs support that works properly with udev. The scsi people know about this and are working on fixing it.

thanks,

greg k-h

-------------------------------------------------------
This SF.net email is sponsored by: Perforce Software. Perforce is the Fast Software Configuration Management System offering advanced branching capabilities and atomic changes on 50+ platforms. Free Eval! http://www.perforce.com/perforce/loadprog.html
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

author
#14 lore raw
In reply to Greg KH
Quoted 7 lines · Frédéric L. W. Meunier
Quoted 2 lines · Greg KH

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

Is it intentional to leave all those BitKeeper/ and SCCS/ directories ?

Yes. It gives anyone a entire bitkeeper tree, showing all change history, which is pretty informative.

If it really annoys you, send me a patch to the Makefile release target :)

thanks,

greg k-h

-------------------------------------------------------
This SF.net email is sponsored by: Perforce Software. Perforce is the Fast Software Configuration Management System offering advanced branching capabilities and atomic changes on 50+ platforms. Free Eval! http://www.perforce.com/perforce/loadprog.html
_______________________________________________
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 5 lines · Nuno Silva

A sugestion and a question:

- Make udev print a /etc/udev/udev.rules line every time a device is found because default behaviour is too silent and "make DEBUG=true" is too noisy.

Yeah, but what exactly would udev print out? All of the sysfs files in the device it found? Would it print it out for every device that comes through? Or just for ones that no rule applied to?

Maybe for ones with a matching rule, you could print something like:

udev[1234]: new device found matching rule <blah>, creating device node <nodename>

For ones that don't match any rules, you could dump out all the info:

udev[1234]: new device found with no matching rules, device info: blah blah

Chris

Signature · 16 lines
Chris Friesen                    | MailStop: 043/33/F10
Nortel Networks                  | work: (613) 765-0557
3500 Carling Avenue              | fax:  (613) 765-2986
Nepean, ON K2H 8E9 Canada        | email: [email protected]



-------------------------------------------------------
This SF.net email is sponsored by: Perforce Software.
Perforce is the Fast Software Configuration Management System offering
advanced branching capabilities and atomic changes on 50+ platforms.
Free Eval! http://www.perforce.com/perforce/loadprog.html
_______________________________________________
Linux-hotplug-devel mailing list  http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
#6 lore raw

Hi Chris!
Hi Greg!

Quoted 8 lines · Chris Friesen
Quoted 3 lines · Greg KH

Yeah, but what exactly would udev print out? All of the sysfs files in the device it found? Would it print it out for every device that comes through? Or just for ones that no rule applied to?

Quoted 9 lines

Maybe for ones with a matching rule, you could print something like:

udev[1234]: new device found matching rule <blah>, creating device node <nodename>

For ones that don't match any rules, you could dump out all the info:

udev[1234]: new device found with no matching rules, device info: blah blah

This would be nice but I think that full info for every new hotplugged device is even better. It's only 1 line :-)

Lame people, like myself, will make this rule:

BUS="scsi", SYSFS_model="CD-Writer cd4f*", KERNEL="sr*", NAME="cdrw"

When I connect a second drive (same model) /udev/cdrw will be overwritten. So I'd want to check the logs, find some difference between the two and create a new entry "myfriends-cdrw".

(I know that NAME="cdrw%n" would work but that depends on the order you plug things).

Regards,
Nuno Silva

-------------------------------------------------------
This SF.net email is sponsored by: Perforce Software. Perforce is the Fast Software Configuration Management System offering advanced branching capabilities and atomic changes on 50+ platforms. Free Eval! http://www.perforce.com/perforce/loadprog.html
_______________________________________________
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 Chris Friesen

On Wed, 14 Jan 2004, Chris Friesen spake thusly:

Quoted 4 lines

Maybe for ones with a matching rule, you could print something like:

Is the act of printing/syslogging a rule in an of itself?

Signature · 15 lines
Clay Haapala ([email protected]) Cisco Systems SRBU +1 763-398-1056
   6450 Wedgwood Rd, Suite 130 Maple Grove MN 55311 PGP: C89240AD
	   "Too bad marketing doesn't run on my computer."
			-- acousticiris, on /.


-------------------------------------------------------
This SF.net email is sponsored by: Perforce Software.
Perforce is the Fast Software Configuration Management System offering
advanced branching capabilities and atomic changes on 50+ platforms.
Free Eval! http://www.perforce.com/perforce/loadprog.html
_______________________________________________
Linux-hotplug-devel mailing list  http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
#11 lore raw
Quoted 1 line · Clay Haapala

Is the act of printing/syslogging a rule in an of itself?

I haven't looked at the capabilities in a while. Can you specify a default rule if nothing else matches? Can you, in one rule, specify another rule? (Kind of like iptables jump targets).

If so, then this would allow massive flexibility.

Chris

Signature · 16 lines
Chris Friesen                    | MailStop: 043/33/F10
Nortel Networks                  | work: (613) 765-0557
3500 Carling Avenue              | fax:  (613) 765-2986
Nepean, ON K2H 8E9 Canada        | email: [email protected]



-------------------------------------------------------
This SF.net email is sponsored by: Perforce Software.
Perforce is the Fast Software Configuration Management System offering
advanced branching capabilities and atomic changes on 50+ platforms.
Free Eval! http://www.perforce.com/perforce/loadprog.html
_______________________________________________
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 Clay Haapala
Quoted 6 lines · Clay Haapala

On Wed, 14 Jan 2004, Chris Friesen spake thusly:

Quoted 4 lines

Maybe for ones with a matching rule, you could print something like:

Is the act of printing/syslogging a rule in an of itself?

No, as currently the only way stuff ends up in the syslog is if DEBUG=true is used on the build line.

But it's sounding like we might want to change that... :)

thanks,

greg k-h

-------------------------------------------------------
This SF.net email is sponsored by: Perforce Software. Perforce is the Fast Software Configuration Management System offering advanced branching capabilities and atomic changes on 50+ platforms. Free Eval! http://www.perforce.com/perforce/loadprog.html
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

author
#12 lore raw
In reply to Chris Friesen
Quoted 6 lines · Chris Friesen
Quoted 1 line · Clay Haapala

Is the act of printing/syslogging a rule in an of itself?

I haven't looked at the capabilities in a while. Can you specify a default rule if nothing else matches?

The "default rule" is to use the kernel name to name the device. That one is built in.

Quoted 2 lines

Can you, in one rule, specify another rule? (Kind of like iptables jump targets).

No.

Quoted 1 line

If so, then this would allow massive flexibility.

And massive complexity :)

Why would you want to have a rule specify another (in the current syntax)? These rules aren't that complex, and anything that does grow to be complex should be shoved out into a separate script/program that a rule can then call.

Does this help?

thanks,

greg k-h

-------------------------------------------------------
This SF.net email is sponsored by: Perforce Software. Perforce is the Fast Software Configuration Management System offering advanced branching capabilities and atomic changes on 50+ platforms. Free Eval! http://www.perforce.com/perforce/loadprog.html
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

author
#7 lore raw
In reply to Nuno Silva
Quoted 2 lines · Nuno Silva

This would be nice but I think that full info for every new hotplugged device is even better. It's only 1 line :-)

Heh, care to make that one line patch? :)

Quoted 6 lines

Lame people, like myself, will make this rule:

BUS="scsi", SYSFS_model="CD-Writer cd4f*", KERNEL="sr*", NAME="cdrw"

When I connect a second drive (same model) /udev/cdrw will be overwritten.

No, the node will not be overwritten. The mknod() syscall will fail due to the node already being present. What would happen is that your new node would not be created.

Quoted 5 lines

So I'd want to check the logs, find some difference between the two and create a new entry "myfriends-cdrw".

(I know that NAME="cdrw%n" would work but that depends on the order you plug things).

Heh.

I'm thinking that having such a log message would be a good thing. Now to go figure out what log level to make those messages...

thanks,

greg k-h

-------------------------------------------------------
This SF.net email is sponsored by: Perforce Software. Perforce is the Fast Software Configuration Management System offering advanced branching capabilities and atomic changes on 50+ platforms. Free Eval! http://www.perforce.com/perforce/loadprog.html
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

#15 lore raw
In reply to Greg KH
Quoted 6 lines · Greg KH
Quoted 5 lines · Clay Haapala

On Wed, 14 Jan 2004, Chris Friesen spake thusly:

Quoted 4 lines

Maybe for ones with a matching rule, you could print something like:

Quoted 6 lines
Quoted 1 line

Is the act of printing/syslogging a rule in an of itself?

No, as currently the only way stuff ends up in the syslog is if DEBUG=true is used on the build line.

But it's sounding like we might want to change that... :)

How about this in the syslog after connect/disconnect?

  Jan 15 05:07:45 pim udev[28007]: configured rule in '/etc/udev/udev.rules' at line 17 applied, 'video*' becomes 'video/webcam%n'
  Jan 15 05:07:45 pim udev[28007]: creating device node '/udev/video/webcam0'
  Jan 15 05:07:47 pim udev[28015]: removing device node '/udev/video/webcam0'

Kay

Makefile +7 -0
diff -Nru a/Makefile b/Makefile
@@ -16,6 +16,9 @@
 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 #
 
+# Use of syslog
+LOG= true
+
 # Set the following to `true' to make a debuggable build.
 # Leave this set to `false' for production use.
 DEBUG = false
@@ -102,6 +105,10 @@
 	CFLAGS+=-pipe
 else
 	CFLAGS+=-pipe
+endif
+
+ifeq ($(strip $(LOG)),true)
+	CFLAGS  += -DLOG
 endif
 
 # if DEBUG is enabled, then we do not strip or optimize
logging.c +1 -1
diff -Nru a/logging.c b/logging.c
@@ -27,7 +27,7 @@
 #include <syslog.h>
 #include "udev.h"
 
-#ifdef DEBUG
+#ifdef LOG
 
 static int logging_init = 0;
 static unsigned char udev_logname[42];
namedev.c +7 -6
diff -Nru a/namedev.c b/namedev.c
@@ -295,12 +295,12 @@
 				/* sleep to give the kernel a chance to create the file */
 				sleep(1);
 			}
-			dbg("Timed out waiting for '%s' file, continuing on anyway...", b->file);
+			dbg("timed out waiting for '%s' file, continuing on anyway...", b->file);
 			goto exit;
 		}
 		b++;
 	}
-	dbg("Did not find bus type '%s' on list of bus_id_files, contact [email protected]", sysfs_device->bus);
+	dbg("did not find bus type '%s' on list of bus_id_files, contact [email protected]", sysfs_device->bus);
 exit:
 	return; /* here to prevent compiler warning... */
 }
@@ -544,7 +544,7 @@
 		if (sysfs_device != NULL)
 			goto device_found;
 	}
-	dbg("Timed out waiting for device symlink, continuing on anyway...");
+	dbg("timed out waiting for device symlink, continuing on anyway...");
 	
 device_found:
         /* We have another issue with just the wait above - the sysfs part of
@@ -569,10 +569,10 @@
 			if (sysfs_device->bus[0] != '\0')
 				goto bus_found;
 		}
-		dbg("Timed out waiting to find the device bus, continuing on anyway\n");
+		dbg("timed out waiting to find the device bus, continuing on anyway");
 		goto exit;
 bus_found:
-		dbg("Device %s is registered with bus %s\n",
+		dbg("device %s is registered with bus '%s'",
 				sysfs_device->name, sysfs_device->bus);
 	}
 exit:
@@ -704,7 +704,8 @@
 		}
 
 		/* Yup, this rule belongs to us! */
-		dbg("found matching rule, '%s' becomes '%s'", dev->kernel, dev->name);
+		info("configured rule in '%s' at line %i applied, '%s' becomes '%s'",
+		    udev_rules_filename, dev->config_line, dev->kernel, dev->name);
 		strfieldcpy(udev->name, dev->name);
 		strfieldcpy(udev->symlink, dev->symlink);
 		goto found;
namedev.h +1 -0
diff -Nru a/namedev.h b/namedev.h
@@ -65,6 +65,7 @@
 	char name[NAME_SIZE];
 	char symlink[NAME_SIZE];
 	struct sysfs_pair sysfs_pair[MAX_SYSFS_PAIRS];
+	int config_line;
 };
 
 struct perm_device {
namedev_parse.c +1 -0
diff -Nru a/namedev_parse.c b/namedev_parse.c
@@ -249,6 +249,7 @@
 			goto error;
 		}
 
+		dev.config_line = lineno;
 		retval = add_config_dev(&dev);
 		if (retval) {
 			dbg("add_config_dev returned with error %d", retval);
udev-add.c +1 -0
diff -Nru a/udev-add.c b/udev-add.c
@@ -141,6 +141,7 @@
 	if (strrchr(dev->name, '/'))
 		create_path(filename);
 
+	info("creating device node '%s'", filename);
 	dbg("mknod(%s, %#o, %u, %u)", filename, dev->mode, dev->major, dev->minor);
 	retval = mknod(filename, dev->mode, res);
 	if (retval)
udev-remove.c +1 -1
diff -Nru a/udev-remove.c b/udev-remove.c
@@ -73,7 +73,7 @@
 	strncpy(filename, udev_root, sizeof(filename));
 	strncat(filename, dev->name, sizeof(filename));
 
-	dbg("unlinking node '%s'", filename);
+	info("removing device node '%s'", filename);
 	retval = unlink(filename);
 	if (retval) {
 		dbg("unlink(%s) failed with error '%s'",
udev.h +10 -1
diff -Nru a/udev.h b/udev.h
@@ -26,8 +26,17 @@
 #include "libsysfs/libsysfs.h"
 #include <sys/param.h>
 
-#ifdef DEBUG
+#ifdef LOG
 #include <syslog.h>
+#define info(format, arg...)								\
+	do {										\
+		log_message (LOG_INFO , format , ## arg);	\
+	} while (0)
+#else
+	#define info(format, arg...) do { } while (0)
+#endif
+
+#ifdef DEBUG
 #define dbg(format, arg...)								\
 	do {										\
 		log_message (LOG_DEBUG , "%s: " format , __FUNCTION__ , ## arg);	\
#8 lore raw
In reply to Greg KH

Hi!

Quoted 7 lines · Greg KH
Quoted 1 line · Nuno Silva

This would be nice but I think that full info for every new hotplugged device is even better. It's only 1 line :-)

Heh, care to make that one line patch? :)

Ehehehe I was talking about the extra line ending up in syslog. :-)

Anyway, attached is a simple patch that outputs 50% of what I'd like to see - still missing the SYSFS_model, serial, etc because sysfs_get_classdev_attributes didn't work at my first try, but that's my faulty C showing :)

Thanks,
Nuno Silva

logging.c +0 -3
diff -Naur udev-013.orig/logging.c udev-013/logging.c
@@ -27,8 +27,6 @@
 #include <syslog.h>
 #include "udev.h"
 
-#ifdef DEBUG
-
 static int logging_init = 0;
 static unsigned char udev_logname[42];
 
@@ -55,4 +53,3 @@
 	return 1;
 }
 
-#endif
namedev.c +7 -0
diff -Naur udev-013.orig/namedev.c udev-013/namedev.c
@@ -748,6 +748,13 @@
 		udev->owner[0] = 0x00;
 		udev->group[0] = 0x00;
 	}
+	/* notify syslog and report some of the configuration: */
+	/* FIXME: add SYSFS_* nodes, too */
+	dbg_syslog("New device! Metrics: BUS='%s', ID='%s', KERNEL='%s'",
+	    sysfs_device->bus, sysfs_device->bus_id, class_dev->name);
+	dbg_syslog("name, '%s' is going to have owner='%s', group='%s', mode = %#o",
+	    udev->name, udev->owner, udev->group, udev->mode);
+
 	dbg("name, '%s' is going to have owner='%s', group='%s', mode = %#o",
 	    udev->name, udev->owner, udev->group, udev->mode);
 
udev.h +6 -1
diff -Naur udev-013.orig/udev.h udev-013/udev.h
@@ -25,9 +25,14 @@
 
 #include "libsysfs/libsysfs.h"
 #include <sys/param.h>
+#include <syslog.h>
+
+#define dbg_syslog(format, arg...)							\
+	do {										\
+		log_message (LOG_DEBUG , "%s: " format , __FUNCTION__ , ## arg);	\
+	} while (0)
 
 #ifdef DEBUG
-#include <syslog.h>
 #define dbg(format, arg...)								\
 	do {										\
 		log_message (LOG_DEBUG , "%s: " format , __FUNCTION__ , ## arg);	\
#16 lore raw
In reply to Greg KH
Quoted 12 lines · Kay Sievers
Quoted 11 lines · Greg KH
Quoted 6 lines · Clay Haapala

On Wed, 14 Jan 2004, Chris Friesen spake thusly:

Quoted 4 lines

Maybe for ones with a matching rule, you could print something like:

Is the act of printing/syslogging a rule in an of itself?

No, as currently the only way stuff ends up in the syslog is if DEBUG=true is used on the build line.

Quoted 7 lines
Quoted 1 line

But it's sounding like we might want to change that... :)

How about this in the syslog after connect/disconnect?

  Jan 15 05:07:45 pim udev[28007]: configured rule in '/etc/udev/udev.rules' at line 17 applied, 'video*' becomes 'video/webcam%n'
  Jan 15 05:07:45 pim udev[28007]: creating device node '/udev/video/webcam0'
  Jan 15 05:07:47 pim udev[28015]: removing device node '/udev/video/webcam0'

Here is a slightly better version. I've created a logging.h file and moved the debug macros from udev.h in there.

If you type:

'make' - you will get a binary that prints one or two lines to syslog
if a device node is created or deleted

'make LOG=false' - you get a binary that prints asolutely nothing

'make DEBUG=true' - the same as today, it will print all debug lines

thanks,
Kay

Makefile +11 -2
diff -Nru a/Makefile b/Makefile
@@ -16,7 +16,12 @@
 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 #
 
-# Set the following to `true' to make a debuggable build.
+# Set the following to control the use of syslog
+# Set it to `false' to remove all logging
+LOG = true
+
+# Set the following to `true' to log the debug
+# and make a unstripped, unoptimized  binary.
 # Leave this set to `false' for production use.
 DEBUG = false
 
@@ -104,6 +109,10 @@
 	CFLAGS+=-pipe
 endif
 
+ifeq ($(strip $(LOG)),true)
+	CFLAGS  += -DLOG
+endif
+
 # if DEBUG is enabled, then we do not strip or optimize
 ifeq ($(strip $(DEBUG)),true)
 	CFLAGS  += $(WARNINGS) -O1 -g -DDEBUG -D_GNU_SOURCE
@@ -216,7 +225,7 @@
 
 $(OBJS): $(GEN_HEADERS)
 
-$(ROOT): $(OBJS) udev.h namedev.h udev_version.h udev_dbus.h udevdb.h klibc_fixups.h list.h
+$(ROOT): $(OBJS) udev.h namedev.h udev_version.h udev_dbus.h udevdb.h klibc_fixups.h logging.h list.h
 	$(LD) $(LDFLAGS) -o $(ROOT) $(CRT0) $(OBJS) $(LIB_OBJS) $(ARCH_LIB_OBJS)
 	$(STRIPCMD) $(ROOT)
 
logging.c +2 -4
diff -Nru a/logging.c b/logging.c
@@ -25,9 +25,9 @@
 #include <sys/types.h>
 #include <unistd.h>
 #include <syslog.h>
-#include "udev.h"
 
-#ifdef DEBUG
+#include "logging.h"
+
 
 static int logging_init = 0;
 static unsigned char udev_logname[42];
@@ -54,5 +54,3 @@
 	va_end(args);
 	return 1;
 }
-
-#endif
logging.h new file +60 -0

60 lines not on this page · raw message

namedev.c +8 -6
diff -Nru a/namedev.c b/namedev.c
@@ -36,6 +36,7 @@
 #include "list.h"
 #include "udev.h"
 #include "udev_version.h"
+#include "logging.h"
 #include "namedev.h"
 #include "libsysfs/libsysfs.h"
 #include "klibc_fixups.h"
@@ -295,12 +296,12 @@
 				/* sleep to give the kernel a chance to create the file */
 				sleep(1);
 			}
-			dbg("Timed out waiting for '%s' file, continuing on anyway...", b->file);
+			dbg("timed out waiting for '%s' file, continuing on anyway...", b->file);
 			goto exit;
 		}
 		b++;
 	}
-	dbg("Did not find bus type '%s' on list of bus_id_files, contact [email protected]", sysfs_device->bus);
+	dbg("did not find bus type '%s' on list of bus_id_files, contact [email protected]", sysfs_device->bus);
 exit:
 	return; /* here to prevent compiler warning... */
 }
@@ -544,7 +545,7 @@
 		if (sysfs_device != NULL)
 			goto device_found;
 	}
-	dbg("Timed out waiting for device symlink, continuing on anyway...");
+	dbg("timed out waiting for device symlink, continuing on anyway...");
 	
 device_found:
         /* We have another issue with just the wait above - the sysfs part of
@@ -569,10 +570,10 @@
 			if (sysfs_device->bus[0] != '\0')
 				goto bus_found;
 		}
-		dbg("Timed out waiting to find the device bus, continuing on anyway\n");
+		dbg("timed out waiting to find the device bus, continuing on anyway");
 		goto exit;
 bus_found:
-		dbg("Device %s is registered with bus %s\n",
+		dbg("device %s is registered with bus '%s'",
 				sysfs_device->name, sysfs_device->bus);
 	}
 exit:
@@ -704,7 +705,8 @@
 		}
 
 		/* Yup, this rule belongs to us! */
-		dbg("found matching rule, '%s' becomes '%s'", dev->kernel, dev->name);
+		info("configured rule in '%s' at line %i applied, '%s' becomes '%s'",
+		    udev_rules_filename, dev->config_line, udev->kernel_name, dev->name);
 		strfieldcpy(udev->name, dev->name);
 		strfieldcpy(udev->symlink, dev->symlink);
 		goto found;
namedev.h +1 -0
diff -Nru a/namedev.h b/namedev.h
@@ -65,6 +65,7 @@
 	char name[NAME_SIZE];
 	char symlink[NAME_SIZE];
 	struct sysfs_pair sysfs_pair[MAX_SYSFS_PAIRS];
+	int config_line;
 };
 
 struct perm_device {
namedev_parse.c +2 -0
diff -Nru a/namedev_parse.c b/namedev_parse.c
@@ -36,6 +36,7 @@
 #include <errno.h>
 
 #include "udev.h"
+#include "logging.h"
 #include "namedev.h"
 
 static int add_config_dev(struct config_device *new_dev)
@@ -249,6 +250,7 @@
 			goto error;
 		}
 
+		dev.config_line = lineno;
 		retval = add_config_dev(&dev);
 		if (retval) {
 			dbg("add_config_dev returned with error %d", retval);
udev-add.c +2 -0
diff -Nru a/udev-add.c b/udev-add.c
@@ -37,6 +37,7 @@
 #include "udev.h"
 #include "udev_version.h"
 #include "udev_dbus.h"
+#include "logging.h"
 #include "namedev.h"
 #include "udevdb.h"
 #include "libsysfs/libsysfs.h"
@@ -141,6 +142,7 @@
 	if (strrchr(dev->name, '/'))
 		create_path(filename);
 
+	info("creating device node '%s'", filename);
 	dbg("mknod(%s, %#o, %u, %u)", filename, dev->mode, dev->major, dev->minor);
 	retval = mknod(filename, dev->mode, res);
 	if (retval)
udev-remove.c +2 -1
diff -Nru a/udev-remove.c b/udev-remove.c
@@ -31,6 +31,7 @@
 #include "udev.h"
 #include "udev_version.h"
 #include "udev_dbus.h"
+#include "logging.h"
 #include "namedev.h"
 #include "udevdb.h"
 #include "libsysfs/libsysfs.h"
@@ -73,7 +74,7 @@
 	strncpy(filename, udev_root, sizeof(filename));
 	strncat(filename, dev->name, sizeof(filename));
 
-	dbg("unlinking node '%s'", filename);
+	info("removing device node '%s'", filename);
 	retval = unlink(filename);
 	if (retval) {
 		dbg("unlink(%s) failed with error '%s'",
udev.c +1 -0
diff -Nru a/udev.c b/udev.c
@@ -34,6 +34,7 @@
 #include "udev.h"
 #include "udev_version.h"
 #include "udev_dbus.h"
+#include "logging.h"
 #include "namedev.h"
 #include "udevdb.h"
 #include "libsysfs/libsysfs.h"
udev.h +0 -25
diff -Nru a/udev.h b/udev.h
@@ -26,30 +26,6 @@
 #include "libsysfs/libsysfs.h"
 #include <sys/param.h>
 
-#ifdef DEBUG
-#include <syslog.h>
-#define dbg(format, arg...)								\
-	do {										\
-		log_message (LOG_DEBUG , "%s: " format , __FUNCTION__ , ## arg);	\
-	} while (0)
-#else
-	#define dbg(format, arg...) do { } while (0)
-#endif
-
-/* Parser needs it's own debugging statement, we usually don't care about this at all */
-#ifdef DEBUG_PARSER
-#define dbg_parse(format, arg...)							\
-	do {										\
-		log_message (LOG_DEBUG , "%s: " format , __FUNCTION__ , ## arg);	\
-	} while (0)
-#else
-	#define dbg_parse(format, arg...) do { } while (0)
-#endif
-
-
-extern int log_message (int level, const char *format, ...)
-	__attribute__ ((format (printf, 2, 3)));
-
 #define COMMENT_CHARACTER		'#'
 
 #define NAME_SIZE	100
@@ -71,7 +47,6 @@
 	unsigned char program_result[NAME_SIZE];
 	unsigned char kernel_number[NAME_SIZE];
 	unsigned char kernel_name[NAME_SIZE];
-
 };
 
 #define strfieldcpy(to, from) \
udev_config.c +1 -0
diff -Nru a/udev_config.c b/udev_config.c
@@ -34,6 +34,7 @@
 
 #include "udev.h"
 #include "udev_version.h"
+#include "logging.h"
 #include "namedev.h"
 #include "libsysfs/libsysfs.h"
 
udevdb.c +1 -0
diff -Nru a/udevdb.c b/udevdb.c
@@ -35,6 +35,7 @@
 
 #include "udev_version.h"
 #include "udev.h"
+#include "logging.h"
 #include "namedev.h"
 #include "udevdb.h"
 #include "tdb/tdb.h"
author
#17 lore raw
In reply to Greg KH
Quoted 15 lines · Kay Sievers
Quoted 14 lines · Kay Sievers
Quoted 12 lines · Greg KH
Quoted 6 lines · Clay Haapala

On Wed, 14 Jan 2004, Chris Friesen spake thusly:

Quoted 4 lines

Maybe for ones with a matching rule, you could print something like:

Is the act of printing/syslogging a rule in an of itself?

No, as currently the only way stuff ends up in the syslog is if DEBUG=true is used on the build line.

But it's sounding like we might want to change that... :)

Quoted 8 lines
Quoted 5 lines

How about this in the syslog after connect/disconnect?

  Jan 15 05:07:45 pim udev[28007]: configured rule in '/etc/udev/udev.rules' at line 17 applied, 'video*' becomes 'video/webcam%n'
  Jan 15 05:07:45 pim udev[28007]: creating device node '/udev/video/webcam0'
  Jan 15 05:07:47 pim udev[28015]: removing device node '/udev/video/webcam0'

Here is a slightly better version. I've created a logging.h file and moved the debug macros from udev.h in there.

Nice, I've applied this, and made a few tweaks to the build stuff to make it more like the other build options (USE_LOG instead of just LOG).

thanks,

greg k-h

-------------------------------------------------------
The SF.Net email is sponsored by EclipseCon 2004
Premiere Conference on Open Tools Development and Integration See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
http://www.eclipsecon.org/osdn
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

author
#9 lore raw
In reply to Nuno Silva
Quoted 12 lines · Nuno Silva

Hi!

Quoted 8 lines · Greg KH
Quoted 2 lines · Nuno Silva

This would be nice but I think that full info for every new hotplugged device is even better. It's only 1 line :-)

Heh, care to make that one line patch? :)

Quoted 6 lines

Ehehehe I was talking about the extra line ending up in syslog. :-)

Anyway, attached is a simple patch that outputs 50% of what I'd like to see - still missing the SYSFS_model, serial, etc because sysfs_get_classdev_attributes didn't work at my first try, but that's my faulty C showing :)

Hm, I just took Kay's patch instead. Care to make up a patch for this based off of it?

thanks,

greg k-h

-------------------------------------------------------
The SF.Net email is sponsored by EclipseCon 2004
Premiere Conference on Open Tools Development and Integration See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
http://www.eclipsecon.org/osdn
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

#18 lore raw
In reply to Greg KH

[CC to lkml removed and I'm not in linux-hotplug-devl]

Hi!

Quoted 4 lines · Greg KH

Hm, I just took Kay's patch instead. Care to make up a patch for this based off of it?

You did the right thing :-) Now it's simplier and is almost a one-liner. (Anyway, still missing the SYSFS_* details).

Sample output:

Jan 16 01:53:42 puma udev[18505]: New device! Metrics: BUS='scsi', ID='71:0:0:0', KERNEL='sr0'
Jan 16 01:53:42 puma udev[18505]: name, 'sr0' is going to have owner='', group='', mode = 0600
Jan 16 01:53:42 puma udev[18505]: creating device node '/udev/sr0'

...

Jan 16 01:57:07 puma udev[18779]: New device! Metrics: BUS='scsi', ID='72:0:0:0', KERNEL='sda'
Jan 16 01:57:07 puma udev[18779]: name, 'sda' is going to have owner='', group='', mode = 0600
Jan 16 01:57:07 puma udev[18779]: creating device node '/udev/sda'

...

Jan 16 01:57:18 puma udev[18791]: New device! Metrics: BUS='usb', ID='5-1:1.1', KERNEL='lp0'
Jan 16 01:57:18 puma udev[18791]: name, 'lp0' is going to have owner='', group='', mode = 0600
Jan 16 01:57:18 puma udev[18791]: creating device node '/udev/lp0'

I think this output is nice, easy to read and /etc/udev/rules oriented so, sooner or later, people will find it "natural".

Thanks,
Nuno Silva

namedev.c +7 -0
diff -Naur udev/namedev.c udev-report/namedev.c
@@ -723,6 +723,13 @@
 		udev->owner[0] = 0x00;
 		udev->group[0] = 0x00;
 	}
+	/* notify syslog and report some of the configuration: */
+	/* FIXME: add SYSFS_* nodes, too */
+	info("New device! Metrics: BUS='%s', ID='%s', KERNEL='%s'",
+	    sysfs_device->bus, sysfs_device->bus_id, class_dev->name);
+	info("name, '%s' is going to have owner='%s', group='%s', mode = %#o",
+	    udev->name, udev->owner, udev->group, udev->mode);
+
 	dbg("name, '%s' is going to have owner='%s', group='%s', mode = %#o",
 	    udev->name, udev->owner, udev->group, udev->mode);
 
#19 lore raw
In reply to Greg KH
Quoted 19 lines · Nuno Silva
Quoted 4 lines · Greg KH

Hm, I just took Kay's patch instead. Care to make up a patch for this based off of it?

You did the right thing :-) Now it's simplier and is almost a one-liner. (Anyway, still missing the SYSFS_* details).

Sample output:

Jan 16 01:53:42 puma udev[18505]: New device! Metrics: BUS='scsi', 
ID='71:0:0:0', KERNEL='sr0'
Jan 16 01:53:42 puma udev[18505]: name, 'sr0' is going to have owner='', 
group='', mode = 0600
Jan 16 01:53:42 puma udev[18505]: creating device node '/udev/sr0'

I think this output is nice, easy to read and /etc/udev/rules oriented so, sooner or later, people will find it "natural".

Review

Quoted 2 lines
(quoted diff) +2 -0
+	info("New device! Metrics: BUS='%s', ID='%s', KERNEL='%s'",
+	    sysfs_device->bus, sysfs_device->bus_id, class_dev->name);

Huh, what if sysfs_device = NULL ?
And why print it, if we apply a configured rule to a known device?

Kay

-------------------------------------------------------
The SF.Net email is sponsored by EclipseCon 2004
Premiere Conference on Open Tools Development and Integration See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
http://www.eclipsecon.org/osdn
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

#20 lore raw
In reply to Greg KH

Hi!

Quoted 6 lines · Kay Sievers

Review

Quoted 3 lines
(quoted diff) +2 -0
+	info("New device! Metrics: BUS='%s', ID='%s', KERNEL='%s'",
+	    sysfs_device->bus, sysfs_device->bus_id, class_dev->name);

Huh, what if sysfs_device = NULL ?

This is only to show what I'd like to see.

That combined with the 15 mins that I looked at it and my lack of understandaing about sysfslib/udev can be dangerous :-)

But, (bad) implementations apart, don't you think it's a good ideia to report information in this format?

Quoted 2 lines

And why print it, if we apply a configured rule to a known device?

I don't have rules for any of those devices. They were caught by the catch-all rule.

Regards,
Nuno Silva

-------------------------------------------------------
The SF.Net email is sponsored by EclipseCon 2004
Premiere Conference on Open Tools Development and Integration See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
http://www.eclipsecon.org/osdn
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

#21 lore raw
In reply to Greg KH

Review

Quoted 9 lines · Kay Sievers

+++ b/logging.h Thu Jan 15 15:22:25 2004

(quoted diff) +6 -0
+#ifdef LOG
+#include <syslog.h>
 
+#ifdef DEBUG
+#define dbg(format, arg...)								\
+	do {										\
+		log_message (LOG_DEBUG , "%s: " format , __FUNCTION__ , ## arg);	\

This breaks with:

make udevdir=/dev USE_LOGúlse USE_KLIBC=true DEBUG=true STRIP=/bin/true -j

syslog.h does not depend on -DLOG

Signature · 14 lines
USB is for mice, FireWire is for men!

sUse lINUX ag, nÜRNBERG


-------------------------------------------------------
The SF.Net email is sponsored by EclipseCon 2004
Premiere Conference on Open Tools Development and Integration
See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
http://www.eclipsecon.org/osdn
_______________________________________________
Linux-hotplug-devel mailing list  http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
author
#22 lore raw
In reply to Greg KH
Quoted 14 lines · Olaf Hering

Review

Quoted 9 lines · Kay Sievers

+++ b/logging.h Thu Jan 15 15:22:25 2004

(quoted diff) +6 -0
+#ifdef LOG
+#include <syslog.h>
 
+#ifdef DEBUG
+#define dbg(format, arg...)								\
+	do {										\
+		log_message (LOG_DEBUG , "%s: " format , __FUNCTION__ , ## arg);	\

This breaks with:

Quoted 3 lines

make udevdir=/dev USE_LOGúlse USE_KLIBC=true DEBUG=true STRIP=/bin/true -j

syslog.h does not depend on -DLOG

Ick. This patch should fix this problem.

If you make USE_LOGúlse, no debug messages will be sent out.

thanks,

greg k-h

=== logging.h 1.2 vs edited ==--- 1.2/logging.h Thu Jan 15 14:00:58 2004
+++ edited/logging.h Mon Jan 19 12:37:42 2004
@@ -24,35 +24,37 @@
#ifndef LOGGING_H
#define LOGGING_H

+#define info(format, arg...) do { } while (0)
+#define dbg(format, arg...) do { } while (0)
+#define dbg_parse(format, arg...) do { } while (0)
+
#ifdef LOG
#include <syslog.h>
+
+#undef info
#define info(format, arg...) \
do { \
log_message (LOG_INFO , format , ## arg); \
} while (0)
-#else
- #define info(format, arg...) do { } while (0)
-#endif

#ifdef DEBUG
+#undef dbg
#define dbg(format, arg...) \
do { \
log_message (LOG_DEBUG , "%s: " format , __FUNCTION__ , ## arg); \
} while (0)
-#else
- #define dbg(format, arg...) do { } while (0)
#endif

/* Parser needs it's own debugging statement, we usually don't care about this at all */ #ifdef DEBUG_PARSER
+#undef dbg_parse
#define dbg_parse(format, arg...) \
do { \
log_message (LOG_DEBUG , "%s: " format , __FUNCTION__ , ## arg); \
} while (0)
-#else
- #define dbg_parse(format, arg...) do { } while (0)
#endif

+#endif /* LOG */

extern int log_message (int level, const char *format, ...)
__attribute__ ((format (printf, 2, 3)));

-------------------------------------------------------
The SF.Net email is sponsored by EclipseCon 2004
Premiere Conference on Open Tools Development and Integration See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
http://www.eclipsecon.org/osdn
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

#23 lore raw
In reply to Greg KH
Quoted 15 lines · Greg KH
Quoted 14 lines · Olaf Hering

Review

Quoted 9 lines · Kay Sievers

+++ b/logging.h Thu Jan 15 15:22:25 2004

(quoted diff) +6 -0
+#ifdef LOG
+#include <syslog.h>
 
+#ifdef DEBUG
+#define dbg(format, arg...)								\
+	do {										\
+		log_message (LOG_DEBUG , "%s: " format , __FUNCTION__ , ## arg);	\

This breaks with:

Quoted 7 lines
Quoted 3 lines

make udevdir=/dev USE_LOGúlse USE_KLIBC=true DEBUG=true STRIP=/bin/true -j

syslog.h does not depend on -DLOG

Ick. This patch should fix this problem.

If you make USE_LOGúlse, no debug messages will be sent out.

Is this correct? LOG_DEBUG is defined in syslog.h, this patch is probably better.

logging.h 2004-01-19 20:31:46.000000000 +0000 renamed from logging.h~ 2004-01-15 22:00:58.000000000 +0000 +2 -1
@@ -24,8 +24,9 @@
 #ifndef LOGGING_H
 #define LOGGING_H
 
-#ifdef LOG
 #include <syslog.h>
+
+#ifdef LOG
 #define info(format, arg...)                                                           \
        do {                                                                            \
                log_message (LOG_INFO , format , ## arg);       \
Signature · 14 lines
USB is for mice, FireWire is for men!

sUse lINUX ag, nÜRNBERG


-------------------------------------------------------
The SF.Net email is sponsored by EclipseCon 2004
Premiere Conference on Open Tools Development and Integration
See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
http://www.eclipsecon.org/osdn
_______________________________________________
Linux-hotplug-devel mailing list  http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
author
#24 lore raw
In reply to Greg KH
Quoted 19 lines · Olaf Hering
Quoted 17 lines · Greg KH
Quoted 16 lines · Olaf Hering

Review

Quoted 9 lines · Kay Sievers

+++ b/logging.h Thu Jan 15 15:22:25 2004

(quoted diff) +6 -0
+#ifdef LOG
+#include <syslog.h>
 
+#ifdef DEBUG
+#define dbg(format, arg...)								\
+	do {										\
+		log_message (LOG_DEBUG , "%s: " format , __FUNCTION__ , ## arg);	\

This breaks with:

make udevdir=/dev USE_LOGúlse USE_KLIBC=true DEBUG=true STRIP=/bin/true -j

Quoted 8 lines
Quoted 5 lines
Quoted 1 line

syslog.h does not depend on -DLOG

Ick. This patch should fix this problem.

If you make USE_LOGúlse, no debug messages will be sent out.

Is this correct? LOG_DEBUG is defined in syslog.h, this patch is probably better.

Hm, but my patch will fix the problem when DEBUGúlse, yet someone goes and enables DEBUG_PARSER on their own. That always annoys me :)

thanks,

greg k-h

-------------------------------------------------------
The SF.Net email is sponsored by EclipseCon 2004
Premiere Conference on Open Tools Development and Integration See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
http://www.eclipsecon.org/osdn
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel