purge unprocessed USB out transfers - #316
Merged
marckleinebudde merged 2 commits intoJul 15, 2026
Merged
Conversation
…ion to purge all frames of a channel from channel->list_from_host Extending the idea of commit 78c943d ("usbd_gs_can: usbd_gs_can_purge_to_host_list_by_channel(): add function to purge all frames of a channel from hGS_CAN.list_to_host") to the list_from_host. After a USB USB suspend or disconnect event it makes no sense makes no sense to process old data. Add a new function `usbd_gs_can_purge_from_host_list_by_channel()` that removes all outgoing frames of a channel from `channel->list_from_host`.
…channels list_from_host on CAN channel shutdown In case a CAN channel is shut down, remove all unprocessed USB OUT transfers for that channel from `channel->list_from_host`. `can_disable()` is called from the `USBD_GS_CAN_SuspendCallback()`, by purging all incoming frames avoids unexpected processing on USB OUT transfers after resume, which may lead to the following error messages: ``` [175499.859858] gs_usb 2-1.2:1.0 can0: Unexpected unused echo id 0 [175499.859955] gs_usb 2-1.2:1.0 can0: Unexpected unused echo id 1 [175499.859977] gs_usb 2-1.2:1.0 can0: Unexpected unused echo id 2 [175499.859994] gs_usb 2-1.2:1.0 can0: Unexpected unused echo id 3 [175499.860075] gs_usb 2-1.2:1.0 can0: Unexpected unused echo id 4 [175499.860097] gs_usb 2-1.2:1.0 can0: Unexpected unused echo id 5 [175499.860205] gs_usb 2-1.2:1.0 can0: Unexpected unused echo id 6 [175499.860227] gs_usb 2-1.2:1.0 can0: Unexpected unused echo id 7 [175499.860347] gs_usb 2-1.2:1.0 can0: Unexpected unused echo id 8 [175499.860368] gs_usb 2-1.2:1.0 can0: Unexpected unused echo id 9 ```
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.
This fixes the following error messages, which might occur during suspend/resume:
While #301 purges pending USB in transfers, this PR purges unprocessed USB out transfers.