Skip to content

fix(odrive web): valid WebUSB "any device" filter + VID-only default - #771

Merged
finger563 merged 1 commit into
mainfrom
fix/odrive-web-console-webusb-filter
Sep 4, 2026
Merged

fix(odrive web): valid WebUSB "any device" filter + VID-only default#771
finger563 merged 1 commit into
mainfrom
fix/odrive-web-console-webusb-filter

Conversation

@finger563

Copy link
Copy Markdown
Contributor

The odrive WebUSB consoles used {acceptAllDevices:true} for the "any device" path, but acceptAllDevices is a Web Bluetooth option and is invalid for WebUSB — requestDevice throws "Required member filters is undefined", so "show all devices" never worked.

  • Use {filters:[{}]} (a single empty filter matches every device).
  • Make the default filter VID-only so any espp device (VID 0x1209) is offered, not just the ODrive PID — consistent with the other espp web consoles.
  • Updated the misleading comment and the "Default filter" status line.

Affects odrive_webusb_console.html and odrive_control_panel.html. The Web Serial console (odrive_console.html) and the WebHID visualizer (hid_visualizer.html) use different APIs and are unaffected. These consoles speak the ODrive ASCII protocol (no dispatcher module), so there is no module-presence check to add.

🤖 Generated with Claude Code

The odrive WebUSB consoles used `{ acceptAllDevices: true }` for the "any
device" path, but acceptAllDevices is a Web Bluetooth option and is invalid
for WebUSB -- requestDevice throws "Required member filters is undefined", so
"show all devices" never worked. Use `{ filters: [{}] }` (a single empty
filter matches everything). Also make the default filter VID-only, so any espp
device (VID 0x1209) is offered rather than only the ODrive PID. The Web Serial
console and the WebHID visualizer are unaffected (different APIs).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Copilot AI lite review requested due to automatic review settings September 4, 2026 21:54
@finger563
finger563 merged commit 7cbe97d into main Sep 4, 2026
14 of 15 checks passed
@finger563
finger563 deleted the fix/odrive-web-console-webusb-filter branch September 4, 2026 21:58

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Warning

Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.

Pull request overview

Fixes WebUSB device selection in the ODrive web consoles by replacing an invalid “any device” option and broadening the default match criteria to improve device discoverability.

Changes:

  • Replace the invalid acceptAllDevices (Web Bluetooth) usage with a WebUSB-valid “match all” filter (filters: [{}]).
  • Change the default filter from VID+PID to VID-only (vendorId: DEFAULT_VID) so more devices under that VID appear.
  • Update inline comments and the “Default filter” status line to reflect the new behavior.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.

File Description
components/odrive_ascii/web/odrive_webusb_console.html Fix WebUSB requestDevice options; adjust default filter and user-facing status text.
components/odrive_ascii/web/odrive_control_panel.html Same WebUSB requestDevice fix and default filter change; update status text accordingly.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines 1459 to +1460
logLine("sys", "Ready. Click Connect and pick the ODrive native (vendor) USB device.");
logLine("sys", `Default filter: VID 0x${DEFAULT_VID.toString(16)} / PID 0x${DEFAULT_PID.toString(16)}. Tick "Any device" to see all.`);
logLine("sys", `Default filter: any espp device (VID 0x${DEFAULT_VID.toString(16)}). Tick "Any device" to see all.`);
Comment on lines 674 to 675
// 1) Ask the user to pick a device. Default filter targets the espp
// ODrive vendor VID/PID; "Any device" shows every device instead.
Comment on lines 1187 to +1188
logLine("sys", "Ready. Click Connect and pick the ODrive vendor USB device.");
logLine("sys", `Default filter: VID 0x${DEFAULT_VID.toString(16)} / PID 0x${DEFAULT_PID.toString(16)}. Tick "Any device" to see all.`);
logLine("sys", `Default filter: any espp device (VID 0x${DEFAULT_VID.toString(16)}). Tick "Any device" to see all.`);
setConnectedUI(false);
logLine("sys", "Ready. Click Connect and pick the ODrive vendor USB device.");
logLine("sys", `Default filter: VID 0x${DEFAULT_VID.toString(16)} / PID 0x${DEFAULT_PID.toString(16)}. Tick "Any device" to see all.`);
logLine("sys", `Default filter: any espp device (VID 0x${DEFAULT_VID.toString(16)}). Tick "Any device" to see all.`);
finger563 added a commit that referenced this pull request Sep 5, 2026
)

#771 was merged with only the initial VID-filter fix; two later review rounds
never reached main. This carries them over so the odrive consoles match the
other espp web consoles:
- requestUsbDevice(): the "show all devices" path uses one empty filter {} and
  falls back to a VID-only filter if a WebUSB implementation rejects the empty
  filter (the shared helper now used by every espp WebUSB console).
- reword the comments, the "Any device" tooltip, and the status lines to the
  actual filter semantics ("any device with VID 0x1209", not "ODrive VID/PID"),
  and zero-pad the VID hex.

Affects odrive_webusb_console.html and odrive_control_panel.html only.

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants