linux-hotplug.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Wout Mertens <wmertens@cisco.com>
To: linux-hotplug@vger.kernel.org
Subject: Re: [PATCH] hotplug usb.rc changes
Date: Sat, 07 Jun 2003 20:28:10 +0000	[thread overview]
Message-ID: <marc-linux-hotplug-105501796821213@msgid-missing> (raw)
In-Reply-To: <marc-linux-hotplug-105500525713006@msgid-missing>

Hi Olaf,

Is the waiting absolutely necessary?

Could it be shorter? Or could you make it only do that during coldplug
phase?

The reason I'm asking is because I use my USB memory key to log in, and
that needs to wait 3 seconds (I patch it out of course) for no reason
whatsoever.

Thanks,

Wout.

On Sat, 7 Jun 2003, Olaf Hering wrote:

>
> I missed /etc/sysconfig/hotplug in usb.rc, fixed patch:
>
> - do not use /etc/sysconfig/usb anymore, use /etc/sysconfig/hotplug
>   instead
> - better check if usb was successfully activated
> - wait up to 3 seconds for active usb events
> - add two new /etc/sysconfig/hotplug variables:
> * use HOTPLUG_USB_HOSTCONTROLLER_LIST to load a fixed list of host
>   controller drivers
> * use HOTPLUG_USB_STATIC_MODULES to load a fixed list of drivers
>   (for input)
>
> Index: etc/hotplug/usb.rc
> =================================> --- etc/hotplug/usb.rc	(revision 15)
> +++ etc/hotplug/usb.rc	(revision 17)
> @@ -21,9 +21,6 @@
>
>  PATH=/sbin:/bin:/usr/sbin:/usr/bin
>
> -STATIC_MODULE_LIST> -X11_USBMICE_HACKúlse
> -
>  # source function library
>  if [ -f /etc/init.d/functions ]; then
>  	. /etc/init.d/functions
> @@ -31,22 +28,10 @@
>  	. /etc/rc.d/init.d/functions
>  fi
>
> -
> -# override any of the defaults above?
> -if [ -f /etc/sysconfig/usb ]; then
> -    . /etc/sysconfig/usb
> -fi
> -
> -
> -MOUSE_MODULES="mousedev input"
> -
> -# In its currently-recommended configuration, XFree86 3.3.6 always opens
> -# /dev/input/mice; so mousedev and input must be loaded before X11 starts.
> -if [ $X11_USBMICE_HACK = true ]; then
> -    STATIC_MODULE_LIST="$MOUSE_MODULES $STATIC_MODULE_LIST"
> +if [ -f /etc/sysconfig/hotplug ]; then
> +    . /etc/sysconfig/hotplug
>  fi
>
> -
>  #
>  # "COLD PLUG" ... recovery from partial USB init that may have happened
>  # before the OS could really handle hotplug, perhaps because /sbin or
> @@ -109,8 +94,7 @@
>
>  maybe_start_usb ()
>  {
> -    local COUNT SYNTHESIZE
> -    COUNT=0
> +    local SYNTHESIZE
>
>      # if USB is partially initted then synthesize "cold plug" events. the
>      # kernel probably dropped many "hot plug" events, and those it didn't
> @@ -154,32 +138,16 @@
>      # FIXME: some of this should be driven by PCI hotplugging, and have
>      # the blacklist control which uhci driver gets used (before 2.5).
>
> -    # "new style" HCDs ... more common code
> -    modprobe -q ehci-hcd >/dev/null 2>&1
> -    modprobe -q ohci-hcd >/dev/null 2>&1
> -    modprobe -q uhci-hcd >/dev/null 2>&1
> -
> -    # "old style" HCDs ... more driver-specific bugs
> -    modprobe -q usb-ohci >/dev/null 2>&1
> -    # NOTE: this prefers "uhci"; you may prefer "usb-uhci".
> -    # 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
> -
> -    # ... add any non-PCI HCDS here.  Examples include the
> -    # CRIS usb-host, Philips ISP-1161, Symlogic 811HS, and so on.
> -    # ohci-hcd can handle some non-pci variants.
> +    # Load Host Controller Drivers (HCDs) specified in /etc/sysconfig/hotplug
> +    for i in $HOTPLUG_USB_HOSTCONTROLLER_LIST ; do
> +	modprobe -q $i >/dev/null 2>&1 && mesg "loaded HCD: $i"
> +    done
>
>      if [ -d /proc/bus/usb ]; then
>  	# If we see there are no busses, we "failed" and
>  	# can report so even if we're partially nonmodular.
> -	#
> -	# NOTE: this fails on older kernels, where usbdevfs had two files
> -	# ('devices' and 'drivers') with no hcds registered, but works on
> -	# newer kernels where usbfs has zero files until hcds register,
> -	# and might not have the 'drivers' file.
> -	COUNT=`ls /proc/bus/usb | wc -l`
> -	if [ $COUNT -lt 2 ]; then
> -	    umount /proc/bus/usb
> +	if [ ! -d /proc/bus/usb/001 ] ; then
> +	    test -f /proc/bus/usb/devices && umount /proc/bus/usb
>  	    rmmod usbcore >/dev/null 2>&1
>  	    return 1
>  	fi
> @@ -199,10 +167,17 @@
>
>      # Some modules are statically loaded, perhaps because they are
>      # needed to activate filesystem device nodes.
> -    for MODULE in $STATIC_MODULE_LIST; do
> +    for MODULE in $HOTPLUG_USB_STATIC_MODULES ; do
>  	modprobe $MODULE
>      done
>
> +    # there could be still some active hotplug events
> +    # wait for them because other rc scripts may need the drivers
> +    sleep 3 & DELAY_PID=$!
> +    until [ "`ls /var/run/usb/*.queue.* 2>/dev/null`" = "" ] ; do
> +    	test -d /proc/$DELAY_PID || break
> +    done
> +
>      # we did everything we could ...
>      return 0
>  }
> Index: etc/sysconfig/hotplug
> =================================> --- etc/sysconfig/hotplug	(revision 15)
> +++ etc/sysconfig/hotplug	(revision 17)
> @@ -3,3 +3,16 @@
>  # Enable debugging for all hotplug actions? yes/no
>  #
>  HOTPLUG_DEBUG=no
> +#####################################################################
> +#
> +# The hostcontroller drivers will be probed in that order
> +# It is useful for the uhci/usb-uhci battle
> +#
> +HOTPLUG_USB_HOSTCONTROLLER_LIST="ehci-hcd ohci-hcd uhci-hcd usb-ohci usb-uhci uhci"
> +#####################################################################
> +#
> +# These modules will be loaded when usb hotplug starts. These are at least
> +# modules for which no hotplug events is created e.g. input devices
> +# If you are going to use old XFree86 3.x you may add 'input'.
> +#
> +HOTPLUG_USB_STATIC_MODULES="input keybdev evdev joydev mousedev"
> --
> USB is for mice, FireWire is for men!
>
>
> -------------------------------------------------------
> This SF.net email is sponsored by:  Etnus, makers of TotalView, The best
> thread debugger on the planet. Designed with thread debugging features
> you've never dreamed of, try TotalView 6 free at www.etnus.com.
> _______________________________________________
> Linux-hotplug-devel mailing list  http://linux-hotplug.sourceforge.net
> Linux-hotplug-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
>


-------------------------------------------------------
This SF.net email is sponsored by:  Etnus, makers of TotalView, The best
thread debugger on the planet. Designed with thread debugging features
you've never dreamed of, try TotalView 6 free at www.etnus.com.
_______________________________________________
Linux-hotplug-devel mailing list  http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

  parent reply	other threads:[~2003-06-07 20:28 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-06-07 16:56 [PATCH] hotplug usb.rc changes Olaf Hering
2003-06-07 17:51 ` Olaf Hering
2003-06-07 20:28 ` Wout Mertens [this message]
2003-06-08  5:42 ` Olaf Hering
2003-06-08 19:11 ` David Brownell
2003-06-10 21:30 ` Olaf Hering
2003-06-11  0:19 ` 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-105501796821213@msgid-missing \
    --to=wmertens@cisco.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).