Skip to content

Add USB camera and uhubctl support for new test suite. Also included some bug fixes#10204

Merged
thebentern merged 5 commits into
masterfrom
testing-part2
Apr 19, 2026
Merged

Add USB camera and uhubctl support for new test suite. Also included some bug fixes#10204
thebentern merged 5 commits into
masterfrom
testing-part2

Conversation

@thebentern

Copy link
Copy Markdown
Contributor

No description provided.

@thebentern thebentern requested a review from Copilot April 19, 2026 11:10
@thebentern thebentern added enhancement New feature or request bugfix Pull request that fixes bugs labels Apr 19, 2026
@github-actions github-actions Bot added the needs-review Needs human review label Apr 19, 2026

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.

Pull request overview

Adds new hardware-test harness capabilities (USB hub power control via uhubctl and USB webcam/OCR-based UI verification) to the mcp-server pytest suite, with small firmware-side hooks to make UI state and admin-injected input events safe/observable.

Changes:

  • Add uhubctl integration (config, parser, MCP tools) plus a new tests/recovery/ tier and mesh “peer offline then recovers” scenario.
  • Add UI testing support: USERPREFS_UI_TEST_LOG-gated firmware frame-transition logs, webcam capture + OCR utilities, capture_screen MCP tool, and a new tests/ui/ tier with HTML report artifacts.
  • Fix a firmware crash on admin-injected input events by ensuring InputEvent.source is non-null.

Reviewed changes

Copilot reviewed 48 out of 48 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
userPrefs.jsonc Documents new USERPREFS_UI_TEST_LOG build-time flag (commented by default).
src/modules/AdminModule.cpp Sets InputEvent.source="admin" to prevent NULL %s logging crash on injected events.
src/graphics/Screen.h Adds Screen::logFrameChange() declaration behind USERPREFS_UI_TEST_LOG.
src/graphics/Screen.cpp Emits deterministic Screen: frame N/M ... logs on frame rebuilds and transitions under USERPREFS_UI_TEST_LOG.
src/detect/ScanI2C.h Removes an enum entry occurrence from the tail of DeviceType (cleanup of the enum list).
mcp-server/tests/unit/test_ui_screen_log.py Pins the Screen: frame ... log regex/parser contract.
mcp-server/tests/unit/test_uhubctl_parser.py Pins uhubctl list-output parsing against canned samples + env pinning behavior.
mcp-server/tests/unit/test_input_event_codes.py Pins Python InputEventCode values to firmware input_broker_event wire values.
mcp-server/tests/ui/test_input_node_scroll.py UI-tier test asserting node-list scroll does not cause a frame transition.
mcp-server/tests/ui/test_input_navigation.py UI-tier tests for LEFT/RIGHT frame navigation behavior.
mcp-server/tests/ui/test_input_message_scroll.py UI-tier test exercising message scroll / canned-message launch path.
mcp-server/tests/ui/test_input_menu.py UI-tier test validating SELECT opens menu overlay (OCR-diff based).
mcp-server/tests/ui/test_input_fn_oob.py UI-tier regression test for out-of-bounds FN key behavior (no UI wedge).
mcp-server/tests/ui/test_input_fn_jump.py UI-tier parametrized FN_F1..FN_F5 direct frame jump tests.
mcp-server/tests/ui/conftest.py UI-tier fixtures: camera lifecycle, OCR warmup, per-step captures, and home-state reset guard.
mcp-server/tests/ui/_screen_log.py Shared UI-tier log parser + wait/assert helpers for frame events.
mcp-server/tests/ui/init.py UI tier package marker + setup expectations.
mcp-server/tests/tool_coverage.py Instruments new tools: send_input_event, capture_screen, and uhubctl_*.
mcp-server/tests/recovery/test_power_cycle_roundtrip.py Validates identity preserved across hard power-cycle.
mcp-server/tests/recovery/test_power_cycle_preserves_userprefs.py Validates NVS config survives hard power-cycle.
mcp-server/tests/recovery/test_list_hubs.py Recovery-tier smoke tests for hub enumeration and PPPS presence.
mcp-server/tests/recovery/conftest.py Recovery-tier session guard: skip cleanly when uhubctl unavailable / unusable.
mcp-server/tests/recovery/init.py Recovery tier package marker.
mcp-server/tests/mesh/test_peer_offline_recovery.py Mesh test that power-cycles a peer mid-flow and asserts recovery.
mcp-server/tests/conftest.py Adds tier ordering (recovery/ui), enables enable_ui_log=True, adds auto power-cycle recovery + HTML UI-capture extras.
mcp-server/tests/_power.py Test helper composing uhubctl + port rediscovery for power-cycle flows.
mcp-server/src/meshtastic_mcp/userprefs.py Adds enable_ui_log to testing profile to stamp USERPREFS_UI_TEST_LOG.
mcp-server/src/meshtastic_mcp/uhubctl.py New uhubctl wrapper: list/parse, role resolution, and on/off/cycle actions.
mcp-server/src/meshtastic_mcp/server.py Registers new MCP tools: send_input_event, capture_screen, uhubctl_list/power/cycle.
mcp-server/src/meshtastic_mcp/ocr.py New OCR backend selection (easyocr/pytesseract/null) for UI tier + tool.
mcp-server/src/meshtastic_mcp/input_events.py New Python mirror enum + coercion helper for input event codes.
mcp-server/src/meshtastic_mcp/config.py Adds uhubctl_bin() tool resolver.
mcp-server/src/meshtastic_mcp/cli/test_tui.py Adds optional UI camera panel + transcript tail integration into the TUI.
mcp-server/src/meshtastic_mcp/cli/_uicap.py TUI tailer thread for UI capture transcripts.
mcp-server/src/meshtastic_mcp/camera.py New camera capture backends (opencv/ffmpeg/null) for UI tier + MCP tool.
mcp-server/src/meshtastic_mcp/admin.py Adds send_input_event() admin RPC wrapper with validation + coercion.
mcp-server/run-tests.sh Pre-flight: auto-ignore tests/ui when cv2 missing; warns when uhubctl missing.
mcp-server/pyproject.toml Adds [ui] and [ui-min] optional dependency groups.
mcp-server/README.md Documents new tools and new test tiers (recovery/ui) + setup instructions.
mcp-server/.gitignore Ignores regenerated UI capture artifacts under tests/ui_captures/.
AGENTS.md Updates repo navigation + adds uhubctl/ui env var docs (contains one incorrect claim).
.github/prompts/mcp-test.prompt.md Updates operator guidance for new skip reasons and UI capture artifacts.
.github/prompts/mcp-repro.prompt.md Adds uhubctl-based hard power-cycle guidance for wedged devices.
.github/prompts/mcp-diagnose.prompt.md Adds hub health checks via uhubctl_list and PPPS reporting.
.github/copilot-instructions.md Updates MCP tool surface docs and tier ordering (contains confirm-policy mismatch).
.claude/commands/test.md Updates pass/fail interpretation guidance for new tiers + dependencies.
.claude/commands/repro.md Adds uhubctl escalation guidance.
.claude/commands/diagnose.md Adds uhubctl hub health guidance.

Comment thread mcp-server/src/meshtastic_mcp/camera.py
Comment thread AGENTS.md Outdated
Comment thread .github/copilot-instructions.md Outdated
thebentern and others added 3 commits April 19, 2026 06:16
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@thebentern thebentern merged commit de23e51 into master Apr 19, 2026
78 checks passed
@caveman99 caveman99 deleted the testing-part2 branch June 7, 2026 20:56
Evil8it pushed a commit to Evil8it/ME4TACTNK that referenced this pull request Jun 10, 2026
…some bug fixes (meshtastic#10204)

* Add USB camera and uhubctl support for new test suite. Also added some bug fixes

* Potential fix for pull request finding

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

* Potential fix for pull request finding

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

* Potential fix for pull request finding

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

* Refactor test messages for clarity and consistency in regex tests

---------

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bugfix Pull request that fixes bugs enhancement New feature or request needs-review Needs human review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants