uinput device doesn't show in gamepad/joystick list

Peter Hutterer peter.hutterer at who-t.net
Tue Oct 13 13:29:01 PDT 2015


On Tue, Oct 13, 2015 at 11:19:54PM +0300, Coşku Baş wrote:
> I see. What I meant is before adding the udev rule about the joystick,
> evtest did not list it when it was run *without* sudo. Now that I have the
> ID_INPUT_JOYSTICK correctly it even shows up when I run evtest without root.
> Maybe that helps somehow?

that's because you're changing the group with the udev rule too and your
user is in the wheel group. Not something you should generally do.
input devices are only accessible by root for a reason - anyone that can
access an input device can listen to all events from that input device and
thus record passwords.

Cheers,
   Peter

> On Tue, 13 Oct, 2015 at 11:03 PM, Peter Hutterer <peter.hutterer at who-t.net>
> wrote:
> >On Tue, Oct 13, 2015 at 10:27:52PM +0300, Coşku Baş wrote:
> >> Strangely, setting ID_INPUT_JOYSTICK with an udev rule worked for the
> >> virtual gamepad but not for the virtual mouse or keyboard.
> >>
> >> Right now this is how my custom udev rule looks like:
> >>
> >> KERNEL=="uinput", GROUP="wheel", MODE="0660"
> >> SUBSYSTEMS=="input", ATTRS{name}=="Virt Gamepad",
> >>ENV{ID_INPUT_JOYSTICK}="1"
> >> SUBSYSTEMS=="input", ATTRS{name}=="Virt Keyboard",
> >> ENV{ID_INPUT_KEYBOARD}="1"
> >> SUBSYSTEMS=="input", ATTRS{name}=="Virt Mouse", ENV{ID_INPUT_MOUSE}="1"
> >>
> >> So now evtest successfully recognizes the gamepad but not the mouse nor
> >>the
> >> keyboard.
> >> (Keyboard enables EV_KEY and mouse enables EV_KEY and EV_REL)
> >>
> >> Any light to shed?
> >
> >fwiw, evtest doesn't care about udev tag, it opens the device node you
> >request and that's it. only X, libinput, SDL care about the udev tags.
> >
> >other than that I don't know, sorry. may be a hidden typo in your udev
> >rule.
> >fwiw, whenever I play with udev rules, I always add a ENV{FOO}="1" to the
> >list and increment that number. that way I can check whether it applied
> >and
> >what applied, otherwise you may get interference from other rules.
> >
> >Cheers,
> >   Peter
> >
> >>
> >> On Sun, 11 Oct, 2015 at 8:02 AM, Peter Hutterer
> >><peter.hutterer at who-t.net>
> >> wrote:
> >> >On Sat, Oct 10, 2015 at 06:39:23PM +0300, Coşku Baş wrote:
> >> >> Hi there,
> >> >>
> >> >> I have created a virtual gamepad that mimics the events received
> >>from a
> >> >> physical gamepad over a network connection.
> >> >>
> >> >> To test if the system works I have run evtest and surely the virtual
> >> >>device
> >> >> emits the correct events.
> >> >>
> >> >> The problem is I can't seem to get any game recognize the virtual
> >> >>gamepad.
> >> >> Most of the games I tried use SDL2 so I have run sdl2-jstest
> >> >>application
> >> >> and expectedly the virtual device was not listed. Is it possible to
> >> >> advertise my uinput device as a real gamepad so that games can make
> >>use
> >> >>of
> >> >> it?
> >> >>
> >> >> As a side note, evtest only lists the device if it's ran as root.
> >> >>Running
> >> >> sdl2-jstest as root did not made a difference though.
> >> >>
> >> >> Any help would be appreciated.
> >> >> Thanks.
> >> >
> >> >first guess here is that the ID_INPUT_JOYSTICK or some other tag isn't
> >> >applied by udev, so the rest of the system doesn't identify it
> >>correctly.
> >> >that could lead to e.g. the X server not initializing it. Usually the
> >> >solution to that is to either add a specific set of axes/buttons to
> >> >trigger
> >> >the tag, or assign the tag manually with a custom rule.
> >> >
> >> >What's the evemu-describe output of the device?
> >> >
> >> >Cheers,
> >> >   Peter


More information about the Input-tools mailing list