@@ -, +, @@ . /etc/sysconfig/usb . /etc/conf.d/usb STATIC_MODULE_LIST="$MOUSE_MODULES $STATIC_MODULE_LIST" COUNT=0 # if USB is partially initted then synthesize "cold plug" events. the # kernel probably dropped many "hot plug" events, and those it didn't # drop likely couldn't trigger all the setup actions (kicking daemons, # dropping config records, and so on). # if it's not initted at all (no hcds loaded) no synthesized events # will be needed, we'll see real ones. knowing that there are no # hcds available through version-portable logic is a nightmare, so # assume we synthesize unless "usbfs" is clearly not initted (which # we currently need when synthesizing, anyway). SYNTHESIZE=true if [ ! -d /proc/bus/usb ]; then fi # if distro hasn't already done part of this ... load core, # and mount usbfs before the first hotplug agent fires # (so it'll be available to the agents). modprobe -q usbcore >/dev/null 2>&1 if [ -d /proc/bus/usb ]; then fi # Load Host Controller Drivers (HCDs) ... this automatically handles # systems with multiple controllers (EHCI, OHCI, UHCI) without needing # /proc or tools (lspci -v|grep USB, etc) to do so. If hotplugging # is enabled on this system, initting a root hub will cause hotplug # events to fire for every device on the tree at that root. # 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. if [ -d /proc/bus/usb ]; then # if USB is fully modular and yet can clean up, # we know init failed without needing usbfs elif rmmod usbcore >/dev/null 2>&1; then fi # hotplug events didn't fire during booting; # cope with devices that enumerated earlier # and may not have been fully configured. if [ $SYNTHESIZE = true ]; then usb_boot_events fi # Some modules are statically loaded, perhaps because they are # needed to activate filesystem device nodes. for MODULE in $STATIC_MODULE_LIST; do done # we did everything we could ... return 0 # 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. # NOTE: this list of "all USB modules" is unfortunate, but it seems # inevitable until modutils supports the notion of drivers with use # counts of zero that shouldn't be removed until after their device # gets removed. Maybe in 2.5 ... of necessity, the list is partial. # disconnect all controllers we can, and kernel drivers # HCDs first, so most drivers reduce their use counts. rmmod ehci-hcd >/dev/null 2>&1 rmmod ohci-hcd >/dev/null 2>&1 rmmod uhci-hcd >/dev/null 2>&1 rmmod usb-ohci >/dev/null 2>&1 rmmod usb-uhci >/dev/null 2>&1 rmmod uhci >/dev/null 2>&1 # user mode code may keep usbfs busy for a while yet ... # OK, usbcore won't actually be removed unless there happen to be # no USB drivers loaded, and usbfs isn't mounted. let's force # removal of autocleanable modules before trying to rmmod usbcore rmmod -as # Now let's workaround the fact that some USB modules never increase # their module use counts, so that "rmmod -a" won't unload them. # (And we can't use "modprobe --autoclean" anyway.) rmmod acm >/dev/null 2>&1 rmmod audio >/dev/null 2>&1 rmmod auerswald >/dev/null 2>&1 rmmod belkin_sa >/dev/null 2>&1 rmmod bluetooth >/dev/null 2>&1 rmmod catc >/dev/null 2>&1 rmmod CDCEther >/dev/null 2>&1 rmmod cpia_usb >/dev/null 2>&1 rmmod cyberjack >/dev/null 2>&1 rmmod dabusb >/dev/null 2>&1 rmmod dc2xx >/dev/null 2>&1 rmmod digi_acceleport >/dev/null 2>&1 rmmod dsbr100 >/dev/null 2>&1 rmmod emi26 >/dev/null 2>&1 rmmod empeg >/dev/null 2>&1 rmmod ftdi_sio >/dev/null 2>&1 rmmod hci_usb >/dev/null 2>&1 rmmod hid >/dev/null 2>&1 rmmod hpusbscsi >/dev/null 2>&1 rmmod ibmcam >/dev/null 2>&1 rmmod iforce >/dev/null 2>&1 rmmod io_edgeport >/dev/null 2>&1 rmmod ipaq >/dev/null 2>&1 rmmod ir-usb >/dev/null 2>&1 rmmod irda-usb >/dev/null 2>&1 rmmod kaweth >/dev/null 2>&1 rmmod keyspan >/dev/null 2>&1 rmmod keyspan_pda >/dev/null 2>&1 rmmod kl5kusb105 >/dev/null 2>&1 rmmod mct_u232 >/dev/null 2>&1 rmmod mdc800 >/dev/null 2>&1 rmmod microtek >/dev/null 2>&1 rmmod omninet >/dev/null 2>&1 rmmod ov511 >/dev/null 2>&1 rmmod pegasus >/dev/null 2>&1 rmmod pl2303 >/dev/null 2>&1 rmmod printer >/dev/null 2>&1 rmmod pwc pwcx >/dev/null 2>&1 rmmod rio500 >/dev/null 2>&1 rmmod rtl8150 >/dev/null 2>&1 rmmod scanner >/dev/null 2>&1 rmmod se401 >/dev/null 2>&1 rmmod stv680 >/dev/null 2>&1 rmmod usbhid >/dev/null 2>&1 rmmod usbkbd >/dev/null 2>&1 rmmod usbmouse >/dev/null 2>&1 rmmod usbnet >/dev/null 2>&1 rmmod usbtest >/dev/null 2>&1 rmmod usb-storage >/dev/null 2>&1 rmmod uss720 >/dev/null 2>&1 rmmod vicam >/dev/null 2>&1 rmmod visor >/dev/null 2>&1 rmmod wacom >/dev/null 2>&1 rmmod whiteheat >/dev/null 2>&1 if [ "$STATIC_MODULE_LIST" != "" ]; then fi # remove the helper modules that some usb modules need rmmod usbserial >/dev/null 2>&1 rmmod usbvideo >/dev/null 2>&1 # ok, hope that user mode drivers/managers closed their fds. umount /proc/bus/usb >/dev/null 2>&1 rmmod usbcore >/dev/null 2>&1 # we did everything we could ... return 0; start) ;; stop) ;; status) restart) *) echo $"Usage: $0 {start|stop|status|restart}" exit 1