Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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?

share|improve this question
    
Can you show what PC you have and joystick you are using. Also what Ubuntu version. –  Luis Alvarado Apr 16 '11 at 16:17
    
I'm using a playstation 2 to usb adapter, under the jscalibrate it's listed as: GreenAsia Inc. USB Joystick. I'm running Ubuntu 10.10 –  Shazzner Apr 17 '11 at 6:28
add comment

6 Answers 6

up vote 9 down vote accepted
+100

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.

share|improve this answer
    
Hooray that did it! I think that got tacked on when I added the joystick package in synaptic. It works great now! –  Shazzner Apr 19 '11 at 8:54
    
I had this problem also and it fixed it. Many thanks for answering, much appreciated! –  b1ackcrow Feb 25 '12 at 20:27
    
Is there a way to turn off/on this feaature? Is kindda cool controling the mouse with the gamepad but it should be nice to turn it on when i do need it –  chepe263 May 26 '12 at 21:32
    
thank's darent, this worked on Arch Linux too! Was trying to play Dustforce, and this was really annoying me. –  Marco Scannadinari Oct 17 '13 at 8:08
add comment

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").

share|improve this answer
    
It looks like the format of the "xinput list" lines have changed. –  Phoeey Sep 23 '13 at 12:00
add comment

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.

share|improve this answer
    
Is there a way to configure this without generating then editing an xorg.conf file? (I'm already using jscal to calibrate the joystick) –  Shazzner Apr 17 '11 at 6:34
    
I use jstest-gtk it's in the repos i think. –  darent Apr 30 '11 at 15:29
add comment

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!

share|improve this answer
    
These are great programs but unfortunately didn't solve my problem as rebinding them didn't make the issue go away. –  Shazzner Apr 19 '11 at 8:56
add comment

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

share|improve this answer
add comment

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!

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.