denilsonsa / udev-joystick-blacklist

Fix for keyboard/mouse/tablet being detected as joystick in Linux
118 stars 27 forks source link

The "-rm" version breaks systems by deleting device nodes that are still referenced by the udev database #58

Open foresto opened 4 months ago

foresto commented 4 months ago

While I have no doubt that these rules were written with good intentions, 51-these-are-not-joysticks-rm.rules is putting systems in a bad state by deleting device nodes that are still referred to by udev.

The consequence: any software that correctly discovers joysticks by querying udev or reacting to udev events will fail when it tries to open their device nodes, because the node (e.g. /dev/input/js0) doesn't actually exist.

Unfortunately, this rules file has made its way into some widely used packages, such as certain redistributions of Valve's "steam-devices" udev rules collection, thereby causing mysterious failures that shouldn't occur.

Please consider using a different approach.

Suggestion 1:

Suggestion 2:

I spent more than a few hours tracing a failure caused by these rules to its source. It was tough to pin down, because most users who have affected devices don't know enough about how these things work to diagnose them on their own, and most people who have the knowledge don't have the affected devices and don't expect custom udev rules to be deleting device nodes.

Thanks for your attention.

scaronni commented 4 months ago

@foresto I'm the packager who added the udev rule in the steam-devices subpackage in Fedora, I was notified by a user.

Your approach in Suggestion 1 seems to be the best, I'll make a Pull Request proposal for that. I don't have one device that falls into this list since a very long time (at least ~8 years) so I won't be able to test, but I will ask the user to test.

KayJay7 commented 4 months ago

@scaronni Another possible approach would be creating an /etc/udev/hwdb.d/61-these-are-not-joystick.hwdb file, similarly to how we did here as recommended by a systemd dev.

But that would require the modalias id of all the devices in this repo.

scaronni commented 4 months ago

That's even better. I think we should add all the IDs in this project in the very same way and get rid of the custom udev rule. This repository is very old and the drivers have never been fixed, so putting it there sounds like the best approach.

We can generate the modalias skipping the version id and just using Vendor and Product I guess.

scaronni commented 4 months ago

Do we need anything else beside ID_INPUT_JOYSTICK=?

Example:

id-input:modalias:input:b0003v046bpff10*
  ID_INPUT_JOYSTICK=

id-input:modalias:input:b0003v046dpc30a*
  ID_INPUT_JOYSTICK=
[...]
scaronni commented 4 months ago

If I'm reading correctly, except the ASRock LED Controller all the others are anyway input devices (mouse, keyboard, tablet).