-
-
Notifications
You must be signed in to change notification settings - Fork 39.8k
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 USB: Add a dummy IN callback to work around LLD bugs #18811
Conversation
In qmk#18631 some IN notification callbacks that were doing nothing were removed, which should be a valid thing to do (ChibiOS HAL checks the `in_cb` and `out_cb` pointers for being non-NULL before invoking those optional callbacks). However, it turned out that some less popular USB LLDs (KINETIS and MIMXRT1062) have their own checks for those pointers, and (incorrectly) skip the ChibiOS callback handling when those pointers are NULL, which breaks the code for the `USB_USE_WAIT` configuration option (the waiting thread never gets resumed if the corresponding callback pointer is NULL). Add those dummy callbacks again (but use a single function for all of them instead of individual ones for each endpoint); this restores the KINETIS and MIMXRT1062 boards to the working state while the LLDs are getting fixed.
The actual fixes for the underlying driver bugs should be:
The KINETIS fix was minimally tested on a Teensy 3.2 (MK20DX256); ideally it should be tested on other Teensy variations which have different MCUs but still use the same driver (LC, 3.5, 3,6), but I don't have that hardware. The MIMXRT1062 fix was just compile-tested with When these fixes finally land in the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ouch
Thanks, can confirm that this one fixes the issue as well on Teensy 4.1. |
In qmk#18631 some IN notification callbacks that were doing nothing were removed, which should be a valid thing to do (ChibiOS HAL checks the `in_cb` and `out_cb` pointers for being non-NULL before invoking those optional callbacks). However, it turned out that some less popular USB LLDs (KINETIS and MIMXRT1062) have their own checks for those pointers, and (incorrectly) skip the ChibiOS callback handling when those pointers are NULL, which breaks the code for the `USB_USE_WAIT` configuration option (the waiting thread never gets resumed if the corresponding callback pointer is NULL). Add those dummy callbacks again (but use a single function for all of them instead of individual ones for each endpoint); this restores the KINETIS and MIMXRT1062 boards to the working state while the LLDs are getting fixed.
Description
In #18631 some IN notification callbacks that were doing nothing were removed, which should be a valid thing to do (ChibiOS HAL checks the
in_cb
andout_cb
pointers for being non-NULL before invoking those optional callbacks). However, it turned out that some less popular USB LLDs (KINETIS and MIMXRT1062) have their own checks for those pointers, and (incorrectly) skip the ChibiOS callback handling when those pointers are NULL, which breaks the code for theUSB_USE_WAIT
configuration option (the waiting thread never gets resumed if the corresponding callback pointer is NULL).Add those dummy callbacks again (but use a single function for all of them instead of individual ones for each endpoint); this restores the KINETIS and MIMXRT1062 boards to the working state while the LLDs are getting fixed.
A more in-depth analysis of what happens in the code is in #18805 (comment).
Tested on a Teensy 3.2 board (
qmk flash -kb handwired/onekey/teensy_32 -km default
). On that hardware without this fix the lockup happens immediately after pressing a key mapped toKC_A
; this does not match the MIMXRT1062 behavior described in #18805 (where plain keys still work), but that problem should hopefully be fixed by this change too (given that a revert of #18631 helps there).Types of Changes
Issues Fixed or Closed by This PR
Checklist