198184Sgordon#!/bin/sh 298184Sgordon# 398184Sgordon# $FreeBSD: releng/11.0/etc/rc.d/moused 298514 2016-04-23 16:10:54Z lme $ 498184Sgordon# 598184Sgordon 698184Sgordon# PROVIDE: moused 7240336Sobrien# REQUIRE: DAEMON FILESYSTEMS 8180564Sdougb# KEYWORD: nojail shutdown 998184Sgordon 1098184Sgordon. /etc/rc.subr 1198184Sgordon 12193119Sdougbname="moused" 13298514Slmedesc="Mouse daemon" 14230099Sdougbrcvar="moused_enable" 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}} 27230099Sdougb rcvar="moused_${2}_enable" 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 55197947Sdougb check_startmsgs && echo -n "Starting ${ms} moused" 56165664Syar /usr/sbin/moused ${myflags} -p ${myport} -t ${mytype} ${pidarg} 57197947Sdougb check_startmsgs && echo '.' 58137112Smtm 59165664Syar mousechar_arg= 6098184Sgordon case ${mousechar_start} in 6198184Sgordon [Nn][Oo] | '') 6298184Sgordon ;; 6398184Sgordon *) 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} 7298184Sgordon 73137112Smtmrun_rc_command $* 74