fix: Handle preOS Serial Over Lan correctly#28
Open
adrianlasota wants to merge 1 commit into
Open
Conversation
Contributor
|
We don't publish DEVs .whl. |
b07ef66 to
f5090ed
Compare
There was a problem hiding this comment.
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_selectionto use an ANSI terminal model (ansiterm.Ansiterm) to detect the selected boot entry via cursor markers (>) and highlight colors. - Added
_parse_selection_regex_fallbackto 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.
ea91d75 to
ead772a
Compare
mchromin
requested changes
May 19, 2026
ead772a to
8e6b149
Compare
mchromin
approved these changes
May 19, 2026
Signed-off-by: Lasota, Adrian <adrian.lasota@intel.com>
8e6b149 to
826de18
Compare
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.
This pull request enhances the selection parsing logic in the
SolConnectionclass 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:
_parse_selectionwith a new approach using theansiterm.Ansitermclass, 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._parse_selection_regex_fallbackstatic 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:
mfd_connect/sol.pyto include the new ANSI terminal utilities and constants (ansiterm,BLACK_BACKGROUND_COLOR,ANSITERM_COLS_SIZE, andANSITERM_ROWS_SIZE) needed for the new parsing logic.SerialKeyCodein the test file to support key sending tests.Unit test coverage:
test_sol.pyto cover: