DJ Lucas wrote:

Okay, I need a bit of udev help.  I want to write a rule to create a dvd
synlink.  The /proc/ide/hdb/model file contains the string "DVD" with
some other text.  I got around that using "grep 'DVD'" in a PROGRAM
field set.  This is fine for *my* setup, but I want this thing to be
generic for optical devices as I may suggest a modified version for use
in BLFS later on if it works out well.  So, the first question I have to
ask...Is there a better way to determine dvd from cdrom?  There has got
to be, but it's not readily apearent to me.

Next, I want to distinguish writeable from not writeable.  Again, I used
a PROGRAM field with "grep 'write-only'" in /proc/ide/%k/settings.
There is probably a better way for that too.  But the next problem, it
doesn't seem that I can combine two PROGRAM fields in the same
rule.  Right now my second hard drive (hdf) has symlinks for dvd and
dvdrw. :-)  This means that either the second PROGRAM field took
precedence, or my model ID on that HDD contains the string DVD (which it
doesn't).  Another thing I didn't understand about that is that I would
have thought hda would come as the first match, so it is
overwriting the link on every pass.  Is there a way to avoid this or did
I miss something obvious?  I'm pretty sure there are better ways
to detect both of these variables in sysfs or proc, I just don't know
where to look.

Here is the failing rule for those interested:

# Create the /dev/dvdrw symlink (implies dvd):
BUS="ide", KERNEL="*[!0-9]", PROGRAM="/bin/grep 'DVD'
/proc/ide/%k/model", PROGRAM="/bin/grep 'write-only'
/proc/ide/%k/settings", NAME="%k", SYMLINK="dvdrw dvd"

It is the first uncommented rule in the file and probably matches every
ide device in the system assuming it awarded only the second PROGRAM field.

TIA.

-- DJ Lucas


DJ, in udev there is a program called cdsymlinks, that can do this already. BLFS is going to need a udev section to add this in from the udev-xxx/extras directory along with it's configuration file.

--
------
[EMAIL PROTECTED]
[EMAIL PROTECTED]

LFS User # 2577
Registered Linux User # 299986

--
http://linuxfromscratch.org/mailman/listinfo/lfs-support
FAQ: http://www.linuxfromscratch.org/lfs/faq.html
Unsubscribe: See the above information page

Reply via email to