Forum Home
Press F1
 
Thread ID: 31684 2003-03-29 01:28:00 Mandrake and usb rmcb (164) Press F1
Post ID Timestamp Content User
131842 2003-03-29 01:28:00 Am getting errors at start up time since enabling my usb ports.
Running Mandrake 9
The error is /etc/init.d/usb line 37 read only.
Thanks
rmcb (164)
131843 2003-03-29 03:08:00 /etc/init.d/usb is a script file which starts up a handler for the usb (probably a daemon). What is line 37 of that file? Graham L (2)
131844 2003-03-29 04:07:00 Found a fix (I think) on Mandrake forum.
I have added to /etc/modules.conf this line
probeall usb-interface uhci
Stops the error message at boot time.
Now just waiting for the courier with our new digital camera.
Here is the script file anyway. Thanks Graham L

#!/bin/sh
# (c) MandrakeSoft, Chmouel Boudjnah <chmouel@mandrakesoft.com>
# $Id: usb,v 1.43 2002/09/18 10:56:54 flepied Exp $
#
# usb This shell script takes care of starting and stopping
# your usb devices.
#
# description: This startup script try to load your modules for your usb devices.

if [ -f /etc/modules.conf ];then
conf_file=/etc/modules.conf
elif [ -f /etc/conf.modules ];then
conf_file=/etc/conf.modules
else
exit 0
fi

if [ -f /etc/sysconfig/usb ];then
source /etc/sysconfig/usb
fi

grep -iq nousb /proc/cmdline && exit 0

. /etc/rc.d/init.d/functions

if [ "$USB" = "no" ];then
exit 0
fi

ARCH=$(uname -m)

function sed_usb_interface () {
local module
module=$1
nmb=$2
[[ -z $nmb ] ] && nmb=0
echo "alias usb-interface$nmb $module" >> $conf_file
}

function load_module () {
opt=""
phrase=$1
alias=$2
[ -n "$3" ] && opt="-r"
modules=`egrep -s "^(probeall|alias)( |\t)+"$alias"( |\t)+" $conf_file | sed "s/^.*$alias//"`
for module in $modules; do
if [ -n "$module" ] && [ "$module" != "off" ];then
action "Initializing USB controller (%s): " $module modprobe "$opt" $module
fi
done
return 0;
}

function probe_usb_interface () {
local t pci_f uhci_t ohci_t
local i=0

pci_f=/proc/bus/pci/devices
uhci_t="11063038 80862422 80867020 80867112 80867602 80862412"
ohci_t="0e117020 0e11a0f8 10227404 1022740c 10330035 10397001 1045a0f8 1045c861 10950670 10950673 10b95237 106b0019 11c15801"

# let's try with lspcidrake, it has everything we need and should
# do thing better
if [ -x /usr/bin/lspcidrake ];then
lspcidrake 2>/dev/null|sed -n 's/\([^ \t]*\).*Chipset USB.*/\1/p'| ( \
while read line;do
sed_usb_interface $line $i
(( i++ ))
done
return 0;
)
fi
if [ -e $pci_f ]; then
# Ok nothing let's try to detect it by ourself and pci id
# aka: i have some time to lost in the airplane
for i in $uhci_t;do
if grep -q ".*$i.*" $pci_f;then
sed_usb_interface usb-uhci
return 0
fi
done
for i in $ohci_t;do
if grep -q ".*$i.*" $pci_f;then
sed_usb_interface usb-ohci
return 0
fi
done
fi
return 1;
}

function get_usb_interface () {
if ! egrep -q "^(probeall|alias) usb-interface" $conf_file;then
echo -n "Detecting USB interface "
if probe_usb_interface;then
echo_success
echo
$0 start
fi
echo_success
echo
fi
}

function mount_proc_usb () {
if grep -q usbdevfs /proc/filesystems;then
if ! grep -q /proc/bus/usb /proc/mounts;then
action "Mount USB filesystem" mount -t usbdevfs -o devmode=0664,devgid=43 none /proc/bus/usb
fi
fi
}

function remove_module () {
modules="$@"
for module in "$modules";do
modprobe -r $module >/dev/null 2>&1
done
}

function usb_stop () {

# 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.

# disconnect all controllers we can, and kernel drivers
# HCDs first, so most drivers reduce their use counts.
remove_module usb-ohci usb-uhci uhci
remove_module ehci-hcd hcd

# user mode code may keep usbdevfs busy for a while yet ...

# OK, usbcore won't actually be removed unless there happen to be
# no USB drivers loaded, and usbdevfs 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.)

remove_module joydev keybdev wacom wmforce
remove_module cpia_usb cpia dc2xx rio500 mdc800 scanner
remove_module acm audio ibmcam uss720 printer hid
remove_module microtek dsbr100 evdev pegasus plusb
remove_module usb-serial usb-storage net1080 usbnet kaweth
remove_module ov511 videodev belkin_sa digi_acceleport empeg ftdi_sio
remove_module keyspan_pda keyspan omninet visor whiteheat usbserial
remove_module bluetooth dabusb mct_u232
modprobe -r usbkbd >/dev/null 2>&1
modprobe -r input >/dev/null 2>&1
modprobe -r usbvision >/dev/null 2>&1

# ok, hope that user mode drivers/managers closed their fds.
umount /proc/bus/usb >/dev/null 2>&1

remove_module usbcore

# we did everything we could ...
return 0;
}

if grep -q "^alias usbmouse" $conf_file;then
# Backward compatibility: No good sed it
sed 's|^alias usbmouse|alias usb-interface|' < $conf_file > /tmp/.conf.modules.tmp
mv -f /tmp/.conf.modules.tmp $conf_file
# shut your mounth, modprobe :\
depmod -A
fi

PKLVL=$(cut -f1 /proc/sys/kernel/printk)

case $1 in
start)

get_usb_interface;
sysctl -w kernel.printk=0

load_module "Loading USB interface" usb-interface || retval=1
awk '/^((alias)|(probe)) +usb-interface[0-9]/ {print $2, " ", $3}' $conf_file | ( \
while read line mod; do
nmb=${line##usb-interface}
[[ $loaded != *$mod* ] ] && {
load_module "Loading USB interface$nmb" $line || retval=1
}
loaded="$loaded $mod"
done
)
mount_proc_usb

# Static modules that we want to insert and not detected by usbd.
if [ "$MOUSE" = "yes" ];then
action "Loading USB mouse" /sbin/modprobe mousedev
fi
if [ "$KEYBOARD" = "yes" ];then
action "Loading USB keyboard" /sbin/modprobe keybdev
fi
if [ "$STORAGE" = "yes" ];then
action "Loading USB storage" /sbin/modprobe usb-storage
fi
if [ "$PRINTER" = "yes" ];then
action "Loading USB printer" /sbin/modprobe printer
fi
if [ "$VISOR" = "yes" ];then
action "Loading USB visor" /sbin/modprobe visor
fi

sysctl -w kernel.printk=$PKLVL

;;
stop)
# usb_stop;
rm -f /var/lock/subsys/usb
;;

status)

if fgrep -q usbcore /proc/modules;then
echo "USB Loaded."
else
echo "USB not loaded."
fi
exit 0
;;

reload)
;;
restart)
$0 stop
$0 start
;;
*)
echo "Usage: $(basename $0) start|stop|restart|status"
exit 0
;;
esac

exit 0
rmcb (164)
131845 2003-03-29 04:50:00 It looks as if the script checks the /etc/modules.conf file to see if that line has been included and tries to put it in if it hasn't. For some reason, it wasn't able to, so you got the error message. Those script files need lots of testing, maybe they didn't get that one right. :_|

It's nice when something works, isn't it. :D
Graham L (2)
1