Skip to content

fix: Handle preOS Serial Over Lan correctly#28

Open
adrianlasota wants to merge 1 commit into
mainfrom
windows_boot_manager
Open

fix: Handle preOS Serial Over Lan correctly#28
adrianlasota wants to merge 1 commit into
mainfrom
windows_boot_manager

Conversation

@adrianlasota
Copy link
Copy Markdown
Contributor

This pull request enhances the selection parsing logic in the SolConnection class by introducing a more robust ANSI terminal parsing mechanism, improving compatibility with various boot manager outputs. It also adds comprehensive unit tests to cover new and legacy selection scenarios, ensuring the reliability of the new logic.

Selection parsing improvements:

  • Replaced the old regex-based selection parsing in _parse_selection with a new approach using the ansiterm.Ansiterm class, which interprets ANSI terminal output and accurately identifies selected options based on cursor markers and background colors. This improves compatibility with outputs like Windows Boot Manager and other boot menus.
  • Added a _parse_selection_regex_fallback static method to maintain backward compatibility with legacy SOL flows, using regex as a fallback when ANSI parsing does not yield results.

Imports and utility usage:

  • Updated imports in mfd_connect/sol.py to include the new ANSI terminal utilities and constants (ansiterm, BLACK_BACKGROUND_COLOR, ANSITERM_COLS_SIZE, and ANSITERM_ROWS_SIZE) needed for the new parsing logic.
  • Added missing import for SerialKeyCode in the test file to support key sending tests.

Unit test coverage:

  • Expanded unit tests in test_sol.py to cover:
    • The new ANSI parsing logic for selection extraction, including Windows Boot Manager and legacy highlight scenarios.
    • The regex fallback method for both blue and grey background selections.
    • Additional behaviors such as buffer clearing, key sending, connection retries, and error handling on initialization. [1] [2]

Copilot AI review requested due to automatic review settings May 14, 2026 18:46
@adrianlasota adrianlasota changed the title Fix handling of preOS Serial Over Lan fix: Handle preOS Serial Over Lan correctly May 14, 2026
@mfd-intel-bot
Copy link
Copy Markdown
Contributor

We don't publish DEVs .whl.
To build .whl, run 'pip install git+https://github.com/intel/mfd-connect@windows_boot_manager'

@coveralls-official
Copy link
Copy Markdown

coveralls-official Bot commented May 14, 2026

Coverage Status

coverage: 79.097% (+0.9%) from 78.209% — windows_boot_manager into main

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Improves SOL (Serial Over LAN) pre-OS boot menu selection detection by switching from regex-only parsing to ANSI terminal state parsing, with a regex fallback for legacy outputs, and expands unit tests to cover the new scenarios.

Changes:

  • Reworked SolConnection._parse_selection to use an ANSI terminal model (ansiterm.Ansiterm) to detect the selected boot entry via cursor markers (>) and highlight colors.
  • Added _parse_selection_regex_fallback to preserve legacy behavior when ANSI parsing doesn’t yield a selection.
  • Expanded unit tests for selection parsing and various SOL behaviors (buffer clearing, key sending, init errors, retry behavior).

Reviewed changes

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

File Description
mfd_connect/sol.py Replaces selection parsing with ANSI-terminal-based logic and adds a regex fallback parser.
tests/unit/test_mfd_connect/test_sol.py Adds/expands unit tests for SOL behaviors and the updated selection parsing paths.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread mfd_connect/sol.py
Comment thread tests/unit/test_mfd_connect/test_sol.py Outdated
@adrianlasota adrianlasota force-pushed the windows_boot_manager branch 2 times, most recently from ea91d75 to ead772a Compare May 18, 2026 14:55
Comment thread mfd_connect/sol.py Outdated
@adrianlasota adrianlasota force-pushed the windows_boot_manager branch from ead772a to 8e6b149 Compare May 19, 2026 10:26
@adrianlasota adrianlasota requested a review from mchromin May 19, 2026 10:26
Signed-off-by: Lasota, Adrian <adrian.lasota@intel.com>
@adrianlasota adrianlasota force-pushed the windows_boot_manager branch from 8e6b149 to 826de18 Compare May 22, 2026 12:38
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.

4 participants