Skip to content

fix(Hardware Support): Fix Dropped Events From Debounce Method#623

Open
pastaq wants to merge 1 commit into
mainfrom
pastaq/go_s_dpad
Open

fix(Hardware Support): Fix Dropped Events From Debounce Method#623
pastaq wants to merge 1 commit into
mainfrom
pastaq/go_s_dpad

Conversation

@pastaq

@pastaq pastaq commented Jul 11, 2026

Copy link
Copy Markdown
Contributor

In some rare circumstances the Legion Go S DPad can have some chatter when pressed, emitting a 'down', 'up', and 'down' event in the same event frame. The deck and deck-uhid targets both contain debounce sequences for double events, preventing a "no-op" if a 'down' then 'up' event is hit in the same frame by rescheduling the 'up' event for later, but it doesn't account for what should happen if another 'down' event is hit while the 'up' event is scheduled. In such a case, the second 'down' event becomes a no-op as the state doesn't change, then the deferred 'up' event hits, clearing the state and putting the virtual device out of sync with the physical hardware.

Additionally, all of the currently implemented target device scheduled_events() functions fail to check for the elapsed time has passed, instead immediately draining all scheduled events in the next poll.

This patch addresses these issues by making the following changes:

  • Mask the Legion Go S evdev events to reduce the overall processing overhead for duplicated events and lower the chance for chatter.
  • Dequeue pending 'up' events if a 'down' event is processed before that event's scheduled interval.
  • Reduce ScheduledNativeEvent timeout on deck and deck-uhid to 8ms (approximately 2 frames) to reduce chatter collision probability.
  • Check ScheduledNativeEvent.is_ready() for queued events before draining them on all target devices with implemented scheduled_events() functions.

Fixes ValveSoftware/SteamOS#2539

In some rare circumstances the Legion Go S DPad can have some chatter
when pressed, emitting a 'down', 'up', and 'down' event in the same
event frame. The deck and deck-uhid targets both contain debounce
sequences for double events, preventing a "no-op" if a 'down' then
'up' event is hit in the same frame by rescheduling the 'up' event for
later, but it doesn't account for what should happen if another
'down' event is hit while the 'up' event is scheduled. In such a case,
the second 'down' event becomes a no-op as the state doesn't change,
then the deferred 'up' event hits, clearing the state and putting the
virtual device out of sync with the physical hardware.

Additionally, all of the currently implemented target device
scheduled_events() functions fail to check for the elapsed time has
passed, instead immediately draining all scheduled events in the next
poll.

This patch addresses these issues by making the following changes:
- Mask the Legion Go S evdev events to reduce the overall processing
  overhead for duplicated events and lower the chance for chatter.
- Dequeue pending 'up' events if a 'down' event is processed before that
  event's scheduled interval.
- Reduce ScheduledNativeEvent timeout on deck and deck-uhid to 8ms
  (approximately 2 frames) to reduce chatter collision probability.
- Check ScheduledNativeEvent.is_ready() for queued events before draining
  them on all target devices with implemented scheduled_events() functions.
@pastaq pastaq force-pushed the pastaq/go_s_dpad branch from 8c39560 to a858e1a Compare July 11, 2026 06:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Legion Go S (Z2 Go Glacier) D-Pad Randomly Drops Inputs

1 participant