We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 4962 - Hats get confused if they're not all used
Summary: Hats get confused if they're not all used
Status: RESOLVED FIXED
Alias: None
Product: SDL
Classification: Unclassified
Component: joystick (show other bugs)
Version: HG 2.1
Hardware: x86_64 Linux
: P2 normal
Assignee: Sam Lantinga
QA Contact: Sam Lantinga
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-01-28 13:03 UTC by Sjoerd Simons
Modified: 2020-02-04 15:24 UTC (History)
0 users

See Also:


Attachments
Proposed fix (1.20 KB, patch)
2020-01-28 13:03 UTC, Sjoerd Simons
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Sjoerd Simons 2020-01-28 13:03:46 UTC
Created attachment 4178 [details]
Proposed fix

If only e.g. EV_HAT0X  and EV_HAT2X are used the hat handling code got confused and events for both hats seem to come from hat 0.

A reason for "joysticks" not to have all HATs is because implement the standard linux gamepad event codes (https://www.kernel.org/doc/Documentation/input/gamepad.rst) which defines EV_HAT0 to be for an analog d-pad, EV_HAT1 to the top two shoulder buttons (if analog triggers rather digital) and EV_HAT2 for the bottom two shoulder buttons).
Comment 1 Sam Lantinga 2020-02-04 15:24:12 UTC
Looks good, thanks!
https://hg.libsdl.org/SDL/rev/26fa8708d147