Commit e14dfd0
committed
feat: add AsyncStreamDeck::from_sync to wrap an already-opened StreamDeck
Allows opening a device via the synchronous API on a caller-chosen thread
and then handing it to the async wrapper. This matters on macOS, where
hidapi's IOHIDManager is bound to the run loop of the thread that created
the HidApi: enumerate/open must happen on that thread, but the existing
AsyncStreamDeck::connect runs them via block_in_place on whatever tokio
worker is current, which can crash (EXC_BREAKPOINT in CoreFoundation)
when the device set changes, e.g. after sleep/wake.
With from_sync, an application can own the HidApi on a dedicated thread,
open devices there with StreamDeck::connect, and still use the async API
for everything else.1 parent f7f8eff commit e14dfd0
1 file changed
Lines changed: 11 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
46 | 46 | | |
47 | 47 | | |
48 | 48 | | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
49 | 60 | | |
50 | 61 | | |
51 | 62 | | |
| |||
0 commit comments