Comment 36 for bug 418470

Revision history for this message
zzarko (zzarko-gmail) wrote :

I also had a problem with gamepad automatically emulating a mouse. I tried using the method with numbers described above, but the numbers were changing after reboot. As a solution, here is the script I use to disable mouse emulation after logon (just put it in the System/Preferences/Startup Applications, or wherever this option is in Unity):

NAME="LuenKeung"
ids=$(xinput list | grep $NAME | grep -o -e "id=.." | xargs | sed "s/id=//g")
for id in $ids; do
    echo "Disabling Mouse/Key events for ID $id"
    xinput set-prop $id "Generate Mouse Events" 0
    xinput set-prop $id "Generate Key Events" 0
done

Just change the NAME to match your joystick/gamepad name from "xinput list". I'm also using QJoyPad to make my own mouse/keyboard emulation layout (the defualut one from joystick driver didn't suit me).

P.S. I guess that those more experienced with awk/sed could make the line "ids=..." shorter and/or faster