WebUSB Support#114
Draft
pd0wm wants to merge 2 commits into
Draft
Conversation
- Make CanAdapter::send/recv async so async-only transports (WebUSB) and blocking ones (rusb/SocketCAN) share one trait. AsyncCanAdapter drives adapters on a dedicated thread (block_on) natively and via spawn_local on wasm. - Add a generic UsbBackend trait with RusbBackend (native) and WebUsbBackend (wasm) impls; port the panda onto it (Panda<B>). - Decouple USB transport from adapter: rusb-backend / webusb backend features, independent of adapters. panda implies rusb-backend so --features panda is unchanged; panda-over-WebUSB is --features panda,webusb. rusb is a not(wasm) target dependency. isotp/uds gated out of the wasm build. Adds a Trunk demo. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Port the PEAK PCAN-USB FD adapter onto the UsbBackend trait (Peak<B>) so it works over WebUSB in the browser as well as rusb natively. Generalizes the trait: control transfers take a request type + recipient (PEAK uses Vendor/Other), write_bulk returns the written byte count (short-write requeue), and read_bulk reports a timeout as an empty read so adapters stay backend-agnostic. RusbBackend auto-detaches the kernel driver on open. The web demo gains a second button to connect to a PEAK adapter, and scripts/release_peak_usb.sh unbinds the in-kernel peak_usb driver (WebUSB cannot detach kernel drivers) so a browser can claim the device on Linux. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.
No description provided.