Skip to contentSkip to conversation

usb.rc - fix coldplug on 2.6 (no lister defined)

PATCH New Andrey Borzenkov 1 participant 1 message Aug 6, 2003

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 usb.rc - fix coldplug on 2.6 (no lister defined)

On 2.6 lister is not used, but coldplug does not pass any information sufficient to find module. The patch makes it use sysfs and pass DEVPATH so usb.agent can get them from sysfs.

regards

-andrey

etc/hotplug/usb.rc renamed from etc/hotplug/usb.rc.coldplug26 +17 -3
@@ -125,6 +125,9 @@
 	DEVICE=
 	export DEVFS DEVICE
 
+	DEVPATH=
+	export DEVPATH
+
 	# these notifications will be handled by usbmodules
 	# NOTE: we're not providing a full set of hotplug
 	# parameters for USB.  that's why "usbmodules" is a
@@ -134,10 +137,21 @@
 	# FIXME usbmodules, or something, should set real
 	# PRODUCT and DEVICE strings so /etc/hotplug/usb/*
 	# scripts can rely on them ...
-	for DEVICE in /proc/bus/usb/*/*
-	do
+	#
+	# for 2.6 lister is disabled so either this should be fixed
+	# or we just use sysfs
+	if [ -d /sys/bus/usb/devices ]; then
+	    declare device
+	    for device in /sys/bus/usb/devices/*; do
+		DEVPATH=${device#/sys/}
 		/etc/hotplug/usb.agent
-	done
+	    done
+	else
+	    for DEVICE in /proc/bus/usb/*/*
+	    do
+		    /etc/hotplug/usb.agent
+	    done
+	fi
 }