aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoy Marples <roy@marples.name>2007-11-20 14:44:43 +0000
committerRoy Marples <roy@marples.name>2007-11-20 14:44:43 +0000
commit4a99001a0fad4fd855030d57835ab1643c709f42 (patch)
tree617a40d5f138471e89820e5a18769aed5986e1a2
parentc94bfb2f9b05a09146a906135006c23352151ccb (diff)
Add a moused init script
-rw-r--r--conf.d.BSD/Makefile2
-rw-r--r--conf.d.BSD/moused18
-rw-r--r--init.d.BSD/Makefile2
-rw-r--r--init.d.BSD/moused82
4 files changed, 102 insertions, 2 deletions
diff --git a/conf.d.BSD/Makefile b/conf.d.BSD/Makefile
index e7e8a46f..1c5ac584 100644
--- a/conf.d.BSD/Makefile
+++ b/conf.d.BSD/Makefile
@@ -1,5 +1,5 @@
DIR = /etc/conf.d
-CONF = localmount net.example
+CONF = localmount moused net.example
TOPDIR = ..
include $(TOPDIR)/default.mk
diff --git a/conf.d.BSD/moused b/conf.d.BSD/moused
new file mode 100644
index 00000000..2a7584ab
--- /dev/null
+++ b/conf.d.BSD/moused
@@ -0,0 +1,18 @@
+# See the moused man page for available settings.
+
+# Set to your mouse device psm[0-9] for PS/2 ports, ums[0-9] for USB ports
+# Leave blank to try to autodetect it
+MOUSED_DEVICE=""
+
+# Any additional arguments required
+MOUSED_ARGS=""
+
+# If 0xd0-0xd3 default range is occupied in your language code table, specify
+# alternative range start like MOUSECHAR_START="3", see vidcontrol(1)
+MOUSECHAR_START=""
+
+# You can also multiplex the init script for each device like so
+# ln -s moused /etc/init.d/moused.ums0
+# This enables you to have a config file per mouse (forces MOUSED_DEVICE
+# to ums0 in this case) and control each mouse.
+# devd can also start and stop these mice, which laptop users will find handy.
diff --git a/init.d.BSD/Makefile b/init.d.BSD/Makefile
index ee03f7b9..40163cdb 100644
--- a/init.d.BSD/Makefile
+++ b/init.d.BSD/Makefile
@@ -1,5 +1,5 @@
DIR = /etc/init.d
-BIN = clock sysctl
+BIN = clock moused sysctl
TOPDIR = ..
include $(TOPDIR)/default.mk
diff --git a/init.d.BSD/moused b/init.d.BSD/moused
new file mode 100644
index 00000000..1eb1d1f0
--- /dev/null
+++ b/init.d.BSD/moused
@@ -0,0 +1,82 @@
+#!/sbin/runscript
+# Copyright 2007 Roy Marples
+# All rights reserved
+
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+# SUCH DAMAGE.
+
+name=${SVCNAME##*.}
+if [ -n "${name}" -a "${name}" != "moused" ] ; then
+ device=/dev/"${name}"
+ pidfile=/var/run/moused-"${name}".pid
+else
+ name=
+ pidfile=/var/run/moused.pid
+fi
+
+depend() {
+ need localmount
+ after bootmisc
+}
+
+start() {
+ ebegin "Starting the Console Mouse Daemon" "${name}"
+
+ if [ -z "${device}" ] ; then
+ local dev=
+ for dev in /dev/psm[0-9]* /dev/ums[0-9]* ; do
+ [ -e "${dev}" ] || continue
+ [ -e /var/run/moused-$(basename "${dev}").pid ] && continue
+ device=${dev}
+ eindent
+ einfo "Using mouse on ${device}"
+ eoutdent
+ break
+ done
+ fi
+
+ if [ -z "${device}" ] ; then
+ eend 1 "No mouse device found"
+ return 1
+ fi
+
+ start-stop-daemon --start --exec /usr/sbin/moused \
+ --pidfile "${pidfile}" \
+ -- ${MOUSED_ARGS} -p "${device}" -I "${pidfile}"
+ local retval=$?
+
+ [ -n "${MOUSE_CHAR_START}" ] && MOUSE_CHAR_START="-M ${MOUSE_CHAR_START}"
+ local ttyv=
+ for ttyv in /dev/ttyv*; do
+ vidcontrol < "${ttyv}" ${MOUSE_CHAR_START} -m on
+ : $((${retval} += $?))
+ done
+
+ eend ${retval} "Failed to start moused"
+}
+
+stop() {
+ ebegin "Stopping the Console Mouse Daemon ${name}"
+ start-stop-daemon --quiet --stop --pidfile "${pidfile}"
+ eend $? "Failed to stop moused"
+}
+
+# vim: set ts=4 :