irtimmer/limelight-embedded — pull request #45 by Arkos (2014-09-21 22:23:27+00:00)
Title: Bugfix for certain gamepads

There is a problem with some gamepads having buttons which send EV_KEY and EV_ABS events for the same keypress. (occurred to me with my PS3 official pad)
Example of a log returned by evtest with one press on the "X" button on my PS3 gamepad:

Event: time 1411337573.170795, type 1 (EV_KEY), code 302 (?), value 1
Event: time 1411337573.170795, type 3 (EV_ABS), code 28 (ABS_TOOL_WIDTH), value 74
Event: time 1411337573.170795, -------------- SYN_REPORT ------------
Event: time 1411337573.180987, type 3 (EV_ABS), code 28 (ABS_TOOL_WIDTH), value 92
Event: time 1411337573.180987, -------------- SYN_REPORT ------------
Event: time 1411337573.192342, type 3 (EV_ABS), code 28 (ABS_TOOL_WIDTH), value 107
Event: time 1411337573.259344, -------------- SYN_REPORT ------------
Event: time 1411337573.270692, type 3 (EV_ABS), code 28 (ABS_TOOL_WIDTH), value 75
Event: time 1411337573.270692, -------------- SYN_REPORT ------------
Event: time 1411337573.282041, type 3 (EV_ABS), code 28 (ABS_TOOL_WIDTH), value 47
Event: time 1411337573.282041, -------------- SYN_REPORT ------------
Event: time 1411337573.293465, type 1 (EV_KEY), code 302 (?), value 0
Event: time 1411337573.293465, type 3 (EV_ABS), code 28 (ABS_TOOL_WIDTH), value 0
Event: time 1411337573.293465, -------------- SYN_REPORT ------------

The problem is, in EvdevHandler, if a button or an axis is not mapped in the GamepadMapping, the boolean *gamepadModified* will be set to false.
But in our case, the buttons are only mapped to EV_KEY events and never to EV_ABS events. So the *gamepadModified* boolean always ends to be set to false when the EV_ABS event for the button is received.
I have splitted this boolean in two separate variables to avoid this problem.