Ubuntu: Joystick acts as mouse; won't stop


Joystick acts as a mouse, even when I'm playing a game that uses a joystick so I get random mouse events going on.

I plugged a joystick in to play Spiral Knights, also installed joystick and jcalibrate. Everything is working good, except by default the joystick moves the mouse around and the button activate mouse keys.

Now normally this would be good behavior if I'm on a Myth-box or something, unfortunately when I play Spiral Knights with joystick input I see my mouse cursor moving in the back ground and when I hit a button it thinks I'm pressing right-click so it minimizes everything. Also it creates folders and probably deletes stuff.

So, basically how the heck do I stop it from acting as a mouse?


Uninstall xserver-xorg-input-joystick.

It's a package to control the mouse with the joystick. I only installed once to test it and it was driving me mad, so maybe that's the problem. I think the joystick would work the same without it.


put this code in a file:

#!/bin/bash  id=`xinput list | grep "↳ DragonRise Inc.   Generic   USB  Joystick     id=" | cut -c58-59`  props_mouse=`xinput list-props $id | grep "Generate Mouse Events (" | cut -c25-27`  props_teclado=`xinput list-props $id | grep "Generate Key Events (" | cut -c23-25`  xinput set-prop $id $props_mouse 0  xinput set-prop $id $props_teclado 0  

save it, right button in rights and tick "mark this file as a program"

execute it and you will have your joystick "as joystick again" (and the best, you can have your joystick as mouse again if you change the "0" in the last two lines with "1").


You perhaps should be using jscal to calibrate your joystick - you can use the -u option as per the manual page to configure the joystick to not use the mouse buttons.

There is some interesting stuff about the various joysticks & gamepads on ubuntuforums as well.


Try Qjoypad or (if you don't want to use QT) the slighlty less featured rejoystick (GTK). This way you don't have to edit/create xorg.conf.

They both are available on playdeb

Understanding joystick drivers is kind of a mess, everything seems to be either outdated or unfinished... Good luck!


I just had the same problem, but with a Playstation 3 controller. Using the answers as a template, I expanded on the solution:

#!/bin/bash  id=`xinput list | grep -P "PLAYSTATION.*pointer" | grep -oP "id=\d+" | grep -oP "\d+"`  props=`xinput list-props $id`  # echo "$props"  props_mouse=(`echo "$props" | grep "Generate Mouse Events" | grep -oP "\d+"`)  props_keyboard=(`echo "$props" | grep "Generate Key Events" | grep -oP "\d+"`)  xinput set-prop $id ${props_mouse[0]} $[1-${props_mouse[1]}]  xinput set-prop $id ${props_keyboard[0]} $[1-${props_mouse[1]}]  

This version of the script will enable or disable the controller, depending on the current settings, like a toggle.


1- You should see your joystick number first ... so Run Terminal and type xinpute list ,and look to your joystick number and replace its number instead of the 10 in the Example below.

#!/bin/bash id=xinput list | grep "↳ DragonRise Inc. Generic USB Joystick id=10" | cut -c58-59 props_mouse=xinput list-props 10 | grep "Generate Mouse Events (" | cut -c25-27 props_teclado=xinput list-props 10 | grep "Generate Key Events (" | cut -c23-25 xinput set-prop 10 $props_mouse 0 xinput set-prop 10 $props_teclado 0  

2- Creat a new Document then put the code in it , then rename it to name.sh Format 3- Run Terminal then put the path where you save the file .

Example : cd Desktop (Because i saved mine on the Desktop)

4- Type bash name.sh ( Click Enter and You are Done ! )

Note1: to Turn it back on just change the 0 on the last 2 lines to 1 Note2: if this doesn't work make sure to remove xserver-xorg-input-joystick and /usr/lib/X11/xorg.conf.d/10-joystick


Matias Parmigiani's answer was the key for me. However, the format of the xinput list has changed, at least on Ubuntu 13.04 LTS...

⎜   ↳ DragonRise Inc.   Generic   USB  Joystick     id=12   [slave  pointer  (2)]      ↳ DragonRise Inc.   Generic   USB  Joystick   (keys)    id=11   [slave  keyboard (3)]  

As a result I needed to use the following in my disablement script:

#!/bin/bash  id=`xinput list | grep -P "DragonRise Inc.   Generic   USB  Joystick\s+id=" | grep -oP "id=\d+"| cut -c4-5`  props_mouse=`xinput list-props $id | grep "Generate Mouse Events" | grep -oP "\(\d+"| cut -c2-5`  props_teclado=`xinput list-props $id | grep "Generate Key Events" | grep -oP "\(\d+"| cut -c2-5`  xinput set-prop "$id" "$props_mouse" 0  xinput set-prop "$id" "$props_teclado" 0  

Hope this helps!


I am using Linux Mint 17.3 and I was having this same problem. I had the onlive console and I was going to throw away the controller. I didn't know it would work, but It connected easily through bluetooth. The left joystick was controlling the mouse and I search and try different methods but none of them worked. I'm posting this so it can help other people. I followed the fix from the Ubuntu Sixaxis setup page. I had to add this configuration to the xorg.conf file:

Section "InputClass"      Identifier "joystick catchall"      MatchIsJoystick "on"      MatchDevicePath "/dev/input/event*"      Driver "joystick"      Option "StartKeysEnabled" "False"       #Disable mouse      Option "StartMouseEnabled" "False"      #support  


It works perfectly after logging out. The only problem is if the xorg.conf is updated like after installing a new graphics driver, it will lose it. Can someone explain me how to create a script that checks the configuration is in the file, if not, write it after each reboot? Thanks in advanced.

Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Next Post »