A few updates for usb.rc: - 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 16) @@ -21,9 +21,6 @@ PATH=/sbin:/bin:/usr/sbin:/usr/bin -STATIC_MODULE_LIST= -X11_USBMICE_HACK=false - # source function library if [ -f /etc/init.d/functions ]; then . /etc/init.d/functions @@ -31,22 +28,6 @@ . /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" -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 +90,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 +134,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 +163,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 16) @@ -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. _______________________________________________ [EMAIL PROTECTED] To unsubscribe, use the last form field at: https://lists.sourceforge.net/lists/listinfo/linux-usb-devel