198184Sgordon#!/bin/sh 298184Sgordon# 398184Sgordon# $FreeBSD: releng/10.3/etc/rc.d/moused 240336 2012-09-11 05:04:59Z obrien $ 498184Sgordon# 598184Sgordon 698184Sgordon# PROVIDE: moused 7240336Sobrien# REQUIRE: DAEMON FILESYSTEMS 8180564Sdougb# KEYWORD: nojail shutdown 998184Sgordon 1098184Sgordon. /etc/rc.subr 1198184Sgordon 12193119Sdougbname="moused" 13230099Sdougbrcvar="moused_enable" 14104039Sgordoncommand="/usr/sbin/${name}" 15124627Smtmstart_cmd="moused_start" 16165664Syarpidprefix="/var/run/moused" 17165664Syarpidfile="${pidprefix}.pid" 18165664Syarpidarg= 19137112Smtmload_rc_config $name 2098184Sgordon 21137112Smtm# Set the pid file and variable name. The second argument, if it exists, is 22137112Smtm# expected to be the mouse device. 23137112Smtm# 24137112Smtmif [ -n "$2" ]; then 25158692Smatteo eval moused_$2_enable=\${moused_$2_enable-${moused_nondefault_enable}} 26230099Sdougb rcvar="moused_${2}_enable" 27165664Syar pidfile="${pidprefix}.$2.pid" 28165664Syar pidarg="-I $pidfile" 29137112Smtmfi 30137112Smtm 3198184Sgordonmoused_start() 3298184Sgordon{ 33137112Smtm local ms myflags myport mytype 3498184Sgordon 35137112Smtm # Set the mouse device and get any related variables. If 36137112Smtm # a moused device has been specified on the commandline, then 37137112Smtm # rc.conf(5) variables defined for that device take precedence 38137112Smtm # over the generic moused_* variables. The only exception is 39137112Smtm # the moused_port variable, which if not defined sets it to the 40137112Smtm # passed in device name. 41137112Smtm # 42137112Smtm ms=$1 43137112Smtm if [ -n "$ms" ]; then 44137112Smtm eval myflags=\${moused_${ms}_flags-$moused_flags} 45137112Smtm eval myport=\${moused_${ms}_port-/dev/$ms} 46137112Smtm eval mytype=\${moused_${ms}_type-$moused_type} 47137112Smtm else 48137112Smtm ms="default" 49137112Smtm myflags="$moused_flags" 50137112Smtm myport="$moused_port" 51137112Smtm mytype="$moused_type" 52137112Smtm fi 53137112Smtm 54197947Sdougb check_startmsgs && echo -n "Starting ${ms} moused" 55165664Syar /usr/sbin/moused ${myflags} -p ${myport} -t ${mytype} ${pidarg} 56197947Sdougb check_startmsgs && echo '.' 57137112Smtm 58165664Syar mousechar_arg= 5998184Sgordon case ${mousechar_start} in 6098184Sgordon [Nn][Oo] | '') 6198184Sgordon ;; 6298184Sgordon *) 63165664Syar mousechar_arg="-M ${mousechar_start}" 6498184Sgordon ;; 6598184Sgordon esac 6698184Sgordon 6798184Sgordon for ttyv in /dev/ttyv* ; do 68165664Syar vidcontrol < ${ttyv} ${mousechar_arg} -m on 6998184Sgordon done 7098184Sgordon} 7198184Sgordon 72137112Smtmrun_rc_command $* 73