linux-hotplug.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* usb.rc script
@ 2001-01-17 10:24 Chmouel Boudjnah
  2001-01-17 16:42 ` David Brownell
  0 siblings, 1 reply; 2+ messages in thread
From: Chmouel Boudjnah @ 2001-01-17 10:24 UTC (permalink / raw)
  To: linux-hotplug

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úlse but STATIC_MODULE_LIST has your devices
 fi
 
+. /etc/rc.d/init.d/functions
 
 MOUSE_MODULES="mousedev input"
 
@@ -49,10 +50,13 @@
 
 # FIXME -- "manual configuration" sysadmin mode isn't supported yet
 
+    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
 
+
     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
 
@@ -88,12 +93,16 @@
 	modprobe $MODULE
     done
 
+    success ; echo
+
     # we did everything we could ...
     return 0
 }
 
 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 @@
 
     rmmod usbcore >/dev/null 2>&1
 
+    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`


-- 
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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2001-01-17 16:42 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2001-01-17 10:24 usb.rc script Chmouel Boudjnah
2001-01-17 16:42 ` David Brownell

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).