summaryrefslogtreecommitdiff
blob: ee1891bb411b4593198339fb61707753d4c30ec9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
--- tools/hotplug/libusbscanner	2004-05-10 08:28:34.537782880 +0200
+++ libusbscanner.new	2004-05-10 08:32:05.998691893 +0200
@@ -13,6 +13,17 @@
 # DEVICE=/proc/bus/usb/BBB/DDD
 # TYPE=usb
 
+
+if [ -z "${DEVICE}" ] ; then
+        IF=$(echo ${DEVPATH} | sed 's:\(bus/usb/devices/\)\(.*\)-\(.*\):\2:')
+        if [ -r /sys/${DEVPATH}/devnum ]; then
+             DEV=$(cat /sys/${DEVPATH}/devnum)
+        else
+             DEV=1 # you'll have to adjust this manually for kernel < 2.6.6
+        fi
+        DEVICE=$(printf '/proc/bus/usb/%.03d/%.03d' ${IF} ${DEV})
+fi
+
 if [ "$ACTION" = "add" -a "$TYPE" = "usb" ]; then
   chown root:scanner "$DEVICE"
   chmod 0660 "$DEVICE"