Skip to content

Conversation

@ndreys
Copy link

@ndreys ndreys commented Nov 15, 2025

Add .suspend/.resume callbacks to pass those events to the users, so they can react accordingly.

Add .suspend/.resume callbacks to pass those events to the users, so
they can react accordingly.

Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
@zephyrbot zephyrbot added the area: USB Universal Serial Bus label Nov 15, 2025
@sonarqubecloud
Copy link

@josuah
Copy link
Contributor

josuah commented Nov 15, 2025

Hello @ndreys,

This PR could interest you as it seems almost the same:

@ndreys
Copy link
Author

ndreys commented Nov 15, 2025

Hello @ndreys,

This PR could interest you as it seems almost the same:

Thanks, yeah.

@jfischer-no

An interface cannot be suspended, and there is nothing like that in the HID specification. To get notifications when a USB device is suspended, please use USBD_MSG_SUSPEND and USBD_MSG_RESUME. There is no reason to have additional callbacks in each function/class implementation.

Whether interface can or cannot be suspended seems orthogonal. You can suspend a device and then take local, interface-specific actions when that happens. I have a composite device with multiple HID interfaces and having those callbacks allows to easily separate the concerns of each of those devices. Using USBD_MSG_SUSPEND requires registering a shared message callback and then dispatch that to individual interfaces which creates another layer of unnecessary interconnetions.

Can we please revisit this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: USB Universal Serial Bus

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants