• Stars
    star
    118
  • Rank 299,923 (Top 6 %)
  • Language
    Python
  • Created about 9 years ago
  • Updated 4 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Fix for keyboard/mouse/tablet being detected as joystick in Linux

udev-joystick-blacklist

Fix for keyboard/mouse/tablet being detected as joystick in Linux.

There are several devices that, although recognized by kernel as joysticks, are not joysticks. This repository contains rules that will prevent the non-functional /dev/input/js* and /dev/input/event* devices from being recognized as joysticks.

This is just a blacklist, which will always be incomplete (until the actual bug gets fixed). Feel free to add more devices to this list.

How to install

Version that changes permissions to 0000

sudo curl -o /etc/udev/rules.d/51-these-are-not-joysticks.rules \
  https://raw.githubusercontent.com/denilsonsa/udev-joystick-blacklist/master/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 \
  https://raw.githubusercontent.com/denilsonsa/udev-joystick-blacklist/master/51-these-are-not-joysticks-rm.rules

Which version should I use?

Personally, I'd try the first version (that sets permissions to 0000) first. If it does not work or if it gives trouble for some reason, I'd try the second version (that removes the device).

The first version (that sets permissions to 0000) seems to work fine across several distros, but some distros (such as OSMC, see also issue #26) may have additional rules that end up setting the permssions back to another value. In such case, the second version (that removes the device) should work.

In the end, it's up to you, and it's about what works best for you and your system.

What's different in after_kernel_4_9/?

A patch has been accepted into Linux kernel 4.9, so that Microsoft devices will not be detected as joysticks anymore. Thus, those devices are not included in after_kernel_4_9/*. Read issue #20 for details.

How it works

Matching

A rule will match if:

  • The subsystem is input;
  • The pair idVendor and idProduct is in this list;
  • Either one of:
    • The device property ID_INPUT_JOYSTICK is set;
    • Or the device name matches js[0-9]*.

Actions

The following actions are taken on each matching rule:

It is not possible to rename a device, so NAME="not-a-joystick%n" will not work.

Learning more about udev rules

Troubleshooting

Look at the generated /dev files: ls -l /dev/input/

Unplug and plug your USB device while monitoring for kernel and udev events: udevadm monitor -p

Look for other udev rules that may interact with the same device: grep -i '\bjs\b\|joystick' /lib/udev/rules.d/* /etc/udev/rules.d/*

Testing joystick detection

These tools list and interact with all available/detected joysticks:

Bug reports and mentions

There are reports of this issue on different distros and projects.

The udev rules in this repository have been added to:

But remember that the version distributed elsewhere might be different than the version on this repository.

Known devices

For the complete list, look at generate_rules.py script.

Contributing

The best ways to contribute are by creating a new issue or by making a pull request. Make sure you mention the device name/description and the vendor/product IDs. The relevant line from lsusb output is usually enough.

This repository contains a list of devices compiled from contributions of several people. I cannot test every single device. If something does not work for you even after you have added the correct rules, please try debugging it on your own system. The output of udevadm monitor -p may prove very helpful. Also look at the output of ls -l /dev/input/.

History of this repository

After suffering with this issue for a long time, I decided to investigate possible fixes and workarounds. Then, in May 2015, after searching a lot for a solution, I've managed to create some udev rules that fixed the issue for my devices and decided to share this solution with other people. Initially, I shared the simple file at GitHub Gist. Over time, people submitted contributions through comments, and keeping that file on Gist was becoming too hard to manage.

In October 2015, I decided to move the file to this GitHub repository. That way, it will be easier to make changes, to fork, to receive notifications, and essentially to maintain it.

Ideally, the bug in the Linux kernel should be fixed, so that this repository (which is essentially just a workaround) wouldn't be needed anymore.

License

Public domain. Feel free to use this project for whatever purpose you want.

Also, feel free to contribute to the project. And, if you have the knowledge and the skills, consider fixing this bug in the Linux kernel itself.

There is no warranty implied by using this project. Use at your own risk.

More Repositories

1

prettyping

`prettyping` is a wrapper around the standard `ping` tool, making the output prettier, more colorful, more compact, and easier to read.
Shell
1,203
star
2

gimp-palettes

RGB color palettes for Gimp
Python
177
star
3

crx-reload-tab

Chrome extension to reload the current tab at a chosen interval.
JavaScript
78
star
4

html5-knob

A rotary web input component
HTML
55
star
5

pygame-joystick-test

pygame-joystick-test is a small Python program that uses pygame to test joysticks. Upon running, it shows the state (axes, trackballs, hats and buttons) of all detected joysticks. It's a quick and simple way to check how well your joystick works.
Python
41
star
6

small_scripts

Lots of small scripts I've written over time. This includes shell scripts (written in sh or bash), small stand-alone Python programs, and Gimp plug-ins as well.
Python
36
star
7

arandr-indicator

Quick and simple tray icon menu for changing the monitor layout. A great companion to ARandR tool.
Python
26
star
8

lyne-solver

Solver for LYNE game.
JavaScript
23
star
9

atmega8-magnetometer-usb-mouse

ATmega8 working as USB mouse, by reading movements from a magnetometer (digital compass). [Projeto Final do curso de Bacharelado em Ciência da Computação DCC/UFRJ]
C
19
star
10

bizhawk-lua-scripts

Lua scripts I've written for BizHawk/EmuHawk emulator
Lua
12
star
11

crx-ss-tv-remote

Chrome app to control a Samsung TV over LAN/Wi-Fi.
JavaScript
11
star
12

spritegen

Random game sprite generator
JavaScript
10
star
13

ets2-stuff

Collection of assorted stuff related to Euro Truck Simulator 2 game.
JavaScript
7
star
14

tinyos-gentoo-overlay

Gentoo overlay for TinyOS packages
Shell
7
star
15

crx-uri-splitter

Browser extension to easily and quickly edit the URL/URI from the current page
JavaScript
6
star
16

retroadapter

My changes on top of RetroAdapter to make it work with my microcontroller. This is basically the RetroAdapter version 2.1a with some tweaks in the Makefile, an updated usbdrv, and many modules disabled. Built as an USB adapter for SEGA Genesis / Mega Drive controllers.
C
4
star
17

fontpreviewer

"fontpreviewer" is a nice little tool that generates PNG thumbnails of TTF fonts, and also generates a HTML file with all generated thumbnails. This program was originally written on 2007-08-08 and then completely forgotten for almost 4 years.
Python
3
star
18

browser-selector

Browser Selector is a Python script that allows you to choose what browser you want to launch for each URL. It is intended to be used as a default URL handler.
Python
2
star
19

magic-square

Magic square finder (brute-force algorithm)
JavaScript
2
star
20

dotfiles

Vim Script
2
star
21

cpf-generator

Small and simple and fast generator of all possible CPF numbers
C
2
star
22

denilsonsa.github.io

My site at GitHub Pages
HTML
2
star
23

hackhands-aux-tools

Curated list of useful tools for online mentorship — http://denilsonsa.github.io/hackhands-aux-tools/
HTML
2
star
24

abn-amro-statement-parser

Parser for the Dutch ABN AMRO bank and credit card transactions
Python
2
star
25

subtitle-player

A "player" for subtitles
JavaScript
1
star
26

calculator-the-game-solver

Solver for "Calculator: The Game"
JavaScript
1
star
27

terraria-stuff

Collection of assorted stuff related to Terraria game
HTML
1
star
28

atmega8-hidkeys-helloworld

USB Keyboard using ATmega8, a slightly modified version of HIDKeys.2007-03-29 firmware.
C
1
star
29

simone-giertz-fish-slap

Simone Giertz fish slap → https://denilsonsa.github.io/simone-giertz-fish-slap/fishslap_view_as_bg.html
HTML
1
star
30

cartorios-autorizados-apostila

Cartórios Autorizados - Convenção da Apostila da Haia
Jupyter Notebook
1
star
31

pythonlogica

Módulo prático com utilitários para resolução de exercícios do curso de Lógica do DCC/UFRJ. Permite calcular a tabela verdade (e, portanto, comparar duas fórmulas, checar se é tautologia ou contradição) e possui um manipulador de expressões, o qual permite converter uma fórmula para FNC (Forma Normal Conjuntiva). Para mais detalhes, leia a documentação incluída junto com o código fonte. Há uma descrição de como usar este módulo, inclusive com exemplos.
Python
1
star
32

redstone_javascript

The beginnings of a (Minecraft) Redstone editor/simulator, written completely in JavaScript. It's also mirrored in BitBucket: https://bitbucket.org/denilsonsa/redstone_javascript/
JavaScript
1
star
33

gamepad-cheatsheet

Cheatsheet of configuration shortcuts of many gamepads (think of it as a concise and comprehensive version of the gamepad manuals)
HTML
1
star