Remove BTN_DPAD_* keys from ID_INPUT_KEY test (#5701)
authorNathaniel R. Lewis <nlewis@gaikai.com>
Thu, 6 Apr 2017 19:13:14 +0000 (12:13 -0700)
committerMartin Pitt <martinpitt@users.noreply.github.com>
Thu, 6 Apr 2017 19:13:14 +0000 (21:13 +0200)
commitf472d466ec267944a1448505c6889c6393f1a861
tree73435dcdb7820780caec7717468c7836b60f4504
parent6cb484cc062b79db925f04cb8bb7a5cfac622d51
Remove BTN_DPAD_* keys from ID_INPUT_KEY test (#5701)

At present, devices implementing the BTN_DPAD_UP/DOWN/LEFT/RIGHT
codes will be incorrectly classified as key devices.  This causes
devices respecting the Linux gamepad spec (such as the DS3 as of
kernel 4.12) to be classified as keyboards by X11.

This is caused by the test_key function checking all codes on
[KEY_OK, BTN_TRIGGER_HAPPY).  Unfortunately the BTN_DPAD_* codes
are placed between KEY_LIGHTS_TOGGLE and KEY_ALS_TOGGLE.  This
patch splits the upper key block check into the block before and
after the BTN_DPAD_* codes.  An array is used to avoid dedicated,
per block loops in the event that more event codes are added in
the future.
src/udev/udev-builtin-input_id.c