Use exponential backoff for USB report retry throttle#1559
Open
kareltucek wants to merge 1 commit into
Open
Conversation
The previous fixed 10 ms minimum retry delay caused mouse-key stutter when USB reported "busy" rather than a hard error: every busy reply pushed the next attempt out by a full 10 ms. Refactor ShouldResendReport into a simple retry counter plus a new GetResendThrottleDelay() that returns the per-attempt delay. The schedule is 1, 2, 4, 8, 16, 32 ms and then capped at 32 ms; MAX_RETRIES is sized so the cumulative wait stays at the original ~1024 ms budget. Also switches the synchronous dongle resend loop in messenger.c (which already called ShouldResendReport) to the new counter semantics implicitly.
|
Thanks, I can confirm this fixes the mouse keys jitter via USB. I'm not sure if improved movement via dongle is also expected or not, but it's still pretty jittery for me. |
Collaborator
Author
|
When did the dongle jitter start? Was it present in 17.0.0.? |
|
Well, a really long time ago 😅. It started way back in #1114 Sorry, I don't think it's worse recently or anything though. I just don't understand the "dev speak" for whatever you said here 😅:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The previous fixed 10 ms minimum retry delay caused mouse-key stutter when USB reported "busy" rather than a hard error: every busy reply pushed the next attempt out by a full 10 ms.
Refactor ShouldResendReport into a simple retry counter plus a new GetResendThrottleDelay() that returns the per-attempt delay. The schedule is 1, 2, 4, 8, 16, 32 ms and then capped at 32 ms; MAX_RETRIES is sized so the cumulative wait stays at the original ~1024 ms budget.
Also switches the synchronous dongle resend loop in messenger.c (which already called ShouldResendReport) to the new counter semantics implicitly.
Changelog: