Add USB camera and uhubctl support for new test suite. Also included some bug fixes#10204
Merged
Conversation
Contributor
There was a problem hiding this comment.
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
uhubctlintegration (config, parser, MCP tools) plus a newtests/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_screenMCP tool, and a newtests/ui/tier with HTML report artifacts. - Fix a firmware crash on admin-injected input events by ensuring
InputEvent.sourceis 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. |
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>
3 tasks
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>
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.