linux-hotplug.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Chmouel Boudjnah <chmouel@mandrakesoft.com>
To: linux-hotplug@vger.kernel.org
Subject: usb.rc script
Date: Wed, 17 Jan 2001 10:24:34 +0000	[thread overview]
Message-ID: <marc-linux-hotplug-97972703512559@msgid-missing> (raw)

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

             reply	other threads:[~2001-01-17 10:24 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-01-17 10:24 Chmouel Boudjnah [this message]
2001-01-17 16:42 ` usb.rc script David Brownell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=marc-linux-hotplug-97972703512559@msgid-missing \
    --to=chmouel@mandrakesoft.com \
    --cc=linux-hotplug@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).