slugos-init: leds: Apply patch for varying input event number (from Gordon Farquharson)
authorRod Whitby <rod@whitby.id.au>
Sun, 21 Sep 2008 08:41:43 +0000 (08:41 +0000)
committerRod Whitby <rod@whitby.id.au>
Sun, 21 Sep 2008 08:41:43 +0000 (08:41 +0000)
packages/slugos-init/files/leds

index 7a51a24..c5ce299 100644 (file)
@@ -180,12 +180,22 @@ sysled(){
 #  does nothing if there is no beep executable, is very
 #  quiet in the presence of errors
 beep(){
-       local arg
+       local arg devices module
        arg=
        test "$1" = beep && shift
        if test -x /bin/beep
        then
-               test -c /dev/buzzer && arg="-e /dev/buzzer"
+               devices=`ls -d /sys/class/input/event*`
+               for device in $devices
+               do
+                       module=`egrep PHYSDEVDRIVER $device'/uevent' | cut -d '=' -f 2`
+                       if test "$module" = "ixp4xx-beeper";
+                       then
+                               devnode=`echo "$device" | cut -d '/' -f 5`
+                               arg="-e /dev/input/"$devnode
+                               break
+                       fi
+               done
                /bin/beep $arg "$@" 2>/dev/null
        fi
        return 0