From d7a49effc532a54b50b73424af1799c546e879b6 Mon Sep 17 00:00:00 2001 From: Willy Tarreau Date: Thu, 1 Sep 2016 13:53:39 +0200 Subject: cfg-add-mouse: detect mouse and update config.rc accordingly This is what used to be done in startup.rc, a bit cleaned up. It avoids touching config.rc for no reason. Unlike its predecessor, it removes a previous version of the section before creating a new one. It relies on updated init-scripts to support section removal. --- cfg-add-mouse | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100755 cfg-add-mouse diff --git a/cfg-add-mouse b/cfg-add-mouse new file mode 100755 index 0000000..7fd19ed --- /dev/null +++ b/cfg-add-mouse @@ -0,0 +1,24 @@ +#!/bin/bash + +[ -x /sbin/init.d/mouse ] || exit 0 + +if dmesg | grep -qsi "^input.*USB.*Mouse" ; then + printf "Content-length: 0\n\n" | /sbin/init.d/mouse setsec 2>/dev/null + cat >> /etc/config.rc << EOF +service mouse + type ps2 + device /dev/input/mice + +EOF +elif [ -e /proc/misc ] && grep -qs psaux /proc/misc ; then + printf "Content-length: 0\n\n" | /sbin/init.d/mouse setsec 2>/dev/null + cat >> /etc/config.rc << EOF +service mouse + # PS/2 mouse can hang certain systems. + no autostart + device /dev/psaux + +EOF +fi + +exit 0 -- 1.7.12.1