moused revision 137112
198184Sgordon#!/bin/sh 298184Sgordon# 398184Sgordon# $NetBSD: moused,v 1.1 2001/10/29 23:25:01 augustss Exp $ 498184Sgordon# $FreeBSD: head/etc/rc.d/moused 137112 2004-11-01 18:05:41Z mtm $ 598184Sgordon# 698184Sgordon 798184Sgordon# PROVIDE: moused 898184Sgordon# REQUIRE: DAEMON 9136224Smtm# KEYWORD: nojail 1098184Sgordon 1198184Sgordon. /etc/rc.subr 1298184Sgordon 1398184Sgordonname=moused 1498184Sgordonrcvar=`set_rcvar` 15104039Sgordoncommand="/usr/sbin/${name}" 16124627Smtmstart_cmd="moused_start" 17137112Smtm_pidprefix="/var/run/moused" 18137112Smtmpidfile="${_pidprefix}.pid" 19137112Smtm_pidarg= 20137112Smtmload_rc_config $name 2198184Sgordon 22137112Smtm# Set the pid file and variable name. The second argument, if it exists, is 23137112Smtm# expected to be the mouse device. 24137112Smtm# 25137112Smtmif [ -n "$2" ]; then 26137112Smtm checkyesno moused_nondefault_enable && 27137112Smtm eval moused_$2_enable=\${moused_$2_enable-YES} 28137112Smtm rcvar=`set_rcvar moused_$2` 29137112Smtm pidfile="${_pidprefix}.$2.pid" 30137112Smtm _pidarg="-I $pidfile" 31137112Smtmfi 32137112Smtm 3398184Sgordonmoused_start() 3498184Sgordon{ 35137112Smtm local ms myflags myport mytype 3698184Sgordon 37137112Smtm # Set the mouse device and get any related variables. If 38137112Smtm # a moused device has been specified on the commandline, then 39137112Smtm # rc.conf(5) variables defined for that device take precedence 40137112Smtm # over the generic moused_* variables. The only exception is 41137112Smtm # the moused_port variable, which if not defined sets it to the 42137112Smtm # passed in device name. 43137112Smtm # 44137112Smtm ms=$1 45137112Smtm if [ -n "$ms" ]; then 46137112Smtm eval myflags=\${moused_${ms}_flags-$moused_flags} 47137112Smtm eval myport=\${moused_${ms}_port-/dev/$ms} 48137112Smtm eval mytype=\${moused_${ms}_type-$moused_type} 49137112Smtm else 50137112Smtm ms="default" 51137112Smtm myflags="$moused_flags" 52137112Smtm myport="$moused_port" 53137112Smtm mytype="$moused_type" 54137112Smtm fi 55137112Smtm 56137112Smtm echo -n "Starting ${ms} moused:" 57137112Smtm /usr/sbin/moused ${myflags} -p ${myport} -t ${mytype} ${_pidarg} 58137112Smtm 5998184Sgordon _mousechar_arg= 6098184Sgordon case ${mousechar_start} in 6198184Sgordon [Nn][Oo] | '') 6298184Sgordon ;; 6398184Sgordon *) 6498184Sgordon echo -n ' mousechar_start' 6598184Sgordon _mousechar_arg="-M ${mousechar_start}" 6698184Sgordon ;; 6798184Sgordon esac 6898184Sgordon 6998184Sgordon for ttyv in /dev/ttyv* ; do 7098184Sgordon vidcontrol < ${ttyv} ${_mousechar_arg} -m on 7198184Sgordon done 7298184Sgordon echo '.' 7398184Sgordon} 7498184Sgordon 75137112Smtmrun_rc_command $* 76