--- mouseemu-0.16.orig/debian/mouseemu.preinst +++ mouseemu-0.16/debian/mouseemu.preinst @@ -0,0 +1,35 @@ +#!/bin/sh -e + +prepare_move_conffile () { + SOURCE="$1" + TARGET="$2" + [ -e "$SOURCE" ] || return 0 + + md5sum="$(md5sum "$SOURCE" | sed -e 's/ .*//')" + old_md5sum="$(dpkg -s mouseemu | sed -n -e "/^Conffiles:/,/^[^ ]/{\\' $SOURCE'{s/^ [^ ]* //;s/ .*//;p}}")" + if [ "$md5sum" = "$old_md5sum" ]; then + echo >&2 "Moving unmodified conffile $SOURCE to $TARGET ..." + mv -f "$SOURCE" "$SOURCE.moved-by-preinst" + else + echo >&2 "Moving modified conffile $SOURCE to $TARGET ..." + mv -f "$SOURCE" "$TARGET" + fi + return 0 +} + +# if upgrading from version below 0.15-3 +# give mouseemu some time to terminate +if [ "$1" = "upgrade" ] && dpkg --compare-versions "$2" le 0.15-3 ; then + sleep 5 +fi + +case $1 in + install|upgrade) + if dpkg --compare-versions "$2" lt 0.15-6ubuntu2; then + prepare_move_conffile /etc/udev/mouseemu.rules \ + /etc/udev/rules.d/85-mouseemu.rules + fi + ;; +esac + +#DEBHELPER# --- mouseemu-0.16.orig/debian/mouseemu.postinst +++ mouseemu-0.16/debian/mouseemu.postinst @@ -0,0 +1,63 @@ +#! /bin/sh +# postinst script for mouseemu +# +# see: dh_installdeb(1) + +set -e + +commit_move_conffile () { + SOURCE="$1" + TARGET="$2" + + if [ -e "$SOURCE.moved-by-preinst" ]; then + rm -f "$SOURCE.moved-by-preinst" + fi +} + +# summary of how this script can be called: +# * `configure' +# * `abort-upgrade' +# * `abort-remove' `in-favour' +# +# * `abort-deconfigure' `in-favour' +# `removing' +# +# for details, see http://www.debian.org/doc/debian-policy/ or +# the debian-policy package +# + +case "$1" in + configure) + if [ -z $2 ]; then + # First install of mouseemu + echo -n "Creating /dev/input/uinput..." + (cd /dev; ./MAKEDEV uinput) + echo "done." + fi + + if dpkg --compare-versions "$2" lt 0.15-6ubuntu2; then + commit_move_conffile /etc/udev/mouseemu.rules \ + /etc/udev/rules.d/85-mouseemu.rules + rm -f /etc/udev/rules.d/025_mouseemu.rules + fi + + ;; + + abort-upgrade|abort-remove|abort-deconfigure) + + ;; + + *) + echo "postinst called with unknown argument \`$1'" >&2 + exit 1 + ;; +esac + +# dh_installdeb will replace this with shell code automatically +# generated by other debhelper scripts. + +#DEBHELPER# + +exit 0 + + --- mouseemu-0.16.orig/debian/mouseemu.docs +++ mouseemu-0.16/debian/mouseemu.docs @@ -0,0 +1 @@ +README --- mouseemu-0.16.orig/debian/watch +++ mouseemu-0.16/debian/watch @@ -0,0 +1,2 @@ +version=3 +http://www.geekounet.org/powerbook/files/mouseemu-(.*)\.tar\.gz --- mouseemu-0.16.orig/debian/mouseemu.init +++ mouseemu-0.16/debian/mouseemu.init @@ -0,0 +1,74 @@ +#! /bin/sh +# +# init.d script for mouseemu + +### BEGIN INIT INFO +# Provides: mouseemu +# Required-Start: udev $local_fs $remote_fs +# Required-Stop: udev $local_fs $remote_fs +# Should-Start: $syslog +# Should-Stop: $syslog +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +# Short-Description: Emulate mouse buttons and mouse wheel +# Description: Mouseemu is a daemon to emulate mouse buttons on trackpads +# with only one button. It lets you: +# - emulate middle and right click +# - emulate mouse wheel +# - block trackpad while typing +# +### END INIT INFO + +PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin +DAEMON=/usr/sbin/mouseemu +NAME=mouseemu +DESC="mouse emulation daemon" + +test -x $DAEMON || exit 0 + +. /lib/lsb/init-functions + +# Include mouseemu defaults if available +if [ -f /etc/default/mouseemu ] ; then + . /etc/default/mouseemu + MOUSEEMU_OPTS="$MID_CLICK $RIGHT_CLICK $SCROLL $TYPING_BLOCK" +fi + +set -e + +case "$1" in + start) + log_daemon_msg "Starting $DESC" "$NAME" + modprobe -q uinput || true + # Give udev some time to create the device node + if which udevadm >/dev/null 2>&1; then + udevadm settle + fi + set +e + start-stop-daemon --start --quiet --exec $DAEMON --nicelevel -10 -- $MOUSEEMU_OPTS + log_end_msg $? + set -e + ;; + stop) + log_daemon_msg "Stopping $DESC" "$NAME" + set +e + start-stop-daemon --stop --oknodo --retry 3 --quiet --exec $DAEMON + log_end_msg $? + set -e + ;; + restart|force-reload) + log_daemon_msg "Restarting $DESC" "$NAME" + set +e + start-stop-daemon --stop --oknodo --retry 3 --quiet --exec $DAEMON + start-stop-daemon --start --quiet --exec $DAEMON --nicelevel -10 -- $MOUSEEMU_OPTS + log_end_msg $? + set -e + ;; + *) + N=/etc/init.d/$NAME + log_action_msg "Usage: $N {start|stop|restart|force-reload}" + exit 1 + ;; +esac + +exit 0 --- mouseemu-0.16.orig/debian/mouseemu.udev +++ mouseemu-0.16/debian/mouseemu.udev @@ -0,0 +1,3 @@ +# Send mouseemu a HUP signal if a new event device is connected + +ACTION=="add", KERNEL=="event[0-9]*", RUN+="/bin/sh -c '/bin/kill -HUP $$(pidof mouseemu)'" --- mouseemu-0.16.orig/debian/mouseemu.dirs +++ mouseemu-0.16/debian/mouseemu.dirs @@ -0,0 +1,2 @@ +usr/sbin +usr/share/man/man8 --- mouseemu-0.16.orig/debian/control +++ mouseemu-0.16/debian/control @@ -0,0 +1,26 @@ +Source: mouseemu +Section: utils +Priority: optional +Maintainer: Colin Watson +XSBC-Original-Maintainer: Gaudenz Steinlin +Build-Depends: debhelper (>= 7.0.17ubuntu2), dpatch +Standards-Version: 3.7.2 +XS-Vcs-Svn: svn://svn.debian.org/collab-maint/deb-maint/mouseemu/trunk + +Package: mouseemu +Architecture: any +Depends: ${shlibs:Depends}, ${misc:Depends}, procps, ${dmidecode-depends} +Breaks: udev (<< 136-1) +Description: Emulate mouse buttons and mouse wheel + Mouseemu is a daemon to emulate mouse buttons on trackpads + with only one button. It lets you: + - emulate middle and right click + - emulate mouse wheel + - block trackpad while typing + . + It was initially developed for Apple PowerBooks + and iBooks, but it may be useful on other architectures + as well. + . + This program only works when booting a 2.6 kernel because + it uses the new uinput interface to emulate the mouse. --- mouseemu-0.16.orig/debian/copyright +++ mouseemu-0.16/debian/copyright @@ -0,0 +1,12 @@ +This package was debianized by Guido Guenther on +Mon, 5 Apr 2004 02:03:22 +0200. + +It was downloaded from http://www.geekounet.org/powerbook/files/ + +Upstream Author: Colin Leroy + +Copyright: + +You are free to distribute this software under the terms of the GNU General +Public License Version 2. The full text of this license can be found in the +file /usr/share/common-licenses/GPL-2 --- mouseemu-0.16.orig/debian/README.Debian +++ mouseemu-0.16/debian/README.Debian @@ -0,0 +1,13 @@ +Mouseemu uses uinput which is accessible through +/dev/input/uinput. If you don't already have this +device and are not using either udev or devfs you +have to create this device node by calling + +cd /dev ; ./MAKEDEV uinput + +The postinst script should create the device node +for you upon the first installation of mouseemu. So +this is only necessary in unusual situations or if +you manually delete the device node. + + -- Gaudenz Steinlin , Wed Mar 30 03:07:15 2005 --- mouseemu-0.16.orig/debian/mouseemu.postrm +++ mouseemu-0.16/debian/mouseemu.postrm @@ -0,0 +1,28 @@ +#!/bin/sh -e + +#DEBHELPER# + +abort_move_conffile () { + SOURCE="$1" + TARGET="$2" + + if [ -e "$SOURCE.moved-by-preinst" ]; then + echo >&2 "Aborting move of unmodified conffile $SOURCE to $TARGEET ..." + mv -f "$SOURCE.moved-by-preinst" "$SOURCE" + elif [ -e "$TARGET" ]; then + echo >&2 "Aborting move of modified conffile $SOURCE to $TARGET ..." + mv -f "$TARGET" "$SOURCE" + fi + return 0 +} + +case $1 in + abort-install|abort-upgrade) + if dpkg --compare-versions "$2" lt 0.15-6ubuntu2; then + abort_move_conffile /etc/udev/mouseemu.rules \ + /etc/udev/rules.d/85-mouseemu.rules + fi + ;; +esac + +exit 0 --- mouseemu-0.16.orig/debian/changelog +++ mouseemu-0.16/debian/changelog @@ -0,0 +1,284 @@ +mouseemu (0.16-0ubuntu4) karmic; urgency=low + + * more_mouse_buttons.dpatch: If the real mouse devices on the system + support any buttons other than left, middle, and right, enable those on + the virtual mouse device too so that passthrough will work properly for + them (LP: #419947). + + -- Colin Watson Fri, 28 Aug 2009 08:45:40 +0100 + +mouseemu (0.16-0ubuntu3) jaunty; urgency=low + + * debian/mouseemu.rules: Rename to debian/mouseemu.udev + * debian/rules: Install udev rules with dh_installudev + * debian/control: Bump build-dependency on debhelper to install into new + /lib/udev/rules.d directory, add Breaks on udev to ensure we have the + correct version. + * debian/mouseemu.dirs: No need to install directory + + -- Scott James Remnant Mon, 12 Jan 2009 21:39:54 +0000 + +mouseemu (0.16-0ubuntu2) intrepid; urgency=low + + * Upstream release 0.16 in fact dated from before 0.15-4. Thus, the effect + of ceasing to apply lots of patch files was to drop all the changes made + to those patches since 0.15-3, including much of the work done in Ubuntu + to support Intel Macs, resulting in several regressions. The net effect + of fixing this is to bring the actual built code back to almost exactly + what it was before. In future, please don't upload new upstream versions + involving complicated patch resync jobs late in the cycle! + + * 41_defaults.dpatch: + - Revert #ifdef __powerpc__ in defkeys.h, since we handle that + separately in order to permit run-time detection of Intel Macs. + - Document Intel Mac handling in mouseemu(8) and --help. + * 61_rescan.dpatch: + - Block SIGHUP and SIGALRM in the parent. + - Fix rescan_devs not to skip every other input handler. + * 63_pidfile.dpatch: + - Exit gracefully if pidfile creation fails. + * 99_ubuntu_defaults.dpatch: + - Change middle-click default to F11 and right-click default to F12. + Disable scroll emulation by default. + + -- Colin Watson Thu, 16 Oct 2008 21:34:21 +0100 + +mouseemu (0.16-0ubuntu1) intrepid; urgency=low + + * New upstream release (LP: #269965). + - debian/patches: + + Removed 01_nofork.dpatch, fixed upstream. + + Removed 11_mod-passthrough.dpatch + + Removed 21_makefile.dpatch + + Removed 31_usage.dpatch + + Removed 51_manpage.dpatch + + Removed 61_rescan.dpatch + + Removed syslog.dpatch + + Removed 63_pidfile.dpatch + + Removed 99_ubuntu_defaults.dpatch + + Removed '-534,10 +538,16' in 41_defaults.dpatch, patch no longer + applies + + -- Nick Ellery Wed, 15 Oct 2008 16:54:24 -0700 + +mouseemu (0.15-8ubuntu3) hardy; urgency=low + + * Fix -x call. + + -- Scott James Remnant Fri, 14 Dec 2007 16:55:48 +0000 + +mouseemu (0.15-8ubuntu2) hardy; urgency=low + + * debian/mouseemu.init: call udevadm instead of udevsettle + + -- Scott James Remnant Fri, 14 Dec 2007 16:38:09 +0000 + +mouseemu (0.15-8ubuntu1) gutsy; urgency=low + + * Resynchronise with Debian. Remaining changes: + - debian/patches/99_ubuntu_defaults.dpatch: Change middle-click default + to F11 and right-click default to F12. Disable scroll emulation by + default. + - Move udev rules file to /etc/udev/rules.d/85-mouseemu.rules to comply + with Ubuntu's udev policy. + - debian/mouseemu.init: Run mouseemu at nice -10. + - debian/mouseemu.init: Convert to LSB init functions. + - debian/mouseemu.init: Use udevsettle rather than 'sleep 1' to wait for + input devices to appear. + + -- Colin Watson Mon, 11 Jun 2007 18:48:01 +0100 + +mouseemu (0.15-8) unstable; urgency=low + + * debian/patches/63_pidfile.dpatch: exit gracefully if pidfile creation + fails. Thanks to colin Watson. (Closes: #426020) + + -- Gaudenz Steinlin Tue, 29 May 2007 18:15:39 +0200 + +mouseemu (0.15-7ubuntu2) gutsy; urgency=low + + * Check for errors when opening pidfile (LP: #112337). + + -- Colin Watson Fri, 25 May 2007 17:27:00 +0100 + +mouseemu (0.15-7ubuntu1) gutsy; urgency=low + + * Resynchronise with Debian. Thanks to Gaudenz Steinlin for merging so + much! Remaining changes: + - debian/patches/99_ubuntu_defaults.dpatch: Change middle-click default + to F11 and right-click default to F12. Disable scroll emulation by + default. + - Move udev rules file to /etc/udev/rules.d/85-mouseemu.rules to comply + with Ubuntu's udev policy. + - debian/mouseemu.init: Run mouseemu at nice -10. + - debian/mouseemu.init: Convert to LSB init functions. + - debian/mouseemu.init: Use udevsettle rather than 'sleep 1' to wait for + input devices to appear. + + -- Colin Watson Fri, 18 May 2007 09:11:50 +0100 + +mouseemu (0.15-7) unstable; urgency=low + + * The "The hard work was done by Ubuntu" release + * debian/patches/bustype_virtual.dpatch: Use new BUS_VIRTUAL bus type for + our uinput devices (Closes: 304734). Thanks to Colin Watson and Ubuntu for + this patch. + * debian/patches/dual_devices.dpatch: Handle input devices that provide + both keyboard and mouse events. Thanks to Colin Watson for the patch. + (Closes: 407725) + * update debian/patches/61_rescan.dpatch: Block SIGHUP and SIGALRM in the + parent. Fix rescan_devs not to skip every other input handler. Taken from + Ubuntu. + * update debian/patches/41_defaults.dpatch, debian/control, debian/rules, + debian/patches/51_manpage: Enable Mouse Button Emulation by Default on + Intel Macs. Use dmidecode to detect Intel Macs. Code taken from Ubuntu. + + -- Gaudenz Steinlin Sun, 29 Apr 2007 17:53:10 +0200 + +mouseemu (0.15-6ubuntu5) feisty; urgency=low + + * debian/mouseemu.init: Convert to LSB init functions (LP: #85576). + * debian/mouseemu.init: Use udevsettle rather than 'sleep 1' to wait for + input devices to appear. + + -- Colin Watson Sat, 24 Mar 2007 17:54:00 +0000 + +mouseemu (0.15-6ubuntu4) feisty; urgency=low + + * debian/mouseemu.init: Run mouseemu at nice -10. Keyboard and mouse + events are important, OK? + * debian/control: Set Maintainer to me. + + -- Colin Watson Wed, 14 Mar 2007 11:53:18 +0000 + +mouseemu (0.15-6ubuntu3) feisty; urgency=low + + * debian/patches/dual_devices.dpatch: Handle input devices that provide + both keyboard and mouse events. + * debian/patches/41_defaults.dpatch, debian/control, debian/rules: Improve + Intel Mac detection using dmidecode. + * debian/patches/61_rescan.dpatch: Block SIGHUP and SIGALRM in the parent. + Fix rescan_devs not to skip every other input handler. + * debian/patches/63_pidfile.dpatch: Update. + + -- Colin Watson Thu, 8 Feb 2007 02:17:03 +0000 + +mouseemu (0.15-6ubuntu2) feisty; urgency=low + + * debian/patches/99_ubuntu_defaults.dpatch: Disable scroll emulation by + default; I find it much too easy to trip unintentionally, and the effect + is surprising. + * debian/patches/bustype_virtual.dpatch: Use new BUS_VIRTUAL bus type for + our uinput devices (LP: #67954). + * Move udev rules file to /etc/udev/rules.d/85-mouseemu.rules to comply + with Ubuntu's udev policy. + + -- Colin Watson Fri, 8 Dec 2006 14:34:31 +0000 + +mouseemu (0.15-6ubuntu1) feisty; urgency=low + + * Resynchronise with Debian. Remaining changes: + - Emulate mouse buttons by default on Intel Macs. + - Change middle-click default to F11 and right-click default to F12. + + -- Colin Watson Fri, 8 Dec 2006 04:11:06 +0000 + +mouseemu (0.15-6) unstable; urgency=medium + + + + [ Guido Guenther ] + * Intialize all fields in uinput_user_dev (initialize_device.dpatch) + (closes: #399231) + * Fix write error detection (write_error.dpatch) + + -- Gaudenz Steinlin Sun, 19 Nov 2006 11:37:40 +0100 + +mouseemu (0.15-5ubuntu2) feisty; urgency=low + + * debian/patches/41_defaults.dpatch: Include and + to fix build failure. + + -- Colin Watson Fri, 24 Nov 2006 10:27:07 +0000 + +mouseemu (0.15-5ubuntu1) feisty; urgency=low + + * debian/patches/41_defaults.dpatch: Emulate mouse buttons by default on + Intel Macs. + * debian/patches/99_ubuntu_defaults.dpatch, debian/mouseemu.default: + Change middle-click default to F11 and right-click default to F12, to + match existing Ubuntu configuration in procps. + + -- Colin Watson Fri, 17 Nov 2006 12:47:07 -0800 + +mouseemu (0.15-5) unstable; urgency=medium + + * don't fail to start if uinput is not compiled as a module (Closes: 393782) + + -- Gaudenz Steinlin Mon, 30 Oct 2006 12:25:57 +0100 + +mouseemu (0.15-4) unstable; urgency=low + + * XS-Vcs Field + * change pkill into kill $(pidof ...) in mouseemu.rules (Closes: #358655) + * check for /sbin/udevcontrol before running it (Closes: #361042) + * add /etc/udev/rules.d to package (don't depend on udev beeing installed) + * recreate broken syslog patch + * send missing uinput error message to stderr instead of syslog (Closes: #369804) + * update standards version to 3.7.2, no changes needed + * update debhelper compatibility level to 5, depend on debhelper >=5 + * LSBize init script + + -- Gaudenz Steinlin Thu, 5 Oct 2006 02:23:54 +0200 + +mouseemu (0.15-3) unstable; urgency=low + + * The kudos to Michael Schmitz release! + * example section in manpage (closes: #354148) + * close all devices and trigger a rescan if a device + disapears (closes: #355794, #307068) + * rescan for new devices every 5s (off by default) + * manually rescan for new devices on HUP + * output messages to syslog + * create pidfile /var/run/mouseemu.pid + * scan up to 32 event devices (closes: #326486) + * increase delay between stoping and starting mouseemu + on restart to give it more time to stop all processes + * add a udev rules file to rescan for new devices + * add --retry to start-stop-daemon on stopping to make sure + mouseemu really stops + * add preinst script to ensure that mouseemu is really stopped + + -- Gaudenz Steinlin Tue, 14 Mar 2006 02:13:00 +0100 + +mouseemu (0.15-2) unstable; urgency=medium + + * convert patches to dpatch + * passthrough modifier keys (closes: #304328) + * improve documentation about default behaviour (closes: #303883). + * change default to not emulate mouse buttons on !powerpc + * improve usage message + * fix -nofork option + + -- Gaudenz Steinlin Thu, 21 Apr 2005 01:46:24 +0200 + +mouseemu (0.15-1) unstable; urgency=low + + * New upstream release + - manpage now in upstream tarball + * change Makefile to install manpage to + /usr/share/man + + -- Gaudenz Steinlin Thu, 31 Mar 2005 00:04:30 +0200 + +mouseemu (0.14-1) unstable; urgency=low + + * Initial Release for Debian (Closes: #293240) + - Thanks to Guido Guenther for his work on the + inofficial packages! + * add manpage for Debian + * add init script and default configuration in + /etc/default/mouseemu + + -- Gaudenz Steinlin Wed, 30 Mar 2005 01:27:12 +0200 + --- mouseemu-0.16.orig/debian/rules +++ mouseemu-0.16/debian/rules @@ -0,0 +1,100 @@ +#!/usr/bin/make -f +# -*- makefile -*- +# Sample debian/rules that uses debhelper. +# GNU copyright 1997 to 1999 by Joey Hess. + +# Uncomment this to turn on verbose mode. +#export DH_VERBOSE=1 + + + + +CFLAGS = -Wall -g + +ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS))) + CFLAGS += -O0 +else + CFLAGS += -O2 +endif +ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS))) + INSTALL_PROGRAM += -s +endif + +DEB_HOST_ARCH := $(shell dpkg-architecture -qDEB_HOST_ARCH) + +ifneq (,$(findstring :$(DEB_HOST_ARCH):,:i386:amd64:)) +dmidecode := dmidecode +else +dmidecode := +endif + +# include dpatch patch/unpatch targets +include /usr/share/dpatch/dpatch.make + +configure: configure-stamp +configure-stamp: patch + dh_testdir + # Add here commands to configure the package. + # Nothing required to configure yet + + touch configure-stamp + + +build: build-stamp + +build-stamp: configure-stamp + dh_testdir + + # Add here commands to compile the package. + $(MAKE) + + touch build-stamp + +clean: clean-patched unpatch +clean-patched: + dh_testdir + dh_testroot + rm -f build-stamp configure-stamp + + # Add here commands to clean up after the build process. + -$(MAKE) clean + + dh_clean + +install: build + dh_testdir + dh_testroot + dh_clean -k + dh_installdirs + + # Add here commands to install the package into debian/mouseemu. + $(MAKE) install DESTDIR=$(CURDIR)/debian/mouseemu + + +# Build architecture-independent files here. +binary-indep: build install +# We have nothing to do by default. + +# Build architecture-dependent files here. +binary-arch: build install + dh_testdir + dh_testroot + dh_installchangelogs + dh_installdocs + dh_installexamples +# dh_installdebconf + dh_installinit + dh_installudev --priority=85 +# dh_installman + dh_link + dh_strip + dh_compress + dh_fixperms + dh_installdeb + dh_shlibdeps + dh_gencontrol -- -V'dmidecode-depends=$(dmidecode)' + dh_md5sums + dh_builddeb + +binary: binary-indep binary-arch +.PHONY: build clean binary-indep binary-arch binary install configure --- mouseemu-0.16.orig/debian/mouseemu.default +++ mouseemu-0.16/debian/mouseemu.default @@ -0,0 +1,13 @@ +# Defaults for mouseemu initscript (/etc/init.d/mouseemu) +# These are the default values on PowerPC. On all other architectures +# middle and right click are disabled by default. +# Key codes can be found in include/linux/input.h in the kernel headers +# or by using `showkey` in a console. + + +#MID_CLICK="-middle 0 87" # F11 with no modifier +#MID_CLICK="-middle 125 272" # Left Apple Key (LEFTMETA) + click +#RIGHT_CLICK="-right 0 88" # F12 with no modifier +#RIGHT_CLICK="-right 29 272" # Left Ctrl + click +#SCROLL="-scroll 56" # Alt key +#TYPING_BLOCK="-typing-block 300" # block mouse for 300ms after a keypress --- mouseemu-0.16.orig/debian/compat +++ mouseemu-0.16/debian/compat @@ -0,0 +1 @@ +5 --- mouseemu-0.16.orig/debian/patches/initialize_device.dpatch +++ mouseemu-0.16/debian/patches/initialize_device.dpatch @@ -0,0 +1,19 @@ +#! /bin/sh /usr/share/dpatch/dpatch-run +## write_error.dpatch by +## +## All lines beginning with `## DP:' are a description of the patch. +## DP: Intialize all fields in uinput_user_dev, otherwise strange things +## DP: like dead keyboard, etc. might happen +## +diff --git a/mouseemu.c b/mouseemu.c +index 6decb59..9c5b332 100644 +--- a/mouseemu.c ++++ b/mouseemu.c +@@ -365,6 +365,7 @@ int uinput_setup(void) + struct uinput_user_dev device; + int i; + ++ memset(&device, 0, sizeof(struct uinput_user_dev)); + /*setup keyboard device */ + + if(ui_keyb_fd > 0) { --- mouseemu-0.16.orig/debian/patches/write_error.dpatch +++ mouseemu-0.16/debian/patches/write_error.dpatch @@ -0,0 +1,19 @@ +#! /bin/sh /usr/share/dpatch/dpatch-run +## write_error.dpatch by +## +## All lines beginning with `## DP:' are a description of the patch. +## DP: Fix write error detection +## +@DPATCH@ + +--- a/mouseemu.c.orig 2006-11-18 17:36:47.000000000 +0100 ++++ b/mouseemu.c 2006-11-18 17:47:11.000000000 +0100 +@@ -88,7 +88,7 @@ + + static void passthrough(int fd, struct input_event event) + { +- if (write(fd, &event, sizeof(event)) < sizeof(event)) ++ if (write(fd, &event, sizeof(event)) <= 0) + perror("passthrough error"); + + } --- mouseemu-0.16.orig/debian/patches/61_rescan.dpatch +++ mouseemu-0.16/debian/patches/61_rescan.dpatch @@ -0,0 +1,39 @@ +#! /bin/sh /usr/share/dpatch/dpatch-run +## 61_rescan.dpatch by Colin Watson +## +## All lines beginning with `## DP:' are a description of the patch. +## DP: Block SIGHUP and SIGALRM in the parent. Fix rescan_devs not to skip +## DP: every other input handler. + +@DPATCH@ +diff -urNad mouseemu-0.16~/mouseemu.c mouseemu-0.16/mouseemu.c +--- mouseemu-0.16~/mouseemu.c 2008-10-16 21:22:33.000000000 +0100 ++++ mouseemu-0.16/mouseemu.c 2008-10-16 21:24:16.000000000 +0100 +@@ -298,7 +298,10 @@ + cfd=ihandler[i].fd; + unregister_inputhandler(ihandler[i].fd); + close(cfd); ++ i--; + } ++ } ++ for (i=0; i +## +## All lines beginning with `## DP:' are a description of the patch. +## DP: print usage message to stderr for wrong arguments + +@DPATCH@ + +--- mouseemu/mouseemu.c 2005-03-30 08:40:30.000000000 +0200 ++++ mouseemu-0.15/mouseemu.c 2005-04-21 01:38:19.181189725 +0200 +@@ -517,6 +517,31 @@ + + } + ++/* print usage message to stdout/stderr */ ++void usage(FILE *stream, char *argv[]) { ++ fprintf(stream, "usage: %s \n" ++ "\t[-middle B2_MOD B2_KEY]\n" ++ "\t[-right B3_MOD B3_KEY]\n" ++ "\t[-scroll SCROLL_MOD]\n" ++ "\t[-typing-block DELAY]\n" ++ "\t[-device UINPUT_DEVICE]\n" ++ "\t[-nofork]\n", ++ argv[0]); ++ fprintf(stream, "All modifier and button key arguments are\n" ++ "key scancodes. They can be found in \n" ++ "/usr/src/linux/include/linux/input.h,\n" ++ "or by using `showkey` in a console.\n" ++ "Use decimal values. BTN_LEFT(272) is usable as " ++ "B2_KEY or B3_KEY.\n\n"); ++ fprintf(stream, "Default uinput device: " DEFAULT_UINPUT ".\n"); ++ fprintf(stream, "Default keys:\n" ++ "\tMiddle click : F10 (0 68)\n" ++ "\tRight click : F11 (0 87)\n" ++ "\tScroll mod. : Alt (56)\n" ++ "\tDefault blocking time while typing: 300ms\n"); ++ ++ exit(0); ++} + + int main(int argc, char *argv[]) + { +@@ -535,72 +560,59 @@ + if (argc > 1) { + int i = 0; + if (!strcmp(argv[1],"-help")) { +-err: +- printf("usage: %s \n" +- "\t[-middle B2_MOD B2_KEY]\n" +- "\t[-right B3_MOD B3_KEY]\n" +- "\t[-scroll SCROLL_MOD]\n" +- "\t[-typing-block DELAY]\n" +- "\t[-device UINPUT_DEVICE]\n" +- "\t[-nofork]\n", +- argv[0]); +- printf("Key codes can be found in " +- "/usr/src/linux/include/linux/input.h,\n" +- "or by using `showkey` in console.\n" +- "Use decimal values. BTN_LEFT(272) is usable as " +- "B2_KEY or B3_KEY.\n\n"); +- printf("Default uinput device: " DEFAULT_UINPUT ".\n"); +- printf("Default keys:\n" +- "\tMiddle click : F10 (0 68)\n" +- "\tRight click : F11 (0 87)\n" +- "\tScroll mod. : Alt (56)\n" +- "\tDefault blocking time while typing: 300ms\n"); +- +- exit(0); ++ usage(stdout, argv); + } else { +- for (i = 1; i < argc; i++) { +- int j = i+1; ++ i = 1; ++ while (i < argc) { + if (!strcmp(argv[i], "-middle")) { +- if (argc > j+1) { +- b2_mod = atoi(argv[j]); +- b2_key = atoi(argv[j+1]); ++ if (argc > i+2) { ++ b2_mod = atoi(argv[i+1]); ++ b2_key = atoi(argv[i+2]); ++ i += 3; + } else +- goto err; ++ usage(stderr, argv); + continue; + } +- if (!strcmp(argv[i], "-right")) { +- if (argc > j+1) { +- b3_mod = atoi(argv[j]); +- b3_key = atoi(argv[j+1]); ++ else if (!strcmp(argv[i], "-right")) { ++ if (argc > i+2) { ++ b3_mod = atoi(argv[i+1]); ++ b3_key = atoi(argv[i+2]); ++ i += 3; + } else +- goto err; ++ usage(stderr, argv); + continue; + } +- if (!strcmp(argv[i], "-scroll")) { +- if (argc > j) { +- scroll_mod = atoi(argv[j]); ++ else if (!strcmp(argv[i], "-scroll")) { ++ if (argc > i+1) { ++ scroll_mod = atoi(argv[i+1]); ++ i += 2; + } else +- goto err; ++ usage(stderr, argv); + continue; + } +- if (!strcmp(argv[i], "-typing-block")) { +- if (argc > j) { +- typing_block_delay = atoi(argv[j]); ++ else if (!strcmp(argv[i], "-typing-block")) { ++ if (argc > i+1) { ++ typing_block_delay = atoi(argv[i+1]); ++ i += 2; + } else +- goto err; ++ usage(stderr, argv); + continue; + } +- if (!strcmp(argv[i], "-device")) { +- if (argc > j) { +- uinputdev = argv[j]; ++ else if (!strcmp(argv[i], "-device")) { ++ if (argc > i+1) { ++ uinputdev = argv[i+1]; ++ i += 2; + } else +- goto err; ++ usage(stderr, argv); + continue; + } +- if (!strcmp(argv[i], "-nofork")) { ++ else if (!strcmp(argv[i], "-nofork")) { + nofork=1; ++ i += 1; + continue; +- } ++ } else { ++ usage(stderr, argv); ++ } + } + } + } --- mouseemu-0.16.orig/debian/patches/11_mod-passthrough.dpatch +++ mouseemu-0.16/debian/patches/11_mod-passthrough.dpatch @@ -0,0 +1,19 @@ +#! /bin/sh /usr/share/dpatch/dpatch-run +## 11_mod-passthrough.dpatch by +## +## All lines beginning with `## DP:' are a description of the patch. +## DP: Pass through key events of modifier keys + +@DPATCH@ + +--- mouseemu/mouseemu.c 2005-03-30 08:40:30.000000000 +0200 ++++ mouseemu-0.15/mouseemu.c 2005-04-21 00:37:23.836387521 +0200 +@@ -174,7 +174,7 @@ + /* I think its best not to pass scroll, or experiment with not passing the release if + * we actually used it for scrolling (but some apps may get stuck?) + */ +- if (inp.code != b2_key && inp.code != b3_key && !b2_mod_pressed && !b3_mod_pressed) { ++ if (inp.code != b2_key && inp.code != b3_key) { + passthrough(ui_keyb_fd, inp); + } + } --- mouseemu-0.16.orig/debian/patches/bustype_virtual.dpatch +++ mouseemu-0.16/debian/patches/bustype_virtual.dpatch @@ -0,0 +1,38 @@ +#! /bin/sh /usr/share/dpatch/dpatch-run +## bustype_virtual.dpatch by Colin Watson +## +## All lines beginning with `## DP:' are a description of the patch. +## DP: No description. + +@DPATCH@ +diff -urNad mouseemu-0.15~/mouseemu.c mouseemu-0.15/mouseemu.c +--- mouseemu-0.15~/mouseemu.c 2006-12-08 05:59:49.000000000 +0000 ++++ mouseemu-0.15/mouseemu.c 2006-12-08 06:06:03.000000000 +0000 +@@ -30,6 +30,9 @@ + #include + #include + #include ++#ifndef BUS_VIRTUAL /* new in Linux 2.6.19 */ ++#define BUS_VIRTUAL 0x06 ++#endif + #include + #include "mouseemu.h" + #include "defkeys.h" +@@ -431,7 +434,7 @@ + + strcpy(device.name, "Mouseemu virtual keyboard"); + +- device.id.bustype = 0; ++ device.id.bustype = BUS_VIRTUAL; + device.id.vendor = 0x1F; + device.id.product = 0x1F; + device.id.version = 0; +@@ -473,7 +476,7 @@ + + strcpy(device.name, "Mouseemu virtual mouse"); + +- device.id.bustype = 0; ++ device.id.bustype = BUS_VIRTUAL; + device.id.vendor = 0x1F; + device.id.product = 0x1E; + device.id.version = 0; --- mouseemu-0.16.orig/debian/patches/00list +++ mouseemu-0.16/debian/patches/00list @@ -0,0 +1,10 @@ +41_defaults.dpatch +61_rescan.dpatch +63_pidfile.dpatch +99_ubuntu_defaults.dpatch +uinput_error_msg.dpatch +initialize_device.dpatch +write_error.dpatch +bustype_virtual.dpatch +dual_devices.dpatch +more_mouse_buttons.dpatch --- mouseemu-0.16.orig/debian/patches/uinput_error_msg.dpatch +++ mouseemu-0.16/debian/patches/uinput_error_msg.dpatch @@ -0,0 +1,21 @@ +#! /bin/sh /usr/share/dpatch/dpatch-run +## uinput_error_msg.dpatch by +## +## All lines beginning with `## DP:' are a description of the patch. +## DP: send error message to stderr if no uinput device is found + +@DPATCH@ +diff -urNad mouseemu-0.15~/mouseemu.c mouseemu-0.15/mouseemu.c +--- mouseemu-0.15~/mouseemu.c 2006-10-05 00:49:46.000000000 +0200 ++++ mouseemu-0.15/mouseemu.c 2006-10-05 00:57:30.000000000 +0200 +@@ -779,8 +779,8 @@ + + running = uinput_setup(); + if (running < 0) { +- syslog(LOG_NOTICE, "Make sure uinput module is loaded or available " +- "in the kernel.\n"); ++ fprintf(stderr, "No uinput device found! Make sure the uinput module is loaded\n" ++ "or CONFIG_INPUT_UINPUT is compiled into the kernel.\n"); + } + + --- mouseemu-0.16.orig/debian/patches/syslog.dpatch +++ mouseemu-0.16/debian/patches/syslog.dpatch @@ -0,0 +1,223 @@ +#! /bin/sh /usr/share/dpatch/dpatch-run +## syslog.dpatch by Michael Schmitz +## +## All lines beginning with `## DP:' are a description of the patch. +## DP: log to syslog instead of stderr + +@DPATCH@ +diff -urNad mouseemu-0.15~/mouseemu.8 mouseemu-0.15/mouseemu.8 +--- mouseemu-0.15~/mouseemu.8 2006-10-05 00:44:05.000000000 +0200 ++++ mouseemu-0.15/mouseemu.8 2006-10-05 00:45:16.000000000 +0200 +@@ -56,6 +56,9 @@ + Automatically scan every 5s for new devices. This is normally not need, as udev should + inform mouseemu about new devices. + .TP ++.B -debug ++print debugging messages about device scans ++.TP + .B -help + show usage message + .PP +diff -urNad mouseemu-0.15~/mouseemu.c mouseemu-0.15/mouseemu.c +--- mouseemu-0.15~/mouseemu.c 2006-10-05 00:44:05.000000000 +0200 ++++ mouseemu-0.15/mouseemu.c 2006-10-05 00:45:11.000000000 +0200 +@@ -18,12 +18,14 @@ + + #include + #include ++#include + #include + #include + #include + #include + #include + #include ++#include + #include + #include + #include +@@ -57,6 +59,17 @@ + static int debug = 0; + static int autorescan = 0; + ++/* print debug messages to syslog or stderr */ ++void debugf(const char *format, ...) { ++ va_list ap; ++ ++ if (debug) { ++ va_start(ap, format); ++ vsyslog(LOG_DEBUG, format, ap); ++ va_end(ap); ++ } ++} ++ + static void send_event(int fd, int type, int code, int value) + { + struct input_event event; +@@ -234,7 +247,7 @@ + unregister_inputhandler(eventdevs[m].handle); + close(eventdevs[m].handle); + } +- if (debug) fprintf(stderr, "keyboard: fd %d event%d, vendor %4x product %4x\n", fd, n, id[ID_VENDOR], id[ID_PRODUCT]); ++ debugf("keyboard: fd %d event%d, vendor %4x product %4x\n", fd, n, id[ID_VENDOR], id[ID_PRODUCT]); + eventdevs[m].handle= fd; + eventdevs[m].product = id[ID_PRODUCT]; + eventdevs[m].vendor = id[ID_VENDOR]; +@@ -254,7 +267,7 @@ + unregister_inputhandler(eventdevs[m].handle); + close(eventdevs[m].handle); + } +- if (debug) fprintf(stderr, "mouse : fd %d event%d, vendor %4x product %4x\n", fd, n, id[ID_VENDOR], id[ID_PRODUCT]); ++ debugf("mouse : fd %d event%d, vendor %4x product %4x\n", fd, n, id[ID_VENDOR], id[ID_PRODUCT]); + eventdevs[m].handle= fd; + eventdevs[m].product = id[ID_PRODUCT]; + eventdevs[m].vendor = id[ID_VENDOR]; +@@ -366,27 +379,27 @@ + { + int fd = -1; + +- printf("Trying to open %s...", uinputdev); ++ syslog(LOG_NOTICE, "Trying to open %s...", uinputdev); + fd = open (uinputdev, O_RDWR); +- printf(" %s.\n", (fd > 0)?"ok":"error"); ++ syslog(LOG_NOTICE, " %s.\n", (fd > 0)?"ok":"error"); + if (fd > 0) + return fd; + +- printf("Trying to open /dev/uinput..."); ++ syslog(LOG_NOTICE, "Trying to open /dev/uinput..."); + fd = open("/dev/uinput", O_RDWR); +- printf(" %s.\n", (fd > 0)?"ok":"error"); ++ syslog(LOG_NOTICE, " %s.\n", (fd > 0)?"ok":"error"); + if (fd > 0) + return fd; + +- printf("Trying to open /dev/input/uinput..."); ++ syslog(LOG_NOTICE, "Trying to open /dev/input/uinput..."); + fd = open("/dev/input/uinput", O_RDWR); +- printf(" %s.\n", (fd > 0)?"ok":"error"); ++ syslog(LOG_NOTICE, " %s.\n", (fd > 0)?"ok":"error"); + if (fd > 0) + return fd; + +- printf("Trying to open /dev/misc/uinput..."); ++ syslog(LOG_NOTICE, "Trying to open /dev/misc/uinput..."); + fd = open("/dev/misc/uinput", O_RDWR); +- printf(" %s.\n", (fd > 0)?"ok":"error"); ++ syslog(LOG_NOTICE, " %s.\n", (fd > 0)?"ok":"error"); + if (fd > 0) + return fd; + +@@ -492,7 +505,7 @@ + { + int i, cfd; + +- printf("mouseemu: cleaning...\n"); ++ syslog(LOG_NOTICE, "mouseemu: cleaning...\n"); + + uinput_close(ui_keyb_fd); + uinput_close(ui_mouse_fd); +@@ -568,7 +581,8 @@ + "\t[-typing-block DELAY]\n" + "\t[-device UINPUT_DEVICE]\n" + "\t[-nofork]\n" +- "\t[-autorescan]\n", ++ "\t[-autorescan]\n" ++ "\t[-debug]\n", + argv[0]); + fprintf(stream, "All modifier and button key arguments are\n" + "key scancodes. They can be found in \n" +@@ -600,8 +614,6 @@ + int nofork = 0; + //int argv0size = strlen(argv[0]); + +- printf("mouseemu " VERSION " (C) Colin Leroy \n"); +- + install_sighandler(); + + uinputdev = DEFAULT_UINPUT; +@@ -663,23 +675,33 @@ + autorescan=1; + i += 1; + continue; ++ } ++ else if (!strcmp(argv[i], "-debug")) { ++ debug=1; ++ i += 1; ++ continue; + } else { + usage(stderr, argv); + } + } + } + } +- printf("using (%d+%d) as middle button, (%d+%d) as right button, (%d) as scroll.\n", ++ ++ if (nofork) ++ openlog("mouseemu", LOG_NDELAY | LOG_PERROR | LOG_PID, LOG_DAEMON); ++ else ++ openlog("mouseemu", LOG_NDELAY | LOG_PID, LOG_DAEMON); ++ ++ syslog(LOG_NOTICE, "mouseemu " VERSION " (C) Colin Leroy \n"); ++ syslog(LOG_NOTICE, "using (%d+%d) as middle button, (%d+%d) as right button, (%d) as scroll.\n", + b2_mod, b2_key, b3_mod, b3_key, scroll_mod); +- printf("using %s.\n", uinputdev); + +- + if (nofork) + goto startops; + + fpid = fork(); + if (fpid == -1) { +- printf("can't fork\n"); ++ syslog(LOG_NOTICE, "can't fork\n"); + goto startops; + } + if (fpid != 0) { +@@ -689,7 +711,7 @@ + setsid(); + pid = fork(); + if (pid == -1) { +- printf("can't fork\n"); ++ syslog(LOG_NOTICE, "can't fork\n"); + goto startops; + } + +@@ -723,7 +745,7 @@ + } + + } +- printf("terminating, %i\n",answer); ++ syslog(LOG_NOTICE, "terminating, %i\n",answer); + if (kill(pid, SIGTERM)<0) + perror("mouseemu: termination of uinput handlers failed\n"); + +@@ -735,8 +757,6 @@ + + //strncpy(argv[0],"mouseemu",argv0size); + startops: +- if (nofork) +- debug = 1; + + for (i=0; i +## +## All lines beginning with `## DP:' are a description of the patch. +## DP: No description. + +@DPATCH@ +diff -urNad mouseemu-0.15~/mouseemu.c mouseemu-0.15/mouseemu.c +--- mouseemu-0.15~/mouseemu.c 2007-02-08 01:59:26.000000000 +0000 ++++ mouseemu-0.15/mouseemu.c 2007-02-08 01:59:44.000000000 +0000 +@@ -187,52 +187,66 @@ + } + } + +-void keyboard_handler (int fd) ++void keyboard_handler (struct input_event inp) + { +- struct input_event inp; +- if (read(fd, &inp, sizeof(inp)) == sizeof(inp)) { +- if (!event_parse(inp.code, inp.value) && !is_modifier(inp)) { +- last_key = (inp.time.tv_sec*1000000 + inp.time.tv_usec); +- } ++ if (inp.type != EV_KEY && inp.type != EV_REP) ++ return; ++ if (inp.type == EV_KEY && (inp.code == BTN_LEFT || inp.code == BTN_MIDDLE || inp.code == BTN_RIGHT)) ++ return; ++ ++ if (!event_parse(inp.code, inp.value) && !is_modifier(inp)) { ++ last_key = (inp.time.tv_sec*1000000 + inp.time.tv_usec); ++ } + /* I think its best not to pass scroll, or experiment with not passing the release if + * we actually used it for scrolling (but some apps may get stuck?) + */ +- if (inp.code != b2_key && inp.code != b3_key) { +- passthrough(ui_keyb_fd, inp); +- } ++ if (inp.code != b2_key && inp.code != b3_key) { ++ passthrough(ui_keyb_fd, inp); + } + } + +-static void mouse_handler (int fd) ++static void mouse_handler (struct input_event inp) ++{ ++ if (inp.type != EV_KEY && inp.type != EV_REL && inp.type != EV_SYN) ++ return; ++ if (inp.type == EV_KEY && inp.code != BTN_LEFT && inp.code != BTN_MIDDLE && inp.code != BTN_RIGHT) ++ return; ++ ++ if (inp.type == EV_KEY && inp.code == BTN_LEFT) { ++ if (b2_key == BTN_LEFT && b2_mod_pressed) ++ report_click(BTN_MIDDLE, inp.value); ++ else if (b3_key == BTN_LEFT && b3_mod_pressed) ++ report_click(BTN_RIGHT, inp.value); ++ else ++ passthrough(ui_mouse_fd, inp); ++ } ++ else if (scroll_mod_pressed ++ && inp.type == EV_REL ++ && (inp.code == REL_Y || inp.code == REL_X)) { ++ report_scroll (inp.value); ++ //printf("inp.value %d\n", inp.value); ++ } else { ++ if ((inp.time.tv_sec*1000000+inp.time.tv_usec)-last_key > typing_block_delay*1000 ++ || inp.type == EV_REL) ++ passthrough(ui_mouse_fd, inp); ++ } ++} ++ ++static void event_handler (int mode, int fd) + { +- int count; + struct input_event inp; + +- if ((count = read(fd, &inp, sizeof(inp))) == sizeof(inp)) { +- if (inp.type == EV_KEY && inp.code == BTN_LEFT) { +- if (b2_key == BTN_LEFT && b2_mod_pressed) +- report_click(BTN_MIDDLE, inp.value); +- else if (b3_key == BTN_LEFT && b3_mod_pressed) +- report_click(BTN_RIGHT, inp.value); +- else +- passthrough(ui_mouse_fd, inp); +- } +- else if (scroll_mod_pressed +- && inp.type == EV_REL +- && (inp.code == REL_Y || inp.code == REL_X)) { +- report_scroll (inp.value); +- //printf("inp.value %d\n", inp.value); +- } else { +- if ((inp.time.tv_sec*1000000+inp.time.tv_usec)-last_key > typing_block_delay*1000 +- || inp.type == EV_REL) +- passthrough(ui_mouse_fd, inp); +- } ++ if (read(fd, &inp, sizeof(inp)) == sizeof(inp)) { ++ if (mode & HANDLER_KEYBOARD) ++ keyboard_handler(inp); ++ if (mode & HANDLER_MOUSE) ++ mouse_handler(inp); + } + } + + void scan_for_devs() + { +- int n, m, fd; ++ int n, m, fd, mode; + char filename[20]; + unsigned long bit[NBITS(EV_MAX)]; + unsigned short id[EVENT_DEVS]; +@@ -240,47 +254,47 @@ + for (n = 0, m = 0; n < EVENT_DEVS; n++) { + sprintf(filename, "/dev/input/event%d", n); + if ((fd = open(filename, O_RDONLY)) >= 0) { ++ mode = 0; + ioctl(fd, EVIOCGBIT(0, EV_MAX), bit); ++ ioctl(fd, EVIOCGID, id); + if (test_bit(EV_KEY, bit) && test_bit(EV_REP, bit)) { +- ioctl(fd, EVIOCGID, id); + /* our own virtual keyboard (on rescans)*/ + if (id[ID_PRODUCT] == 0x1F && id[ID_VENDOR] == 0x1F) { + close(fd); + continue; + } ++ mode |= HANDLER_KEYBOARD; + if (id[ID_PRODUCT] != eventdevs[m].product || + id[ID_VENDOR] != eventdevs[m].vendor) { +- if (eventdevs[m].handle >= 0) { +- unregister_inputhandler(eventdevs[m].handle); +- close(eventdevs[m].handle); +- } + debugf("keyboard: fd %d event%d, vendor %4x product %4x\n", fd, n, id[ID_VENDOR], id[ID_PRODUCT]); +- eventdevs[m].handle= fd; +- eventdevs[m].product = id[ID_PRODUCT]; +- eventdevs[m].vendor = id[ID_VENDOR]; +- register_inputhandler(fd, keyboard_handler, 1); + } +- m++; +- } else if (test_bit(EV_REL, bit)) { +- ioctl(fd, EVIOCGID, id); ++ } ++ if (test_bit(EV_REL, bit)) { + /* our own virtual mouse (on rescans)*/ + if (id[ID_PRODUCT] == 0x1E && id[ID_VENDOR] == 0x1F) { + close(fd); + continue; + } ++ mode |= HANDLER_MOUSE; ++ if (id[ID_PRODUCT] != eventdevs[m].product || ++ id[ID_VENDOR] != eventdevs[m].vendor) { ++ debugf("mouse : fd %d event%d, vendor %4x product %4x\n", fd, n, id[ID_VENDOR], id[ID_PRODUCT]); ++ } ++ } ++ if (mode) { + if (id[ID_PRODUCT] != eventdevs[m].product || + id[ID_VENDOR] != eventdevs[m].vendor) { + if (eventdevs[m].handle >= 0) { + unregister_inputhandler(eventdevs[m].handle); + close(eventdevs[m].handle); + } +- debugf("mouse : fd %d event%d, vendor %4x product %4x\n", fd, n, id[ID_VENDOR], id[ID_PRODUCT]); + eventdevs[m].handle= fd; + eventdevs[m].product = id[ID_PRODUCT]; + eventdevs[m].vendor = id[ID_VENDOR]; +- register_inputhandler(fd, mouse_handler, 1); +- } +- m++; ++ register_inputhandler(mode, fd, event_handler, 1); ++ } else ++ close(fd); ++ m++; + } else + close(fd); + } +@@ -310,12 +324,13 @@ + scan_for_devs(); + } + +-int register_inputhandler (int fd, void (*func)(int fd), int grab) ++int register_inputhandler (int mode, int fd, void (*func)(int mode, int fd), int grab) + { + int n; + + for (n=0; n < EVENT_DEVS; n++) + if (ihandler[n].fd == -1) { ++ ihandler[n].mode = mode; + ihandler[n].fd = fd; + ihandler[n].handler = func; + ihandler[n].grab = grab; +@@ -332,6 +347,7 @@ + + for (n = 0; n < EVENT_DEVS; n++) + if (found) { ++ ihandler[n-1].mode = ihandler[n].mode; + ihandler[n-1].fd = ihandler[n].fd; + ihandler[n-1].handler = ihandler[n].handler; + } else if (ihandler[n].fd == fd) { +@@ -364,7 +380,7 @@ + for (n=0; n < EVENT_DEVS; n++) { + if (ihandler[n].fd == -1) continue; + if (FD_ISSET(ihandler[n].fd, inset)) +- ihandler[n].handler (ihandler[n].fd); ++ ihandler[n].handler (ihandler[n].mode, ihandler[n].fd); + } + } + +@@ -809,6 +825,7 @@ + eventdevs[i].product= 0; + + ihandler[i].handler=0; ++ ihandler[i].mode=0; + ihandler[i].fd=-1; + } + +diff -urNad mouseemu-0.15~/mouseemu.h mouseemu-0.15/mouseemu.h +--- mouseemu-0.15~/mouseemu.h 2005-03-30 07:41:00.000000000 +0100 ++++ mouseemu-0.15/mouseemu.h 2007-02-08 01:59:27.000000000 +0000 +@@ -33,6 +33,9 @@ + #define BTN2 0x04 + #define BTN3 0x02 + ++#define HANDLER_KEYBOARD (1 << 0) ++#define HANDLER_MOUSE (1 << 1) ++ + /* device structure */ + typedef struct _kdev { + int handle; +@@ -42,11 +45,12 @@ + + /* handler structure */ + typedef struct _ihandler { +- void (*handler)(int fd); ++ void (*handler)(int mode, int fd); ++ int mode; + int fd; + int grab; + } input_handler; + + void unregister_inputhandler (int fd); +-int register_inputhandler(int fd, void (*func)(int fd), int grab); ++int register_inputhandler(int mode, int fd, void (*func)(int mode, int fd), int grab); + #endif --- mouseemu-0.16.orig/debian/patches/01_nofork.dpatch +++ mouseemu-0.16/debian/patches/01_nofork.dpatch @@ -0,0 +1,19 @@ +#! /bin/sh /usr/share/dpatch/dpatch-run +## 01_nofork.dpatch by +## +## All lines beginning with `## DP:' are a description of the patch. +## DP: Don't kill ourselves if not forking into the background + +@DPATCH@ + +--- mouseemu/mouseemu.c 2005-03-30 08:40:30.000000000 +0200 ++++ mouseemu-0.15/mouseemu.c 2005-04-21 00:37:23.836387521 +0200 +@@ -706,7 +724,7 @@ + } + /* tell the parent we are running without problems */ + /* What should we do if the parent is dead? */ +- if (answer) { ++ if (answer && !nofork) { + answer=0; + kill(getppid(), SIGUSR1); + } --- mouseemu-0.16.orig/debian/patches/41_defaults.dpatch +++ mouseemu-0.16/debian/patches/41_defaults.dpatch @@ -0,0 +1,123 @@ +#! /bin/sh /usr/share/dpatch/dpatch-run +## 41_defaults.dpatch by +## +## All lines beginning with `## DP:' are a description of the patch. +## DP: change defaults to not emaulate mouse buttons for \!powerpc + +@DPATCH@ +diff -urNad mouseemu-0.16~/defkeys.h mouseemu-0.16/defkeys.h +--- mouseemu-0.16~/defkeys.h 2008-10-16 20:50:05.000000000 +0100 ++++ mouseemu-0.16/defkeys.h 2008-10-16 20:50:10.000000000 +0100 +@@ -15,22 +15,11 @@ + #ifndef __DEFKEYS_H__ + #define __DEFKEYS_H__ + +-#ifdef __powerpc__ +- + #define BUTTON2MOD 0 + #define BUTTON2KEY KEY_F10 + #define BUTTON3MOD 0 + #define BUTTON3KEY KEY_F11 + +-#else +- +-#define BUTTON2MOD 0 +-#define BUTTON2KEY 0 +-#define BUTTON3MOD 0 +-#define BUTTON3KEY 0 +- +-#endif +- + #define SCROLLMOD KEY_LEFTALT + + +diff -urNad mouseemu-0.16~/mouseemu.8 mouseemu-0.16/mouseemu.8 +--- mouseemu-0.16~/mouseemu.8 2008-10-16 20:50:05.000000000 +0100 ++++ mouseemu-0.16/mouseemu.8 2008-10-16 20:50:10.000000000 +0100 +@@ -31,11 +31,11 @@ + .TP + .B -middle B2_MOD B2_KEY + Modifier and key for the middle (second) mouse button. Defaults to F10 and no modifier +-on PowerPC and to none on all other architectures. ++on PowerPC and Intel Macs, and to none on all other architectures. + .TP + .B -right B3_MOD B3_KEY + Modifier and key for the right (third) mouse button. Defaults to F11 and no modifier +-on PowerPC and to none on all other architectures. ++on PowerPC and Intel Macs, and to none on all other architectures. + .TP + .B -scroll SCROLL_MOD + Modifier for the scrolling function. Defaults to Alt. +diff -urNad mouseemu-0.16~/mouseemu.c mouseemu-0.16/mouseemu.c +--- mouseemu-0.16~/mouseemu.c 2008-10-16 20:50:05.000000000 +0100 ++++ mouseemu-0.16/mouseemu.c 2008-10-16 20:55:49.000000000 +0100 +@@ -27,11 +27,15 @@ + #include + #include + #include ++#include ++#include + #include + #include + #include "mouseemu.h" + #include "defkeys.h" + ++static int use_defaults = 0; ++ + static int b2_mod = BUTTON2MOD; + static int b2_key = BUTTON2KEY; + +@@ -591,15 +595,16 @@ + "Use decimal values. BTN_LEFT(272) is usable as " + "B2_KEY or B3_KEY.\n\n"); + fprintf(stream, "Default uinput device: " DEFAULT_UINPUT ".\n"); +- fprintf(stream, "Default keys:\n" +-#ifdef __powerpc__ ++ fprintf(stream, "Default keys:\n"); ++ if (use_defaults) ++ fprintf(stream, + "\tMiddle click : F10 (0 68)\n" +- "\tRight click : F11 (0 87)\n" +-#else ++ "\tRight click : F11 (0 87)\n"); ++ else ++ fprintf(stream, + "\tMiddle click : none (0 0)\n" +- "\tRight click : none (0 0)\n" +-#endif +- "\tScroll mod. : Alt (56)\n" ++ "\tRight click : none (0 0)\n"); ++ fprintf(stream, "\tScroll mod. : Alt (56)\n" + "\tDefault blocking time while typing: 300ms\n"); + + exit(0); +@@ -616,6 +621,29 @@ + + install_sighandler(); + ++#ifdef __powerpc__ ++ use_defaults = 1; ++#else ++#if defined(__i386__) || defined(__amd64__) ++ { ++ FILE *dmidecode; ++ char line[1024]; ++ dmidecode = popen("dmidecode -s system-manufacturer 2>/dev/null", "r"); ++ if (dmidecode) { ++ if (fgets(line, 1024, dmidecode) && !strncmp(line, "Apple", 5)) ++ use_defaults = 1; ++ pclose(dmidecode); ++ } ++ } ++#endif ++#endif ++ if (!use_defaults) { ++ b2_mod = 0; ++ b2_key = 0; ++ b3_mod = 0; ++ b3_key = 0; ++ } ++ + uinputdev = DEFAULT_UINPUT; + if (argc > 1) { + int i = 0; --- mouseemu-0.16.orig/debian/patches/51_manpage.dpatch +++ mouseemu-0.16/debian/patches/51_manpage.dpatch @@ -0,0 +1,60 @@ +#! /bin/sh /usr/share/dpatch/dpatch-run +## 51_manpage.dpatch by +## +## All lines beginning with `## DP:' are a description of the patch. +## DP: add default values and information about keycodes to manpage + +@DPATCH@ +diff -urNad mouseemu-0.15~/mouseemu.8 mouseemu-0.15/mouseemu.8 +--- mouseemu-0.15~/mouseemu.8 2005-03-30 08:46:20.000000000 +0200 ++++ mouseemu-0.15/mouseemu.8 2007-04-29 18:07:38.000000000 +0200 +@@ -30,22 +30,45 @@ + .SH OPTIONS + .TP + .B -middle B2_MOD B2_KEY +-modifier and key for the middle (second) mouse button ++Modifier and key for the middle (second) mouse button. Defaults to F10 and no modifier ++on PowerPC and Intel Macs, and to none on all other architectures. + .TP + .B -right B3_MOD B3_KEY +-modifier and key for the right (third) mouse button ++Modifier and key for the right (third) mouse button. Defaults to F11 and no modifier ++on PowerPC and Intel Macs, and to none on all other architectures. + .TP + .B -scroll SCROLL_MOD +-modifier for the scrolling function ++Modifier for the scrolling function. Defaults to Alt. + .TP + .B -typing-block DELAY + Time in milliseconds for which the trackpad will be blocked while typing on the keyboard. ++Defaults to 300ms. + .TP + .B -device UINPUT +-device node for the uinput device ++Device node for the uinput device. Defaults to /dev/uinput. If this device is not read and ++writeable the following devices are also tried: /dev/uinput, /dev/input/uinput and ++/dev/misc/uinput. + .TP + .B -nofork + don't run in the background ++.TP ++.B -help ++show usage message ++.PP ++The key codes for the buttons and modifiers are key scancodes. They can be found in ++include/linux/input.h in the kernel headers or by using `showkey` in a console. The ++keycodes must be given as decimal values (`showkey` displays hex values!). ++ ++.SH EXAMPLES ++.PP ++To have the same behaviour as in MacOS X (CTRL-click for right mouse button and no ++emulation for the middle button): ++.PP ++.RS 4 ++.B mouseemu -middle 0 0 -right 29 272 ++.RE ++.PP ++The code for the (left) mouse button is 272 (0x110 in hex). The code for CTRL is 29. + + .SH AUTHOR + Mouseemu was written by Colin Leroy --- mouseemu-0.16.orig/debian/patches/21_makefile.dpatch +++ mouseemu-0.16/debian/patches/21_makefile.dpatch @@ -0,0 +1,16 @@ +#! /bin/sh /usr/share/dpatch/dpatch-run +## 21_makefile.dpatch by +## +## All lines beginning with `## DP:' are a description of the patch. +## DP: install manpage to /usr/share/man + +@DPATCH@ + +--- mouseemu/Makefile 2005-03-30 08:48:19.000000000 +0200 ++++ mouseemu-0.15/Makefile 2005-03-30 23:52:17.000000000 +0200 +@@ -4,4 +4,4 @@ + rm -f *.o core* mouseemu + install: + cp -f mouseemu $(DESTDIR)/usr/sbin/ +- cp -f mouseemu.8 $(DESTDIR)/usr/man/man8 ++ cp -f mouseemu.8 $(DESTDIR)/usr/share/man/man8 --- mouseemu-0.16.orig/debian/patches/63_pidfile.dpatch +++ mouseemu-0.16/debian/patches/63_pidfile.dpatch @@ -0,0 +1,21 @@ +#! /bin/sh /usr/share/dpatch/dpatch-run +## 63_pidfile.dpatch by Colin Watson +## +## All lines beginning with `## DP:' are a description of the patch. +## DP: Exit gracefully if pidfile creation fails. + +@DPATCH@ +diff -urNad mouseemu-0.16~/mouseemu.c mouseemu-0.16/mouseemu.c +--- mouseemu-0.16~/mouseemu.c 2008-10-16 21:27:29.000000000 +0100 ++++ mouseemu-0.16/mouseemu.c 2008-10-16 21:27:54.000000000 +0100 +@@ -765,6 +765,10 @@ + + /* write PID file so the user can signal us for device rescans */ + pidfile = fopen("/var/run/mouseemu.pid", "w"); ++ if (!pidfile) { ++ perror("mouseemu: can't open /var/run/mouseemu.pid"); ++ exit(1); ++ } + fprintf(pidfile, "%d\n", pid); + fclose(pidfile); + --- mouseemu-0.16.orig/debian/patches/99_ubuntu_defaults.dpatch +++ mouseemu-0.16/debian/patches/99_ubuntu_defaults.dpatch @@ -0,0 +1,67 @@ +#! /bin/sh /usr/share/dpatch/dpatch-run +## 99_ubuntu_defaults.dpatch by Colin Watson +## +## All lines beginning with `## DP:' are a description of the patch. +## DP: Adjust default keys and modifiers for desired Ubuntu defaults. + +@DPATCH@ +diff -urNad mouseemu-0.16~/defkeys.h mouseemu-0.16/defkeys.h +--- mouseemu-0.16~/defkeys.h 2008-10-16 20:55:55.000000000 +0100 ++++ mouseemu-0.16/defkeys.h 2008-10-16 20:55:55.000000000 +0100 +@@ -16,11 +16,11 @@ + #define __DEFKEYS_H__ + + #define BUTTON2MOD 0 +-#define BUTTON2KEY KEY_F10 ++#define BUTTON2KEY KEY_F11 + #define BUTTON3MOD 0 +-#define BUTTON3KEY KEY_F11 ++#define BUTTON3KEY KEY_F12 + +-#define SCROLLMOD KEY_LEFTALT ++#define SCROLLMOD 0 + + + #endif +diff -urNad mouseemu-0.16~/mouseemu.8 mouseemu-0.16/mouseemu.8 +--- mouseemu-0.16~/mouseemu.8 2008-10-16 20:55:55.000000000 +0100 ++++ mouseemu-0.16/mouseemu.8 2008-10-16 20:55:55.000000000 +0100 +@@ -30,15 +30,15 @@ + .SH OPTIONS + .TP + .B -middle B2_MOD B2_KEY +-Modifier and key for the middle (second) mouse button. Defaults to F10 and no modifier ++Modifier and key for the middle (second) mouse button. Defaults to F11 and no modifier + on PowerPC and Intel Macs, and to none on all other architectures. + .TP + .B -right B3_MOD B3_KEY +-Modifier and key for the right (third) mouse button. Defaults to F11 and no modifier ++Modifier and key for the right (third) mouse button. Defaults to F12 and no modifier + on PowerPC and Intel Macs, and to none on all other architectures. + .TP + .B -scroll SCROLL_MOD +-Modifier for the scrolling function. Defaults to Alt. ++Modifier for the scrolling function. Defaults to none. + .TP + .B -typing-block DELAY + Time in milliseconds for which the trackpad will be blocked while typing on the keyboard. +diff -urNad mouseemu-0.16~/mouseemu.c mouseemu-0.16/mouseemu.c +--- mouseemu-0.16~/mouseemu.c 2008-10-16 20:55:55.000000000 +0100 ++++ mouseemu-0.16/mouseemu.c 2008-10-16 20:56:30.000000000 +0100 +@@ -598,13 +598,13 @@ + fprintf(stream, "Default keys:\n"); + if (use_defaults) + fprintf(stream, +- "\tMiddle click : F10 (0 68)\n" +- "\tRight click : F11 (0 87)\n"); ++ "\tMiddle click : F11 (0 87)\n" ++ "\tRight click : F12 (0 88)\n"); + else + fprintf(stream, + "\tMiddle click : none (0 0)\n" + "\tRight click : none (0 0)\n"); +- fprintf(stream, "\tScroll mod. : Alt (56)\n" ++ fprintf(stream, "\tScroll mod. : none (0)\n" + "\tDefault blocking time while typing: 300ms\n"); + + exit(0); --- mouseemu-0.16.orig/debian/patches/more_mouse_buttons.dpatch +++ mouseemu-0.16/debian/patches/more_mouse_buttons.dpatch @@ -0,0 +1,158 @@ +#! /bin/sh /usr/share/dpatch/dpatch-run +## more_mouse_buttons.dpatch by Colin Watson +## +## All lines beginning with `## DP:' are a description of the patch. +## DP: Pass through any additional mouse buttons supported by real mouse +## DP: devices on the system. + +@DPATCH@ +diff -urNad mouseemu-0.16~/mouseemu.c mouseemu-0.16/mouseemu.c +--- mouseemu-0.16~/mouseemu.c 2009-08-27 20:18:25.000000000 +0100 ++++ mouseemu-0.16/mouseemu.c 2009-08-27 20:22:25.000000000 +0100 +@@ -209,7 +209,7 @@ + { + if (inp.type != EV_KEY && inp.type != EV_REL && inp.type != EV_SYN) + return; +- if (inp.type == EV_KEY && inp.code != BTN_LEFT && inp.code != BTN_MIDDLE && inp.code != BTN_RIGHT) ++ if (inp.type == EV_KEY && (inp.code < BTN_MISC || inp.code >= KEY_OK)) + return; + + if (inp.type == EV_KEY && inp.code == BTN_LEFT) { +@@ -227,7 +227,8 @@ + //printf("inp.value %d\n", inp.value); + } else { + if ((inp.time.tv_sec*1000000+inp.time.tv_usec)-last_key > typing_block_delay*1000 +- || inp.type == EV_REL) ++ || inp.type == EV_REL ++ || (inp.type == EV_KEY && inp.code != BTN_MIDDLE && inp.code != BTN_RIGHT)) + passthrough(ui_mouse_fd, inp); + } + } +@@ -254,8 +255,11 @@ + for (n = 0, m = 0; n < EVENT_DEVS; n++) { + sprintf(filename, "/dev/input/event%d", n); + if ((fd = open(filename, O_RDONLY)) >= 0) { ++ unsigned long mousebtns[NBITS(KEY_MAX)], mouserels[NBITS(REL_MAX)]; ++ memset(mousebtns, 0, sizeof(mousebtns)); ++ memset(mouserels, 0, sizeof(mouserels)); + mode = 0; +- ioctl(fd, EVIOCGBIT(0, EV_MAX), bit); ++ ioctl(fd, EVIOCGBIT(0, sizeof(bit)), bit); + ioctl(fd, EVIOCGID, id); + if (test_bit(EV_KEY, bit) && test_bit(EV_REP, bit)) { + /* our own virtual keyboard (on rescans)*/ +@@ -270,6 +274,7 @@ + } + } + if (test_bit(EV_REL, bit)) { ++ int i; + /* our own virtual mouse (on rescans)*/ + if (id[ID_PRODUCT] == 0x1E && id[ID_VENDOR] == 0x1F) { + close(fd); +@@ -280,6 +285,16 @@ + id[ID_VENDOR] != eventdevs[m].vendor) { + debugf("mouse : fd %d event%d, vendor %4x product %4x\n", fd, n, id[ID_VENDOR], id[ID_PRODUCT]); + } ++ ioctl(fd, EVIOCGBIT(EV_KEY, sizeof(mousebtns)), mousebtns); ++ debugf("mouse : buttons:\n"); ++ for (i = BTN_MISC; i < KEY_OK; ++i) ++ if (((unsigned char *)mousebtns)[i / 8] & (1 << (i % 8))) ++ debugf(" 0x%x\n", i); ++ ioctl(fd, EVIOCGBIT(EV_REL, sizeof(mouserels)), mouserels); ++ debugf("mouse : relative events:\n"); ++ for (i = REL_X; i <= REL_MAX; ++i) ++ if (((unsigned char *)mouserels)[i / 8] & (1 << (i % 8))) ++ debugf(" 0x%x\n", i); + } + if (mode) { + if (id[ID_PRODUCT] != eventdevs[m].product || +@@ -291,6 +306,8 @@ + eventdevs[m].handle= fd; + eventdevs[m].product = id[ID_PRODUCT]; + eventdevs[m].vendor = id[ID_VENDOR]; ++ memcpy(eventdevs[m].mousebtns, mousebtns, sizeof(mousebtns)); ++ memcpy(eventdevs[m].mouserels, mouserels, sizeof(mouserels)); + register_inputhandler(mode, fd, event_handler, 1); + } else + close(fd); +@@ -303,6 +320,8 @@ + eventdevs[m].product = 0; + eventdevs[m].vendor = 0; + eventdevs[m].handle = -1; ++ memset(eventdevs[m].mousebtns, 0, sizeof(eventdevs[m].mousebtns)); ++ memset(eventdevs[m].mouserels, 0, sizeof(eventdevs[m].mouserels)); + } + } + +@@ -322,6 +341,8 @@ + eventdevs[i].product = 0; + eventdevs[i].vendor = 0; + eventdevs[i].handle = -1; ++ memset(eventdevs[i].mousebtns, 0, sizeof(eventdevs[i].mousebtns)); ++ memset(eventdevs[i].mouserels, 0, sizeof(eventdevs[i].mouserels)); + } + usleep(100); + scan_for_devs(); +@@ -435,7 +456,7 @@ + int uinput_setup(void) + { + struct uinput_user_dev device; +- int i; ++ int i, j; + + memset(&device, 0, sizeof(struct uinput_user_dev)); + /*setup keyboard device */ +@@ -518,10 +539,32 @@ + ioctl(ui_mouse_fd, UI_SET_RELBIT, REL_X); + ioctl(ui_mouse_fd, UI_SET_RELBIT, REL_Y); + ioctl(ui_mouse_fd, UI_SET_RELBIT, REL_WHEEL); ++ for (i = REL_X; i <= REL_MAX; ++i) { ++ if (i == REL_X || i == REL_Y || i == REL_WHEEL) ++ continue; ++ for (j = 0; j < EVENT_DEVS; ++j) { ++ if (((unsigned char *)eventdevs[j].mouserels)[i / 8] & (1 << (i % 8))) { ++ debugf("Enabling additional relative event 0x%x\n", i); ++ ioctl(ui_mouse_fd, UI_SET_RELBIT, i); ++ break; ++ } ++ } ++ } + + ioctl(ui_mouse_fd, UI_SET_KEYBIT, BTN_LEFT); + ioctl(ui_mouse_fd, UI_SET_KEYBIT, BTN_RIGHT); + ioctl(ui_mouse_fd, UI_SET_KEYBIT, BTN_MIDDLE); ++ for (i = BTN_MISC; i < KEY_OK; ++i) { ++ if (i == BTN_LEFT || i == BTN_RIGHT || i == BTN_MIDDLE) ++ continue; ++ for (j = 0; j < EVENT_DEVS; ++j) { ++ if (((unsigned char *)eventdevs[j].mousebtns)[i / 8] & (1 << (i % 8))) { ++ debugf("Enabling additional button 0x%x\n", i); ++ ioctl(ui_mouse_fd, UI_SET_KEYBIT, i); ++ break; ++ } ++ } ++ } + + ioctl(ui_mouse_fd, UI_DEV_CREATE, NULL); + +@@ -830,6 +873,8 @@ + eventdevs[i].handle = -1; + eventdevs[i].vendor = 0; + eventdevs[i].product= 0; ++ memset(eventdevs[i].mousebtns, 0, sizeof(eventdevs[i].mousebtns)); ++ memset(eventdevs[i].mouserels, 0, sizeof(eventdevs[i].mouserels)); + + ihandler[i].handler=0; + ihandler[i].mode=0; +diff -urNad mouseemu-0.16~/mouseemu.h mouseemu-0.16/mouseemu.h +--- mouseemu-0.16~/mouseemu.h 2009-08-27 20:18:25.000000000 +0100 ++++ mouseemu-0.16/mouseemu.h 2009-08-27 20:18:25.000000000 +0100 +@@ -41,6 +41,8 @@ + int handle; + unsigned short vendor; + unsigned short product; ++ unsigned long mousebtns[NBITS(KEY_MAX)]; ++ unsigned long mouserels[NBITS(REL_MAX)]; + } kdev; + + /* handler structure */