If you use Linux it may happen that you mouse or keyboard are going to be recognized as joysticks by the system.

Why does this happen??

It happens because Linux automatically recognize every device that has axes or buttons as a gamepad/joystick/wheel (also when they don’t have all those axes/buttons like my case here explained).

This can sound like a mess to you but in many cases it’s absolutely great!

It’s fantastic because you can trow every kind of device to Linux and it will probably recognize it out of the box WITHOUT the need to install any kind of drivers and stuff like that.

It happened to me with the old Microsoft Sidewinder Wheel that i bought for 5€ at a used shop. Just insert the usb and you’re good to go!!

But sometimes some devices, like my Microsoft Sidewinder Mouse, can mess up your experience.

I found out about this problem while testing Valkyria Chronicles with Wine; i had nothing connected to my Pc but mouse and keyboard, but somehow i had a strange input coming from somewhere messing the game at the very beginning.

At first i thought it was some Wine issues but i had no errors from wine and none on winehq.org mentioned a similar problem.

After disconnecting both the Keyboard and Mouse and doing some tests i ended up finding out that my mouse was somehow acting strange.

You may have the same problem without even noticing it, in fact it affected just my experience with this particular game (and maybe with rFactor too, as i had some strange inputs when setting the controls up).

To check out if you have this problem open a terminal or your favorite folder manager and see what’s on the /dev/input folder:

[user@tgfpcs ~]$ ls /dev/input

You need to focus on everything that start with js (js0 in my case as you can see), this means that a JoyStick is recognized by the system, at this point if you add one or more devices they should automatically appear as js1, js2, js3 and so on.

At this point you have to check if this js0 is acting weird, in my case it has something like 36 axes, most of those are also uncalibrated, this is why it keeps scroll endlessly in the Valkyria Chronicles’ menu.

The easiest way to manage joysticks is by using a software called jstest-gtk, which will provide a grafical interface to manage your joystick’s settings

I set up a virtual machine with Ubuntu 16.04 to install it with the most famous Linux distro

I use the terminal a LOOOOOOT and i suggest you to do so, but if you’re super-scared just install it with your distro’s software manager.. (install the joystick package if you want to do everything from the terminal, then run # jstest /dev/input/js*)

Once the installation is finished let’s launch jstest-gtk to see what’s going on (the amount of devices should be the same as the amount of js* you find at /dev/input)

well looks like i have 2 devices connected to my pc  (i just have a mouse and keyboard connected to it btw), let’s go further and check some details by selecting a device and  clicking proprieties

as you can see it looks like i have a device (VB usb tablet) that has 2 axes and 5 buttons and another one (VB mouse integration) with 2 axes and 1 button.

VB usb tablet doesn’t respond to any input when i press or move my mouse or keyboard, while VB mouse integration respond to my mouse movement (see the gif) but the button doesn’t work.

Also notice that VB usb tablet’s axes are uncentered (should be 0 not -32767), this can cause issues with some applications (like Valkirya Chronicles’ menu above). Imagine a wheel constantly turned left or right, this is the same thing.

To calibrate and center the axes press calibration then start calibration

As you can see it is now centered in its neutral position (it still doesn’t respond to any inputs from mouse or kb)

Anyway you won’t solve anything because it will return uncentered every time you unplug the device or reboot the system.

To solve this problem you need to tell your pc to STOP recognizing these devices as joysticks. So even if uncentered/uncalibrated they won’t affect your experience.

You need to set a rule and blacklist a device by writing its product and device ID numbers in that rule.

Well, thanks to a github user named denilsonsa, it’s a very easy task to do. Let’s head to its github page

As you can see there we can either disable the device from being recognized or remove it. We will use the first method, so go ahead and copy the command that will create the rule file that we need on /etc/udev/rules/

  • Version that changes permissions to 0000
    sudo curl -o /etc/udev/rules.d/51-these-are-not-joysticks.rules \
  • Version that removes the device
    sudo curl -o /etc/udev/rules.d/51-these-are-not-joysticks-rm.rules \


After that we need to know our devices’ specs and put them in our file, type lsusb and check the IDs (if you’re not sure which is just unplug your device and type lsusb or ls /dev/input/ to indentify it)

Those ID numbers are what you need to fix your problem; now there are already some blacklisted devices in the file that you created before, so you can check the file and see if both idVendor and idProduct fit your device (e.g. idVendor 045e stands for a Micro$oft device). If not duplicate a device line by copying and pasting it (make sure to copy both lines with KERNEL= and ID_INPUT_JOYSTICK as they are needed for 1 device) and replace the ID numbers with what’s outputted by the lsusb command

Well that’s it, after you saved your changes go ahead and reboot your pc.

Now by lauching jstest-gtk you should have no more devices detected as joysticks! (it still recognize something on my Virtual Box but i guess it’s normal)

ps. if you need your device back as joystick or you made a mistake just delete your modification or even better comment out the line by adding # so it will be ignored (see the images below)

Hope it helped! till the next time :)

source: Arch Linux forum