moused revision 165664
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 165664 2006-12-30 22:53:20Z yar $ 598184Sgordon# 698184Sgordon 798184Sgordon# PROVIDE: moused 8140339Sobrien# REQUIRE: DAEMON cleanvar 9136224Smtm# KEYWORD: nojail 1098184Sgordon 1198184Sgordon. /etc/rc.subr 1298184Sgordon 1398184Sgordonname=moused 1498184Sgordonrcvar=`set_rcvar` 15104039Sgordoncommand="/usr/sbin/${name}" 16124627Smtmstart_cmd="moused_start" 17165664Syarpidprefix="/var/run/moused" 18165664Syarpidfile="${pidprefix}.pid" 19165664Syarpidarg= 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 26158692Smatteo eval moused_$2_enable=\${moused_$2_enable-${moused_nondefault_enable}} 27137112Smtm rcvar=`set_rcvar moused_$2` 28165664Syar pidfile="${pidprefix}.$2.pid" 29165664Syar pidarg="-I $pidfile" 30137112Smtmfi 31137112Smtm 3298184Sgordonmoused_start() 3398184Sgordon{ 34137112Smtm local ms myflags myport mytype 3598184Sgordon 36137112Smtm # Set the mouse device and get any related variables. If 37137112Smtm # a moused device has been specified on the commandline, then 38137112Smtm # rc.conf(5) variables defined for that device take precedence 39137112Smtm # over the generic moused_* variables. The only exception is 40137112Smtm # the moused_port variable, which if not defined sets it to the 41137112Smtm # passed in device name. 42137112Smtm # 43137112Smtm ms=$1 44137112Smtm if [ -n "$ms" ]; then 45137112Smtm eval myflags=\${moused_${ms}_flags-$moused_flags} 46137112Smtm eval myport=\${moused_${ms}_port-/dev/$ms} 47137112Smtm eval mytype=\${moused_${ms}_type-$moused_type} 48137112Smtm else 49137112Smtm ms="default" 50137112Smtm myflags="$moused_flags" 51137112Smtm myport="$moused_port" 52137112Smtm mytype="$moused_type" 53137112Smtm fi 54137112Smtm 55137112Smtm echo -n "Starting ${ms} moused:" 56165664Syar /usr/sbin/moused ${myflags} -p ${myport} -t ${mytype} ${pidarg} 57137112Smtm 58165664Syar mousechar_arg= 5998184Sgordon case ${mousechar_start} in 6098184Sgordon [Nn][Oo] | '') 6198184Sgordon ;; 6298184Sgordon *) 6398184Sgordon echo -n ' mousechar_start' 64165664Syar mousechar_arg="-M ${mousechar_start}" 6598184Sgordon ;; 6698184Sgordon esac 6798184Sgordon 6898184Sgordon for ttyv in /dev/ttyv* ; do 69165664Syar vidcontrol < ${ttyv} ${mousechar_arg} -m on 7098184Sgordon done 7198184Sgordon echo '.' 7298184Sgordon} 7398184Sgordon 74137112Smtmrun_rc_command $* 75