Skip to content

feat(mcp266 web): VID-only filter + dispatcher module-presence check - #770

Merged
finger563 merged 3 commits into
mainfrom
feat/mcp266-web-module-detect
Sep 5, 2026
Merged

feat(mcp266 web): VID-only filter + dispatcher module-presence check#770
finger563 merged 3 commits into
mainfrom
feat/mcp266-web-module-detect

Conversation

@finger563

Copy link
Copy Markdown
Contributor

Bring the mcp266 WebUSB/Web-Serial console (dispatcher module 6) in line with the other espp dispatcher-module consoles.

1. Accept any espp device

Default device filter is now VID-only ({filters:[{vendorId:0x1209}]}) instead of VID+PID; "show all devices" uses {filters:[{}]}. Removes the invalid {acceptAllDevices:true} (a Web Bluetooth option that throws "Required member filters is undefined" on WebUSB, so "show all" never worked).

2. Module-presence check

On connect, the console sends a ListModules query on the reserved discovery module (0xFF) and warns (non-blocking) if the MCP266 module (6) isn't advertised, then continues. Firmware without the discovery module never replies and is tolerated silently (800 ms timeout).

buildFrame() gains an optional module argument so it can emit the 0xFF query; both transports' send() return promises so the probe's error handling works on WebUSB and Web Serial alike. Passes a JS parse check.

🤖 Generated with Claude Code

Bring the mcp266 WebUSB/Web-Serial console in line with the other espp
dispatcher-module consoles:
- default device filter is now VID-only (any espp device, VID 0x1209) instead
  of VID+PID; "show all devices" uses {filters:[{}]} (the invalid
  acceptAllDevices, a Web Bluetooth option, is removed -- it throws "Required
  member filters is undefined" on WebUSB).
- on connect the console queries the reserved dispatcher discovery module
  (0xFF ListModules, reusing Dispatcher::describe's TLV) and warns if the
  MCP266 module (6) is not advertised, then continues anyway; firmware without
  the discovery module simply never replies and is tolerated silently.

buildFrame() gains an optional module arg so it can emit the 0xFF query.

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

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

Aligns the MCP266 WebUSB/Web Serial console with other espp dispatcher-module consoles by broadening device selection and adding a best-effort dispatcher discovery probe on connect.

Changes:

  • Switch WebUSB device filtering from VID+PID to VID-only; replace the invalid acceptAllDevices option with a “show all devices” filter.
  • Add a dispatcher module discovery probe (0xFF / ListModules) to warn (non-blocking) when module 6 isn’t advertised.
  • Extend buildFrame() to support emitting frames for modules other than the MCP266 module.

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

Comment thread components/mcp266/web/mcp266_console.html Outdated
Comment thread components/mcp266/web/mcp266_console.html Outdated
Comment thread components/mcp266/web/mcp266_console.html Outdated
Comment thread components/mcp266/web/mcp266_console.html Outdated
Comment thread components/mcp266/web/mcp266_console.html Outdated
@github-actions

github-actions Bot commented Sep 4, 2026

Copy link
Copy Markdown

✅Static analysis result - no issues found! ✅

…imeout

- checkModulePresent(): guard the shared discoveryResolve with a settle() so a
  stale probe's 800ms timeout can't cancel a newer probe's resolver.
- pull the 800ms magic number into a named DISCOVERY_TIMEOUT_MS constant.
- fire-and-forget call now has .catch(() => {}) (no unhandled rejection).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

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.

🔵 Needs a closer look

The disconnected UI still documents the removed PID filter and must reflect the new VID-only behavior.

Review details

Suppressed comments (1)

Previously missed (1) — in code that hasn't changed since the last review.

components/mcp266/web/mcp266_console.html:249

  • The filter is now VID-only, but the disconnected UI still tells users twice that the default is VID 0x1209 / PID 0x0d32 (lines 123 and 510), and DEFAULT_PID is consequently unused. Please update both messages to describe the VID-only chooser and remove the stale PID constant so the console does not contradict its actual behavior.
  • Files reviewed: 1/1 changed files
  • Comments generated: 0 new
  • Review effort level: Balanced

- requestUsbDevice(): "show all" uses an empty filter {} with a VID-only
  fallback if a WebUSB impl rejects it (addresses the review note directly).
- log the missing-module message under a non-fatal "warn" tier (.warn).
Matches the ota/coredump/haptics/canopen consoles.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@finger563
finger563 merged commit e2cecfa into main Sep 5, 2026
13 of 14 checks passed
@finger563
finger563 deleted the feat/mcp266-web-module-detect branch September 5, 2026 03:09
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