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 4963

Summary: Can't get raw value of a hat
Product: SDL Reporter: Sjoerd Simons <sjoerd.simons>
Component: joystickAssignee: Sam Lantinga <slouken>
Status: RESOLVED INVALID QA Contact: Sam Lantinga <slouken>
Severity: normal    
Priority: P2    
Version: HG 2.1   
Hardware: x86_64   
OS: Linux   

Description Sjoerd Simons 2020-01-28 13:07:40 UTC
As per https://www.kernel.org/doc/Documentation/input/gamepad.rst the EV_HAT{1,2}{X,Y) events can be used for shoulder mounted trigger buttons. Unfortunatel when using the joystick SDL API all one can get is a direction rather then raw values for the axis.
Comment 1 Sam Lantinga 2020-02-04 15:21:19 UTC
For these kinds of devices, the hats should be exposed as axes. SDL currently doesn't do that, but if you can tell whether a hat is a POV vs a trigger, feel free to submit a patch that does this.

If you don't feel comfortable doing this, you can include the kernel version that you're seeing this with and a link to purchase a device that shows up this way, and I'll take a look when I have time.
Comment 2 Sjoerd Simons 2020-04-06 14:27:56 UTC
It's a driver for a device not yet available from retail; Tbh i switched over to using the more normal Z axis for the triggers and got a patch pending to submit to the linux kernel to change the "standard" to match. In practise there don't seem any device using the hat event codes for triggers in the kernel and likely because to that it leads to a bunch of issues with programs/frameworks trying to use it (SDL is not the only one here it seems).

So imho this can be closed
Comment 3 Sam Lantinga 2020-04-06 17:25:09 UTC
Okay, thanks for the update!