nldev

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

inputdev (900B)


      1 #!/bin/busybox ash
      2 
      3 set +x
      4 
      5 [ -n "$MDEV" ] || exit 0
      6 [ -n "$DEVNAME" ] || exit 0
      7 [ "$SUBSYSTEM" = "input" ] || exit 0
      8 
      9 MDEV=$(basename ${MDEV})
     10 BPATH="input"
     11 SPATH="/sys${DEVPATH}"
     12 
     13 NAME=""
     14 if [ -e ${SPATH} ];
     15 then
     16 	NAME=$(cat ${SPATH}/../name)
     17 fi
     18 
     19 printf "bpath = '%s'; spath = '%s'; name = '%s';\n" "$BPATH" "$SPATH" "$NAME" \
     20 	| logger -t daemon
     21 
     22 cd $BPATH
     23 case "$ACTION" in
     24         add|"")	
     25 		#mv ../$MDEV .
     26 
     27 		case "$NAME" in
     28 			"TPPS/2 IBM TrackPoint")
     29 				ln -fs $MDEV mouse
     30 				;;
     31 			"AT Translated Set 2 keyboard")
     32 				ln -fs $MDEV kbd
     33 				;;
     34 			"ThinkPad Extra Buttons")
     35 				ln -fs $MDEV extrabuttons
     36 				;;
     37 		esac
     38                 ;;
     39         remove)
     40 		#rm -f $MDEV
     41 
     42 		case "$NAME" in
     43 			"TPPS/2 IBM TrackPoint")
     44 				rm -f mouse
     45 				;;
     46 			"AT Translated Set 2 keyboard")
     47 				rm -f kbd
     48 				;;
     49 			"ThinkPad Extra Buttons")
     50 				rm -f extrabuttons
     51 				;;
     52 		esac
     53                 ;;
     54 esac
     55 
     56 exit 0
     57