nldev

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

usb (463B)


      1 #!/bin/busybox ash
      2 
      3 [ -n "$MDEV" ] || exit 0
      4 [ -n "$DEVNAME" ] || exit 0
      5 [ "$SUBSYSTEM" = "usb" ] || exit 0
      6 
      7 BUSPATH=$(dirname "$DEVNAME")
      8 DEVICENAME=$(basename "$DEVNAME")
      9 
     10 case "$ACTION" in
     11 	add|"")
     12 		if [ ! -d "$BUSPATH" ]; then
     13 			mkdir -p "$BUSPATH"
     14 		fi
     15 		mv "$MDEV" "$BUSPATH/$DEVICENAME"
     16 
     17 		case "$PRODUCT" in
     18 			*)
     19 				;;
     20 		esac
     21 		;;
     22 	remove)
     23 		if rm -f "$BUSPATH/$DEVICENAME" 2>/dev/null
     24 		then
     25 			rmdir -p "$BUSNAME" 2>/dev/null
     26 		fi
     27 		;;
     28 esac
     29 
     30 exit 0