Interruptions of user presence check #124
Replies: 4 comments
-
Progress:
|
Beta Was this translation helpful? Give feedback.
-
Fully implemented cancellation for FIDO: |
Beta Was this translation helpful? Give feedback.
-
In the end the As such, I changed the approach to use an This flag can be interrupted by anything with a reference to it. |
Beta Was this translation helpful? Give feedback.
-
Here is a detailed list of the PRs that are involved in making this work. Trussed must accept and check an interrupt flagDispatcher and usb drivers needs to exchange the
|
Beta Was this translation helpful? Give feedback.
-
As described in trussed-dev/ctaphid-dispatch#2, there is currently no way to cancel the user presence request. This is useful when a command expects a user presence check but is cancelled, which renders the device unresponsive for
Currently the looping and the timeout is implemented in trussed: https://github.com/trussed-dev/trussed/blob/main/src/service.rs#L528.
The service implementation could simply check in each iteration if the interchange from which the request comes has been cancelled. This would allow the apps to cancel the requests. However apps can't actually use this since they run in a lower-priority task than trussed.
The solution I see would be to have instead the usbd-{ctaphid/ccid} drivers trigger the cancellation of the ongoing request. I would:
AtomicPtr<Channel>
shared between the dispatch and usbd structs. When a request is in flight, the-dispatch
crates would set it to point to the trussed interchange of the client of the app that is responding. When theusbd
crate triggers a cancellation, it would load this pointer to cancel the running app. Null means nothing to cancel. This is safe because all interchanges are'static
.Other options I see would be to add explicit
AtomicBool
orAtomicU8
that would convey cancellation information, but this would be more intrusive, duplicate cancellation logic with interchanges.I generally feel like it's shouldn't really be the usbd-* crates job to cancel requests at the trussed level but I don't see how to do it better. Ideally it should be the dispatch crates but they can't actually do because they're in the same task as the apps.
Beta Was this translation helpful? Give feedback.
All reactions