Fix "doslowusb" and automatic "slowusb" behaviour.
authorFabio Erculiani <lxnay@sabayon.org>
Tue, 4 Jan 2011 22:33:07 +0000 (23:33 +0100)
committerSebastian Pipping <sebastian@pipping.org>
Wed, 5 Jan 2011 14:10:37 +0000 (15:10 +0100)
check_slowusb set FORCE_slowusb even when not strictly necessary,
in newer linux kernels, there are more files inside
/sys/bus/usb/drivers/usb-storage that have nothing to do with
available devices.
Moreover, start_dev_mgr was triggering 3 times the sleep() required,
calling sdelay more than once.

defaults/initrd.scripts
defaults/linuxrc

index 3cc1de8..447d632 100755 (executable)
@@ -411,10 +411,16 @@ setup_hotplug() {
 }
 
 check_slowusb() {
+       local usb_storage_dir="/sys/bus/usb/drivers/usb-storage"
+       if [ ! -d "${usb_storage_dir}" ]
+       then
+               return
+       fi
        [ "${DO_slowusb}" ] || \
-       for dir in /sys/bus/usb/drivers/usb-storage/*
+       for x in "${usb_storage_dir}"/*
        do
-               [ -d "${dir}" ] && FORCE_slowusb="1"
+               [ -d "${x}" ]  && [ "${x}" != "${usb_storage_dir}/module" ] \
+                       && FORCE_slowusb="1"
        done
 }
 
@@ -422,9 +428,7 @@ start_dev_mgr() {
        if [ "${KV_2_6_OR_GREATER}" ]
        then
                cd /sys
-               [ "${DO_slowusb}" ] && sdelay
                check_slowusb
-               [ "${FORCE_slowusb}" ] && sdelay
                good_msg 'Activating mdev'
                runmdev
                [ "${DO_slowusb}" ] || \
index 3cc1ca2..59f1ea5 100755 (executable)
@@ -699,10 +699,6 @@ then
        export CDBOOT
        CDBOOT=1
        check_slowusb
-       if [ "${DO_slowusb}" ] || [ "${FORCE_slowusb}" ]
-       then
-               sleep 10
-       fi
 else
        if [ "${USE_UNIONFS_NORMAL}" = '1' ]
        then