#!/bin/sh
alias comment=true
MICE=$*
P=7777
M=999
if [ ${#MICE} -eq 0 ]
then
# this can be customized here, that may be easier than the mega command line
# you would get otherwise. The usage of file 2 in the event osc call is set
# for it to optionally be a touchpad, just put a touchpad device on that line,
# or as the second arg to this program
set /dev/input/by-id/usb-Logitech_USB_Trackball-event-mouse \
    `comment uncomment the next line, and comment the line after, for touchpad` \
    `comment /dev/input/by-path/platform-i8042-serio-1-event-mouse` \
    /dev/input/by-id/usb-Microsoft_Microsoft_IntelliMouse_Explorer-event-mouse \
    /dev/input/by-path/platform-i8042-serio-0-event-kbd \
    /dev/input/by-path/platform-i8042-serio-2-event-mouse \
    /dev/input/by-id/usb-04d9_048e-event-mouse \
    /dev/input/by-id/usb-Contour_Design_Contour_MiniPro_800-event-mouse
fi
exec event-osc \
    $(if [ $1 ]; then echo -file $1 -port $P \
    -dest /offset -y -max ${M} \
    -dest /modspeed -x -max ${M} \
    -dest /oscmute -b left \
    -dest /noisemute -b right \
    -dest /mute -b side; fi) \
    $(if [ $2 ]; then echo -file $2 -port $P \
    -dest /moddepth/touchpad \
    -t 3 -c 0 `comment the magic numbers for touchpad absolute mode` \
    -dest /moddepth/mouse -x -max ${M} \
    -dest /vibrato/touchpad -t 3 -c 1 \
    -dest /vibrato/mouse -y -max ${M} \
    -dest /vibstate -b left; fi) \
    $(if [ $3 ]; then echo -file $3 -port $P \
    -dest /randomize -k all; fi) \
    $(if [ $4 ]; then echo -file $4 -port $P \
    -file -port 7777 \
    -dest /fmdb -y -max ${M}; fi) \
    $(if [ $5 ]; then echo -file $5 -port $P \
    -dest /noisehz -y -max ${M} \
    -dest /noisehz2 -x -max ${M} \
    -dest /noisemute -b left; fi) \
    $(if [ $6 ]; then echo -file $6 -port $P \
    -dest /noisedb -y -max ${M}9 `comment this mouse is particularly sensitive` \
    -dest /noiseband -x -max ${M}9 \
    -dest /offset -w -max ${M}; fi)
