xref: /freebsd/libexec/rc/rc.d/msconvd (revision aef807876c305587c60f73e2cd914115d22a53fd)
1#!/bin/sh
2#
3#
4
5# PROVIDE: msconvd
6# REQUIRE: DAEMON FILESYSTEMS
7# KEYWORD: nojail shutdown
8
9. /etc/rc.subr
10
11name="msconvd"
12desc="Mouse protocol conversion daemon"
13command="/usr/sbin/${name}"
14start_cmd="msconvd_start"
15pidprefix="/var/run/msconvd"
16load_rc_config $name
17
18: ${msconvd_enable="NO"}
19: ${msconvd_type="auto"}
20
21# doesn't make sense to run in a svcj: nojail keyword
22# XXX: How does msconvd communiacte with the kernel?
23# XXX: Does the kernel prevent this communcation in jails?
24msconvd_svcj="NO"
25
26# Set the pid file and variable name. The second argument, if it exists, is
27# expected to be the mouse device.
28#
29if [ -n "$2" ]; then
30	eval msconvd_$2_enable=\${msconvd_$2_enable-${msconvd_enable}}
31	rcvar="msconvd_$2_enable"
32	pidfile="${pidprefix}.$2.pid"
33else
34	for ms in ${msconvd_ports}; do
35		/etc/rc.d/msconvd $1 ${ms}
36	done
37	exit 0
38fi
39
40msconvd_start()
41{
42	local ms myflags myport mytype
43
44	# Set the mouse device and get any related variables. If
45	# a msconvd device has been specified on the commandline, then
46	# rc.conf(5) variables defined for that device take precedence
47	# over the generic msconvd_* variables. The only exception is
48	# the msconvd_port variable, which if not defined sets it to
49	# the passed in device name.
50	#
51	ms=$1
52	eval myflags=\${msconvd_${ms}_flags-$msconvd_flags}
53	eval myport=\${msconvd_${ms}_port-/dev/${ms}}
54	eval mytype=\${msconvd_${ms}_type-$msconvd_type}
55
56	startmsg -n "Starting ${ms} ${name}"
57	${command} ${myflags} -p ${myport} -t ${mytype} -I ${pidfile}
58	startmsg '.'
59}
60
61run_rc_command $*
62