2002-06-13 22:14:37 +00:00
|
|
|
#!/bin/sh
|
|
|
|
#
|
|
|
|
# $FreeBSD$
|
|
|
|
#
|
|
|
|
|
|
|
|
# PROVIDE: moused
|
2005-01-16 03:12:03 +00:00
|
|
|
# REQUIRE: DAEMON cleanvar
|
2008-07-16 19:50:29 +00:00
|
|
|
# KEYWORD: nojail shutdown
|
2002-06-13 22:14:37 +00:00
|
|
|
|
|
|
|
. /etc/rc.subr
|
|
|
|
|
2009-05-30 21:51:38 +00:00
|
|
|
name="moused"
|
2012-01-14 02:18:41 +00:00
|
|
|
rcvar="moused_enable"
|
2002-09-27 16:54:21 +00:00
|
|
|
command="/usr/sbin/${name}"
|
2004-01-17 11:25:16 +00:00
|
|
|
start_cmd="moused_start"
|
2006-12-30 22:53:20 +00:00
|
|
|
pidprefix="/var/run/moused"
|
|
|
|
pidfile="${pidprefix}.pid"
|
|
|
|
pidarg=
|
Do a better job of supporting more than one mouse device
on the system.
To start/stop/check on a specific device give the device name as
the second argument to the script:
# /etc/rc.d/moused start ums0
To use different rc.conf(5) knobs with different mice use the device
name as part of the knob. For example, if the mouse device is ums0, then:
moused_ums0_enable=yes
moused_ums0_flags="-z 4"
moused_ums0_port="/dev/ums0"
Starting rc.d/moused without the device argument will use the standard
moused_* flags. So, this commit should not disrupt or change current usage.
To preserve current behaviour with respect to usb mice, which appear
automatically when inserted, there is a new knob, moused_nondefault_enable,
which will treat any devices without rc.conf knobs as enabled.
To minimize knobs in /etc/rc.conf, the device file and pid file are
auto-computed, so that in the typical case for a usb mouse you don't
need to add anything extra in /etc/rc.conf to get it working.
Additionally, this updates /etc/usbd.conf to use the rc.d/moused script so
people don't have to modify it to configure their usb mouse anymore.
MFC after: 1 month
2004-11-01 18:05:41 +00:00
|
|
|
load_rc_config $name
|
|
|
|
|
|
|
|
# Set the pid file and variable name. The second argument, if it exists, is
|
|
|
|
# expected to be the mouse device.
|
|
|
|
#
|
|
|
|
if [ -n "$2" ]; then
|
2006-05-17 11:37:09 +00:00
|
|
|
eval moused_$2_enable=\${moused_$2_enable-${moused_nondefault_enable}}
|
2012-01-14 02:18:41 +00:00
|
|
|
rcvar="moused_${2}_enable"
|
2006-12-30 22:53:20 +00:00
|
|
|
pidfile="${pidprefix}.$2.pid"
|
|
|
|
pidarg="-I $pidfile"
|
Do a better job of supporting more than one mouse device
on the system.
To start/stop/check on a specific device give the device name as
the second argument to the script:
# /etc/rc.d/moused start ums0
To use different rc.conf(5) knobs with different mice use the device
name as part of the knob. For example, if the mouse device is ums0, then:
moused_ums0_enable=yes
moused_ums0_flags="-z 4"
moused_ums0_port="/dev/ums0"
Starting rc.d/moused without the device argument will use the standard
moused_* flags. So, this commit should not disrupt or change current usage.
To preserve current behaviour with respect to usb mice, which appear
automatically when inserted, there is a new knob, moused_nondefault_enable,
which will treat any devices without rc.conf knobs as enabled.
To minimize knobs in /etc/rc.conf, the device file and pid file are
auto-computed, so that in the typical case for a usb mouse you don't
need to add anything extra in /etc/rc.conf to get it working.
Additionally, this updates /etc/usbd.conf to use the rc.d/moused script so
people don't have to modify it to configure their usb mouse anymore.
MFC after: 1 month
2004-11-01 18:05:41 +00:00
|
|
|
fi
|
2002-06-13 22:14:37 +00:00
|
|
|
|
|
|
|
moused_start()
|
|
|
|
{
|
Do a better job of supporting more than one mouse device
on the system.
To start/stop/check on a specific device give the device name as
the second argument to the script:
# /etc/rc.d/moused start ums0
To use different rc.conf(5) knobs with different mice use the device
name as part of the knob. For example, if the mouse device is ums0, then:
moused_ums0_enable=yes
moused_ums0_flags="-z 4"
moused_ums0_port="/dev/ums0"
Starting rc.d/moused without the device argument will use the standard
moused_* flags. So, this commit should not disrupt or change current usage.
To preserve current behaviour with respect to usb mice, which appear
automatically when inserted, there is a new knob, moused_nondefault_enable,
which will treat any devices without rc.conf knobs as enabled.
To minimize knobs in /etc/rc.conf, the device file and pid file are
auto-computed, so that in the typical case for a usb mouse you don't
need to add anything extra in /etc/rc.conf to get it working.
Additionally, this updates /etc/usbd.conf to use the rc.d/moused script so
people don't have to modify it to configure their usb mouse anymore.
MFC after: 1 month
2004-11-01 18:05:41 +00:00
|
|
|
local ms myflags myport mytype
|
|
|
|
|
|
|
|
# Set the mouse device and get any related variables. If
|
|
|
|
# a moused device has been specified on the commandline, then
|
|
|
|
# rc.conf(5) variables defined for that device take precedence
|
|
|
|
# over the generic moused_* variables. The only exception is
|
|
|
|
# the moused_port variable, which if not defined sets it to the
|
|
|
|
# passed in device name.
|
|
|
|
#
|
|
|
|
ms=$1
|
|
|
|
if [ -n "$ms" ]; then
|
|
|
|
eval myflags=\${moused_${ms}_flags-$moused_flags}
|
|
|
|
eval myport=\${moused_${ms}_port-/dev/$ms}
|
|
|
|
eval mytype=\${moused_${ms}_type-$moused_type}
|
|
|
|
else
|
|
|
|
ms="default"
|
|
|
|
myflags="$moused_flags"
|
|
|
|
myport="$moused_port"
|
|
|
|
mytype="$moused_type"
|
|
|
|
fi
|
|
|
|
|
2009-10-10 22:17:03 +00:00
|
|
|
check_startmsgs && echo -n "Starting ${ms} moused"
|
2006-12-30 22:53:20 +00:00
|
|
|
/usr/sbin/moused ${myflags} -p ${myport} -t ${mytype} ${pidarg}
|
2009-10-10 22:17:03 +00:00
|
|
|
check_startmsgs && echo '.'
|
2002-06-13 22:14:37 +00:00
|
|
|
|
2006-12-30 22:53:20 +00:00
|
|
|
mousechar_arg=
|
2002-06-13 22:14:37 +00:00
|
|
|
case ${mousechar_start} in
|
|
|
|
[Nn][Oo] | '')
|
|
|
|
;;
|
|
|
|
*)
|
2006-12-30 22:53:20 +00:00
|
|
|
mousechar_arg="-M ${mousechar_start}"
|
2002-06-13 22:14:37 +00:00
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
for ttyv in /dev/ttyv* ; do
|
2006-12-30 22:53:20 +00:00
|
|
|
vidcontrol < ${ttyv} ${mousechar_arg} -m on
|
2002-06-13 22:14:37 +00:00
|
|
|
done
|
|
|
|
}
|
|
|
|
|
Do a better job of supporting more than one mouse device
on the system.
To start/stop/check on a specific device give the device name as
the second argument to the script:
# /etc/rc.d/moused start ums0
To use different rc.conf(5) knobs with different mice use the device
name as part of the knob. For example, if the mouse device is ums0, then:
moused_ums0_enable=yes
moused_ums0_flags="-z 4"
moused_ums0_port="/dev/ums0"
Starting rc.d/moused without the device argument will use the standard
moused_* flags. So, this commit should not disrupt or change current usage.
To preserve current behaviour with respect to usb mice, which appear
automatically when inserted, there is a new knob, moused_nondefault_enable,
which will treat any devices without rc.conf knobs as enabled.
To minimize knobs in /etc/rc.conf, the device file and pid file are
auto-computed, so that in the typical case for a usb mouse you don't
need to add anything extra in /etc/rc.conf to get it working.
Additionally, this updates /etc/usbd.conf to use the rc.d/moused script so
people don't have to modify it to configure their usb mouse anymore.
MFC after: 1 month
2004-11-01 18:05:41 +00:00
|
|
|
run_rc_command $*
|