Page MenuHomeFreeBSD

hid/hgame: Fix desync in hgame_dpad_cb()
ClosedPublic

Authored by majedalkhaleefah_gmail.com on Fri, Mar 13, 7:57 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sun, Apr 5, 1:19 PM
Unknown Object (File)
Sat, Apr 4, 2:22 AM
Unknown Object (File)
Fri, Apr 3, 3:13 PM
Unknown Object (File)
Fri, Apr 3, 1:38 AM
Unknown Object (File)
Wed, Apr 1, 4:45 AM
Unknown Object (File)
Thu, Mar 26, 9:56 AM
Unknown Object (File)
Mon, Mar 23, 7:48 AM
Unknown Object (File)
Fri, Mar 20, 11:54 PM
Subscribers

Details

Summary
hgame_dpad_cb() previously exited early whenever conflicting directions
were input (e.g., UP + DOWN) without saving said input to the
hgame_softc state. This led to a desync between the driver and the
gamepad.

This patch instead handles conflicting inputs by cancelling them out
with each other.

Remove early return. Calculate axis value by subtraction.
Test Plan

Tested via evtest with a Raspberry Pi Pico (emulated as a gamepad)

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

don't have access to hardware to test this in a while, but logic looks sound!

sys/dev/hid/hgame.c
138

No need for these parens. Ditto for others.

This revision is now accepted and ready to land.Sat, Mar 21, 5:50 AM
This revision now requires review to proceed.Tue, Mar 24, 6:22 AM
This revision was not accepted when it landed; it landed in state Needs Review.Tue, Mar 24, 6:44 AM
This revision was automatically updated to reflect the committed changes.