From mboxrd@z Thu Jan 1 00:00:00 1970 From: Chmouel Boudjnah Date: Wed, 17 Jan 2001 10:24:34 +0000 Subject: usb.rc script Message-Id: List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable To: linux-hotplug@vger.kernel.org Hi, Some comments on the script : 1- Calling all the rc scripts of /etc/hotplug/*.rc from /etc/init.d/hotplug is not really standard, and could break things.. 2- Why it needs STATIC_MODULE, it couldn't be detected ? 3- Same for the interfaces, you load the interfaces when is not Admin level configurable (sometime when usb-(uhci|ohci) load it could freeze the box. 4- The rmmod in force is not really nice also... Nerveless here is a small patch that bring some RH/MDK things, add the action/sucess/failure process and inform the subsys system : --- usb.rc.chmou Wed Jan 17 07:15:02 2001 +++ usb.rc Wed Jan 17 11:14:36 2001 @@ -30,6 +30,7 @@ # e.g. USBD_ENABLE=FAlse but STATIC_MODULE_LIST has your devices fi =20 +. /etc/rc.d/init.d/functions =20 MOUSE_MODULES=3D"mousedev input" =20 @@ -49,10 +50,13 @@ =20 # FIXME -- "manual configuration" sysadmin mode isn't supported yet =20 + echo -n "Starting USB interfaces: " + modprobe -q usb-ohci >/dev/null 2>&1 # modprobe -q usb-uhci >/dev/null 2>&1 || modprobe -q uhci >/dev/null = 2>&1 modprobe -q uhci >/dev/null 2>&1 || modprobe -q usb-uhci >/dev/null 2>= &1 =20 + if [ -d /proc/bus/usb ]; then if grep -q "[ ]/proc/bus/usb[ ]" /etc/fstab then @@ -67,13 +71,14 @@ if [ $COUNT -le 2 ]; then umount /proc/bus/usb rmmod usbcore >/dev/null 2>&1 + failure ; echo return 1 fi - # if USB is fully modular and yet can clean up, # we know init failed without needing usbdevfs elif rmmod usbcore >/dev/null 2>&1 then + failure ; echo return 1 fi =20 @@ -88,12 +93,16 @@ modprobe $MODULE done =20 + success ; echo + # we did everything we could ... return 0 } =20 maybe_stop_usb () { + echo -n "Unloading USB interfaces: " + # call this multiple times if you had to take down components of the # USB subsystem by hand; it cleans up whatever can # be cleaned up, letting the system quiesce further. @@ -125,6 +134,8 @@ =20 rmmod usbcore >/dev/null 2>&1 =20 + success ; echo + # we did everything we could ... return 0; } @@ -133,9 +144,11 @@ case "$1" in start) maybe_start_usb + touch /var/log/subsys/hotplug ;; stop) maybe_stop_usb + rm -f /var/log/subsys/hotplug ;; status) echo USB Status for kernel: `uname -srm` --=20 MandrakeSoft Inc http://www.chmouel.org --Chmouel _______________________________________________ Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net Linux-hotplug-devel@lists.sourceforge.net http://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel