#!/bin/sh killall evrouter mouse_poll rm /tmp/.evrouter\:0.0 for devfile in /dev/input/event*; do sudo /bin/chmod a+r $devfile done device="/dev/input/`awk '/^H.*mouse/ {print $NF}' </proc/bus/input/devices`" if [ "$device" != /dev/input/ ] ; then echo "Device found: $device" else echo "No device found! Aborting." exit 1 fi cat >~/.evrouterrc_auto < ~/.evrouterrc sed "s/dev/$device/" >~/.evrouterrc_auto << E_O_F Window "" "" "dev" any key/272 "XButton/1" "" "dev" any key/273 "XButton/3" "" "dev" any key/274 "XButton/2" "" "dev" any rel/8/1 "XKey/Up" "" "dev" any rel/8/-1 "XKey/Down" E_O_F mouse_poll $device& evrouter -c ~/.evrouterrc_auto /dev/input/event*& while [ "x`grep '^H.*mouse' /proc/bus/input/devices`" != x ]; do sleep 5 done killall evrouter mouse_poll