Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ChibiOS: fix deadlocks when hammering mouse/extra keys #28

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

lactide
Copy link

@lactide lactide commented Oct 8, 2017

When hammering on the mouse or extra keys, tmk will deadlock.
To fix that, i've copied the fix from the keyboard endpoint [1]

[1] tmk/tmk_keyboard@72c52d3

When hammering on the mouse or extra keys, tmk will deadlock if ChibiOS was
compiled with assertions. This particular assertion in usbTransmitI fires
if the last packet hasn't been acknowledged yet by the host driver.

To fix that, we'll save the new report and transmit it if the last
report was acknowledged.
@lactide lactide force-pushed the fix_mouse_extra_deadlocks branch from 5324dd3 to f6ff126 Compare October 14, 2017 11:17
@lactide
Copy link
Author

lactide commented Oct 14, 2017

I'm not sure anymore whether this was the correct fix in the first place.

tmk only "deadlocks" because i've enabled ChibiOS assertions. This particular assertion in usbTransmitI fires if the last packet hasn't been acknowledged yet by the host and tmk wants to send the next report.
So this commit only helps if the host still acknowledges the reports.

But this isn't always the case. My FreeBSD installation doesn't seem to understand the extra_keys or the nkro reports and won't acknowledge any of them.
Same issue in the BIOS of a thinkpad x201 for mouse or extra keys. So if the host doesn't acknowledge any packets, then the patch above will still trigger the assertion.

ChibiOS calls a callback when the last transmission is finished.
So if we want to transmit a report and the endpoint still hasn't sent the last report, we'll keep a pointer to the new report and will send it if the callback of the endpoint is called. I've implemented this in my branch and force pushed the commit.

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.

1 participant