mirror of
https://gitlab.freedesktop.org/libinput/libinput.git
synced 2026-02-04 01:10:25 +01:00
evdev: Be more careful about what we consider a joystick
After switching my main workstation over to using xf86-input-libinput, I noticed that the multi-media keys like play/pause on my keyboard no longer worked. It turns out that the second hid interface on my keyboard which has the multimedia-keys, also declares having: BTN_BASE6 and BTN_MODE which both fell into the range we were using to test for something being a joystick. The commit makes our joystick test mode strict, restoring functionality of the multi-media keys on the keyboard in question. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
parent
594bbb01af
commit
0afd0b792f
1 changed files with 16 additions and 9 deletions
25
src/evdev.c
25
src/evdev.c
|
|
@ -1324,7 +1324,7 @@ evdev_configure_device(struct evdev_device *device)
|
|||
struct libevdev *evdev = device->evdev;
|
||||
const struct input_absinfo *absinfo;
|
||||
int has_abs, has_rel, has_mt;
|
||||
int has_button, has_keyboard, has_touch;
|
||||
int has_button, has_keyboard, has_touch, has_joystick_button;
|
||||
struct mt_slot *slots;
|
||||
int num_slots;
|
||||
int active_slot;
|
||||
|
|
@ -1336,17 +1336,24 @@ evdev_configure_device(struct evdev_device *device)
|
|||
has_abs = 0;
|
||||
has_mt = 0;
|
||||
has_button = 0;
|
||||
has_joystick_button = 0;
|
||||
has_keyboard = 0;
|
||||
has_touch = 0;
|
||||
|
||||
for (i = BTN_JOYSTICK; i < BTN_DIGI; i++) {
|
||||
if (libevdev_has_event_code(evdev, EV_KEY, i)) {
|
||||
log_info(libinput,
|
||||
"input device '%s', %s is a joystick, ignoring\n",
|
||||
device->devname, devnode);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
for (i = BTN_JOYSTICK; i <= BTN_PINKIE; i++)
|
||||
if (libevdev_has_event_code(evdev, EV_KEY, i))
|
||||
has_joystick_button = 1;
|
||||
|
||||
for (i = BTN_GAMEPAD; i <= BTN_TR2; i++)
|
||||
if (libevdev_has_event_code(evdev, EV_KEY, i))
|
||||
has_joystick_button = 1;
|
||||
|
||||
if (has_joystick_button) {
|
||||
log_info(libinput,
|
||||
"input device '%s', %s is a joystick, ignoring\n",
|
||||
device->devname, devnode);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (libevdev_has_event_type(evdev, EV_ABS)) {
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue