xbmc/xbmc — pull request #5336 by zzattack (2014-09-08 01:31:14+00:00)
Title: Handle non-zero centered axes (i.e. triggers) more sanely

This commit fixes some issues with non-zero centered axes, i.e. triggers, on gamepads. In their resting state, SDL reports them as having value -32768, which if it were a analog stick would indicate the stick is moved fully in one direction.
Additionally, SDL reports all axis initially as having value '0', even though the triggers in their resting state report -32768 (issue confirmed sdl-jstest, with both xpad/xboxdriv - SDL is at fault here). This requires us to ignore these axes until SDL reports them as no longer having value 0. Observed behaviour would be that once you touch the trigger, XBMC will constantly be handling the action associated with the trigger, which basically means the triggers cannot be used at all.

One major remaining problem is that SDL cannot tell us which axes of a joypad are triggers and which are analog sticks. I've used a test against a known number of axes, hats and buttons, along with the joypad having '360' in the name to identify xbox 360 controllers, for which we know we axes are really triggers. Not sure how this can be improved easily.