1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128
|
#! /bin/sh
# Copyright (c) 1995-2000 SuSE GmbH Nuernberg, Germany.
#
# Author: <olh@suse.de>
#
# /etc/init.d/usbmgr
#
# and symbolic its link
#
# /sbin/rcusbmgr
#
### BEGIN INIT INFO
# Provides: usb
# Required-Start: syslog
# Required-Stop:
# Default-Start: 1 2 3 5
# Default-Stop:
# Description: loads and unloads usb module
### END INIT INFO
. /etc/rc.status
. /etc/rc.config
# Determine the base and follow a runlevel link name.
base=${0##*/}
link=${base#*[SK][0-9][0-9]}
# Force execution if not called by a runlevel directory.
# we want it always...
#test $link = $base && START_USB=yes
#test "$START_USB" = yes || exit 0
# Shell functions sourced from /etc/rc.status:
# rc_check check and set local and overall rc status
# rc_status check and set local and overall rc status
# rc_status -v ditto but be verbose in local rc status
# rc_status -v -r ditto and clear the local rc status
# rc_failed set local and overall rc status to failed
# rc_reset clear local rc status (overall remains)
# rc_exit exit appropriate to overall rc status
# First reset status of this service
rc_reset
case "$1" in
start)
# check if the hostcontroller file is already there
if [ ! -f /etc/usbmgr/host -o ! -s /etc/usbmgr/host ] ; then
echo "creating /etc/usbmgr/host ... "
# if the last echo fails the module will be loaded anyway
$0 init || modprobe -av $USB_HCI
fi
echo -n "Starting service usbmgr"
## Start daemon with startproc(8). If this fails
## the echo return value is set appropriate.
if [ "$RUNLEVEL" = "S" ] ; then
MY_OPTS=" -p "
fi
startproc /sbin/usbmgr $MY_OPTS
# Remember status and be verbose
rc_status -v
;;
stop)
echo -n "Shutting down service usbmgr"
## Stop daemon with killproc(8) and if this fails
## set echo the echo return value.
killproc -TERM /sbin/usbmgr
# Remember status and be verbose
rc_status -v
;;
restart)
## If first returns OK call the second, if first or
## second command fails, set echo return value.
$0 stop && $0 start
# Remember status and be quiet
rc_status
;;
reload)
echo -n "Reload usbmgr config"
/sbin/update_usbdb -f /etc/usbmgr/usbmgr.conf
;;
status)
echo -n "Checking for running usbmgr: "
## Check status with checkproc(8), if process is running
## checkproc will return with exit status 0.
checkproc /sbin/usbmgr && echo OK || echo "No process (no USB?)"
;;
init)
# this will check for the hostcontroller type
# it stores either usb-ohci or usb-uhci into
# /etc/usbmgr/host
# it will be called by /lib/YaST/bootsetup and
# /usr/lib/YaST2/bin/YaST2.firstboot
test -f /proc/cpuinfo || mount -n -t proc proc /proc
if test -x /sbin/lspci; then
USB_PCI="/sbin/lspci"
else
test -e /proc/pci && USB_PCI="cat /proc/pci"
fi
echo "USB determination method: $USB_PCI"
USB_HCI=`
eval $USB_PCI |
while read line ; do
case "$line" in
*USB*Intel*|*USB*VIA*) echo "usb-uhci"; break ;;
*USB*) echo "usb-ohci"; break ;;
esac
done`
if test -z "$USB_HCI"; then
echo "No USB controller found"
else
echo "USB driver to be loaded: $USB_HCI (stored in /etc/usbmgr/host)"
echo "$USB_HCI" > /etc/usbmgr/host
fi
;;
*)
echo "Usage: $0 {start|stop|status|restart|reload|init}"
exit 1
;;
esac
rc_exit
|