Skip to content

Possible to send USB "message" when process exists #108

Closed Answered by kevinmehall
andrewdavidmackenzie asked this question in Q&A
Discussion options

You must be logged in to vote

The way to do this is is to have your descriptors specify two alternate settings for your interface:

  • Alt setting 0 representing the disabled state with no endpoints
  • Alt setting 1 representing the enabled state with any endpoints you need

After claiming the interface, use .set_alt_setting(1) to switch to the enabled state. The OS will automatically set the alt setting back to 0 when the interface is released, even if the process is killed or crashes. Your device will receive a SET_INTERFACE request when the alt setting is changed in either direction, which is exposed as a Handler method in Embassy.

Replies: 3 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by andrewdavidmackenzie
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants