#!/bin/sh # # slmodemd: Starts the SmartLink Modem Daemon # # chkconfig: 345 90 10 # description: This is the user space part for SmartLink Modems # processname: slmodemd # config: /etc/sysconfig/slmodem # # # UPDATE FOR KERNEL VERSION 2.6.12-13 ON MANDRIVA 2006 (cooker) AND SLMODEMD 2.9.11 # --------------------------------------------------------------------------------- # THIS SCRIPT SUPPORTS ONLY ALSA SLMODEMD VERSIONS!! # # by Luca Boni, 26/02/2006 # http://www.ok--computer.com # # # # NOTE: # If you put '#' at the beginning of a line it becomes a comment and it will be ignored # If you want to re-enable the line, uncomment it removing the '#' # Source function library . /etc/init.d/functions # Some vars that will be used; DON'T change them if you don't known what you are doing! PROG=slmodemd DAEMON_BIN=/usr/bin/$PROG CONFIG=/etc/sysconfig/slmodem # Normally leave blank but if you need ALSA support, insert '--alsa' # Do 'slmodemd -help' from shell for more info SLMODEMD_OPTS=--alsa RETVAL=0 # Configuration for modules # Use one of the following if you want to use ALSA: # # PCI ID Modem Controller Low_level_driver # ========= ================ ================ # 1002:434d ATI snd-atiixp-modem # 1002:4379 ATI " # 1106:3068 VIA snd-via82xx-modem # 10b9:5451 ALI 5451 audio with modem snd-ali5451 # 8086:???? many Intel controllers snd-intel8x0m # 10de:00d9 Nvidia Corp " # 1039:7013 SIS 630 " # Others? " # MOD1=snd-page-alloc MOD2=snd-intel8x0m # Configuration for DEVICE # Use one of the following if you use ALSA # hw:0, hw:1, modem:0, modem:1 (depending on your audio configuration, please read the documentation) SLMODEMD_DEVICE=modem:1 # Configuration for COUNTRY # Do "slmodemd --countrylist" from shell for a complete list of country names SLMODEMD_COUNTRY=ITALY # Test daemon binary presence # Maybe you don't need this: comment next 5 line if you wish test -f $DAEMON_BIN || { gprintf "Error: needed \"$DAEMON_BIN\" daemon binary not present.\n" gprintf "Please install SmartLink modem sotware properly and retry.\n" exit -1 } # Test kernel modules presence # (do not try to start on a kernel which does not support it) # Maybe you don't need this: comment next 8 lines if you wish grep -q $MOD1\..*o /lib/modules/`uname -r`/modules.dep || { gprintf "Sorry, modem driver \"$MOD1\" not founded or not installed properly.\n" exit -1 } grep -q $MOD2\..*o /lib/modules/`uname -r`/modules.dep || { gprintf "Sorry, modem driver \"$MOD2\" not founded or not installed properly.\n" exit -1 } # Override default group and permissions if defined in $CONFIG; # other valid options also can be put into SLMODEMD_OPTS variable # Maybe you don't need this: comment next 5 lines if you wish if [ -f $CONFIG ]; then . $CONFIG [ "$GROUP" ] && SLMODEMD_OPTS="$SLMODEMD_OPTS --group=$GROUP" [ "$PERMS" ] && SLMODEMD_OPTS="$SLMODEMD_OPTS --perm=$PERMS" fi start() { # Load kernel modules only if it is not loaded yet cat /proc/modules | grep $MOD1 >/dev/null || { /sbin/modprobe $MOD1 || { gprintf "Error loading kernel module \"$MOD1.(k)o(.gz)\" ... exiting.\n" gprintf "Please verify the modem driver installation!\n" exit -1 } } cat /proc/modules | grep $MOD2 >/dev/null || { /sbin/modprobe $MOD2 || { gprintf "Error loading kernel module \"$MOD2.(k)o(.gz)\" ... exiting.\n" gprintf "Please verify the modem driver installation!\n" exit -1 } } # Start modem binary daemon. # Only slmodem versions > 2.9.7 support "-v" command line option # If you are using an older version, a small error message will appear; # to avoid this, you can comment next 2 lines and uncomment the thirth one VERSION=`$DAEMON_BIN -v | gawk '{print $5}'` gprintf "Starting SmartLink soft modem $VERSION for device $SLMODEMD_DEVICE: " #gprintf "Starting SmartLink modem driver for $SLMODEMD_DEVICE: " $DAEMON_BIN /dev/null 2>/dev/null $SLMODEMD_OPTS -c $SLMODEMD_COUNTRY $SLMODEMD_DEVICE & RETVAL=$? [ $RETVAL -eq 0 ] && success $"$PROG startup" || failure $"$PROG startup" echo [ $RETVAL -eq 0 ] && touch /var/lock/subsys/$PROG return $RETVAL } stop() { gprintf "Shutting down soft modem application: " killproc $PROG RETVAL=$? echo [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/$PROG return $RETVAL } # See how we were called case "$1" in start) start ;; stop) stop ;; status) status $PROG RETVAL=$? ;; restart|reload) stop start RETVAL=$? ;; condrestart) if [ -f /var/lock/subsys/$PROG ]; then stop start RETVAL=$? fi ;; *) gprintf "*** Usage: $PROG {start|stop|status|restart|condrestart}\n" exit 1 esac exit $RETVAL