nldev

NetLink DEVice manager; a lightweight netlink frontend for mdev.
git clone git://r-36.net/nldev
Log | Files | Refs | LICENSE

commit db64d569025530b743e4d2140fc10e0431ae0815
parent 7b9e5ae8574e3964f83084d647be6d6b00c04761
Author: Christoph Lohmann <20h@r-36.net>
Date:   Sat, 19 May 2012 10:02:21 +0200

devinput and /dev/fd are now correctly created.

Diffstat:
mdev/etc/mdev.conf | 2+-
mdev/lib/inputdev | 19+++++++++++--------
mdev/lib/sddev | 4+++-
mdev/lib/ttydev | 3++-
mdev/lib/usb | 27++++++++++++++++-----------
run_nldev | 2+-
6 files changed, 34 insertions(+), 23 deletions(-)

diff --git a/mdev/etc/mdev.conf b/mdev/etc/mdev.conf @@ -94,7 +94,7 @@ irlpt[0-9]* root:lp 660 ram[0-9]* root:disk 660 loop[0-9]* root:disk 660 sd[!a-z].* root:disk 660 */lib/mdev/sddev -hd[a-z].* root:disk 660 */lib/mdev/hddev +hd[!a-z].* root:disk 660 */lib/mdev/hddev control root:root 000 =mapper/ md.* root:disk 660 mtd.* root:disk 660 diff --git a/mdev/lib/inputdev b/mdev/lib/inputdev @@ -1,5 +1,7 @@ #!/bin/busybox ash +set +x + [ -n "$MDEV" ] || exit 0 [ -n "$DEVNAME" ] || exit 0 [ "$SUBSYSTEM" = "input" ] || exit 0 @@ -16,10 +18,7 @@ fi cd $BPATH case "$ACTION" in add|"") - if [ ! -e "$MDEV" ]; - then - mv ../$MDEV . - fi + mv ../$MDEV . case "$NAME" in "TPPS/2 IBM TrackPoint") @@ -28,13 +27,13 @@ case "$ACTION" in "AT Translated Set 2 keyboard") ln -s $MDEV kbd ;; + "ThinkPad Extra Buttons") + ln -s $MDEV extrabuttons + ;; esac ;; remove) - if [ -e "$MDEV" ]; - then - rm -f $MDEV - fi + rm -f $MDEV case "$NAME" in "TPPS/2 IBM TrackPoint") @@ -43,8 +42,12 @@ case "$ACTION" in "AT Translated Set 2 keyboard") rm -f kbd ;; + "ThinkPad Extra Buttons") + rm -f extrabuttons + ;; esac ;; esac exit 0 + diff --git a/mdev/lib/sddev b/mdev/lib/sddev @@ -10,7 +10,9 @@ UUID=$(echo -n "$blkidstr" \ LABEL=$(echo -n "$blkidstr" \ | grep LABEL \ | sed -e 's,.*LABEL="\([^"]*\)".*,\1,') -BLOCK=$(cat /sys${DEVPATH}/dev) + +BLOCK="" +[ -e /sys${DEVPATH}/dev ] && BLOCK=$(cat /sys${DEVPATH}/dev) case "$ACTION" in add|"") diff --git a/mdev/lib/ttydev b/mdev/lib/ttydev @@ -15,7 +15,8 @@ then chmod 600 ${MDEV} fi -CHAR=$(cat /sys/${DEVPATH}/dev) +CHAR="" +[ -e /sys${DEVPATH}/dev ] && CHAR=$(cat /sys${DEVPATH}/dev) case "$ACTION" in add|"") diff --git a/mdev/lib/usb b/mdev/lib/usb @@ -8,18 +8,23 @@ BUSPATH=$(dirname "$DEVNAME") DEVICENAME=$(basename "$DEVNAME") case "$ACTION" in - add|"") - if [ ! -d "$BUSPATH" ]; then + add|"") + if [ ! -d "$BUSPATH" ]; then mkdir -p "$BUSPATH" - fi - mv "$MDEV" "$BUSPATH/$DEVICENAME" - ;; - remove) - if rm -f "$BUSPATH/$DEVICENAME" 2>/dev/null - then - rmdir -p "$BUSNAME" 2>/dev/null - fi - ;; + fi + mv "$MDEV" "$BUSPATH/$DEVICENAME" + + case "$PRODUCT" in + *) + ;; + esac + ;; + remove) + if rm -f "$BUSPATH/$DEVICENAME" 2>/dev/null + then + rmdir -p "$BUSNAME" 2>/dev/null + fi + ;; esac exit 0 diff --git a/run_nldev b/run_nldev @@ -3,7 +3,7 @@ if [ -e /proc/self/fd ]; then rm -f /dev/fd 2>/dev/null - ln -s /proc/self/fd /dev/fd + ln -sf /proc/self/fd /dev/fd fi /bin/nldev -kd 2>&1 | logger -p daemon.notice -t nldev