On Wed, 2007-05-02 at 17:54 -0400, Mike Frysinger wrote:
> there are a few common/important set of device nodes that only work when in 
> the proper subdirectory ... for example, all of ALSA userland requires the 
> sound nodes to be in /dev/snd/ and all of the input device nodes need to be 
> in /dev/input/
> 
> we're using the attached patch by Sonic Zhang in our Blackfin distribution 
> ... 
> it simply changes the syntax from:
> <device regex> <uid>:<gid> <octal perms> [command]
> to:
> <device regex> <uid>:<gid> <octal perms> [subdir] [<@|$|*> command]

Sometimes it is good to be able to rename the device itself too. For
example, zapctl should go to zap/ctl and not zap/zapctl

What about this syntax:
<device regex> <uid>:<gid> <octal perms> [subdir [dest]] [<@|$|*> command]

or:
<device regex> <uid>:<gid> <octal perms> [[subdir/][dest]] [<@|$|*> command]

where this happens if dest is specified:

if last char in param is '/' then
        mkdir -p $param
else
        mkdir -p $(dirname $param)
        MDEV=$(basename $param)
fi
create $MDEV

> the patch isnt 100% correct right now ... i'd like to see what ideas other 
> people have

I use a script, /lib/mdev/subdir_dev:

#!/bin/sh

# scripts that moves devices to the $1/ subdir.

if [ "$ACTION" = remove ] ; then
        mv $1/$MDEV $MDEV
        rmdir $1 2>/dev/null
else
        mkdir -p $1 
        mv $MDEV $1/$2
fi

and the mdev.conf looks like this:

# alsa sound devices
pcm.*           root:audio 0660 */lib/mdev/subdir_dev snd
...

# zaptel devices
zapctl          root:dialout 0660 */lib/mdev/subdir_dev zap ctl
zaptimer        root:dialout 0660 */lib/mdev/subdir_dev zap timer
...


I copied all my mdev stuff here:
http://dev.alpinelinux.org/~ncopa/mdev/

(I have a script that will differ usb disks from scsi disks and that
will load modules for usb devices (like webcams)

It would be very nice if mdev could handle subdirs and renaming devices
without depending on external scripts.

Natanael Copa

_______________________________________________
busybox mailing list
[email protected]
http://busybox.net/cgi-bin/mailman/listinfo/busybox

Reply via email to