Alexander E. Patrakov wrote:

> "where from (LFS or BLFS) should the reader know the reason for this
> complicated setup?". Yes, LFS has the page
> http://www.linuxfromscratch.org/lfs/view/6.1/chapter07/udev.html which
> says "Note that on slower machines or for drivers that create a lot of
> device nodes, the process of creating devices may take a few seconds to
> complete. This means that some device nodes may not be immediately
> accessible." However, this is insufficient, because the page doesn't
> stress the essential fact that they are created _in the background_
> after a modprobe command (as opposed to after udevstart). Also this
> (rather abstract) context without any (suitable for LFS) examples might
> be not the best place to illustrate the race.
> 

I would like to add that BLFS _may_ need to have a page on udev rules
soon anyway, which would explain away our reasoning for this complicated
setup for ALSA.  Recently there was talk of striping the rules file down
to what LFS needs.  I don't disagree with this happening.  And this new
page would be the perfect place to explain further the issues
surrounding udev, a good portion (if not all) taken from Alexander's
comments.  Thanks in advance Alexander.

The rules files are numbered to allow us to extend the rules as needed.
 I currently use the cdsymlinks script included in the extras directory
in the udev distribution.  Included for example is my
20-optical-devices.rules file to handle creating the symlinks for my
optical drives.  I've included it below for example.  It looks pretty
hairy, but it's really not bad with a good explanation.  Lower number
rules override higher number rules so that the /dev/cdrom symlink is
handled here instead of by the line in 25-lfs.rules or 50-udev.rules.  I
personally only need the first rule (see below), but have included all
three.  This, or a custom rule, should be added to the multimedia
section (maybe CD-RW section too) of the book to create the /dev/dvd
symlink.

Anyway, I really do think this is the way we should proceed with ALSA.
It stinks that the functionality has changed so recently with dev.d and
hotplug.d being depreciated.  Even without being fully versed WRT
udev/hotplug, I feel that it will be much better in that there is only
one place to make changes instead of three.

Here is the example script, which is explained in the cdsymlinks.sh
script and the udev documents udev-056/docs/writing_udev_rules/index.html:

# Begin /etc/udev/rules.d/20-optical-devices.rules

BUS="ide", KERNEL="hd[a-z]", PROGRAM="/etc/udev/scripts/cdsymlinks.sh
%k", SYMLINK="%c{1} %c{2} %c{3} %c{4} %c{5} %c{6}", OWNER="root",
GROUP="optical", MODE="660"

BUS="scsi", KERNEL="sr[0-9]*", PROGRAM="/etc/udev/scripts/cdsymlinks.sh
%k", SYMLINK="%c{1} %c{2} %c{3} %c{4} %c{5} %c{6}", OWNER="root",
GROUP="optical", MODE="660"

BUS="scsi", KERNEL="scd[0-9]*", PROGRAM="/etc/udev/scripts/cdsymlinks.sh
%k", SYMLINK="%c{1} %c{2} %c{3} %c{4} %c{5} %c{6}", OWNER="root",
GROUP="optical", MODE="660"

# End /etc/udev/rules.d/20-optical-devices.rules

-- DJ Lucas
-- 
http://linuxfromscratch.org/mailman/listinfo/blfs-dev
FAQ: http://www.linuxfromscratch.org/blfs/faq.html
Unsubscribe: See the above information page

Reply via email to