Udev changes

Alexander E. Patrakov patrakov at ums.usu.ru
Thu Oct 27 01:57:21 PDT 2005


Duncan Webb wrote:
> Matthew Burgess wrote:
> 
>> Forwarding from blfs-dev, where an ALSA related thread went just a 
>> little off-topic for BLFS :)
>> 2) Add these two rules to LFS default rules file:
>>
>> ENV{UDEVD_EVENT}=="1", RUN+="/sbin/udev_run_hotplugd"
>> RUN+="/sbin/udev_run_devd"
> 
> 
> Don't think that RUN+="/sbin/udev_run_devd" is requires for LFS as it 
> doesn't use devfs any more.

This is not for devfs! This is for compatibility with obsolete packages 
that still install scriptlets into /etc/dev.d. I.e., after /dev/lp0 is 
created, this rule executes the following scripts if they exist:

         /etc/dev.d/lp0/*.dev
         /etc/dev.d/printer/*.dev
         /etc/dev.d/default/*.dev

This may be used in order to download firmware into certain printers 
(/etc/dev.d/lp0/firmware.dev contains "#!/bin/sh cat firmware >/dev/lp0" 
then). More modern approach is to use RUN+=... rules instead of dev.d 
scriptlets. BTW BLFS 6.1 uses a dev.d scriptlet for ALSA volume 
restoration (BLFS SVN converted this to the RUN rule).

So you are right that LFS and BLFS SVN contain no such obsolete packages 
that need /etc/dev.d.

> I think that you can also add:
> Add the rules to /etc/udev/rules.d/60-hotplug.rules
> #
> # usbfs-like device nodes
> SUBSYSTEM="usb_device", PROGRAM="/bin/sh -c 'X=%k X=$${X#usbdev} 
> B=$${X%%%%.*} D=$${X#*.}; echo bus/usb/$$B/$$D'", SYMLINK+="%c"

Only after linux-2.6.14 please, and synchronously with patching libusb 
in BLFS and removing the /proc/bus/usb mount. But those rules will of 
course do no harm with earlier kernel.

> # be backward compatible for a while with the /etc/dev.d and 
> /etc/hotplug.d/ systems
> # run /etc/hotplug.d/ stuff only if we came from a hotplug event, not 
> for udevstart
> ENV{UDEVD_EVENT}=="1", RUN+="/sbin/udev_run_hotplugd"

Correct. But that alone doesn't run /etc/dev.d stuff, you need 
RUN+="/sbin/udev_run_devd" for that.

> I'm not 100% sure but I think that pciutils (plus 
> pcimodules-pciutils-2.1.11.diff patch) and usbutils are also needed.

They are needed with 2.4 kernels only (i.e.: not needed at all in LFS) 
for hotplug to work correctly. All the needed information is gathered 
from sysfs with 2.6 kernels.

> To log hotplug events you could also add:

What's wrong with the current way to log events into 
/var/log/hotplug/events?

> BTW Acpid is also quite useful for laptops and powering down by a quick 
> press of the power button.

Sure! but that's on-topic for blfs-dev.

-- 
Alexander E. Patrakov



More information about the lfs-dev mailing list