Show USB serial ports first with two-line port selector - #371
Merged
Merged
Conversation
Sort serial ports so USB adapters (ttyUSB/ttyACM) come before hardware ports, both in SerialTransport.list_ports() and the port dropdown. Add SerialTransport.list_port_info() providing device descriptions from pyserial, or from /dev/serial/by-id symlink names when running sandboxed. Rework SerialPortAdapter into a two-line combo row mirroring the WCS selector: device path plus a dimmed description line. A configured port that is not currently plugged in is pinned to the top of the list instead of being appended at the end.
is_usb_serial_port() treats every port as USB on non-POSIX systems, so the new sorting and port info tests must pin os.name to posix when exercising Linux-style /dev/tty* paths.
The adapter sorts via is_usb_serial_port(), which treats every port as USB on non-POSIX platforms. Patch os.name alongside the port scan so the Linux-style fixtures sort as expected on Windows.
knipknap
added a commit
that referenced
this pull request
Aug 25, 2026
Show USB serial ports first with two-line port selector
This branch was previously deployed
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.
Summary
SerialTransport.list_ports()and in the port dropdown, with natural ordering within each group (ttyUSB2 before ttyUSB10)SerialTransport.list_port_info(), which provides device descriptions from pyserial metadata on regular systems, or from/dev/serial/by-idsymlink names when running sandboxed (Snap), where pyserial cannot enumerate safelySerialPortAdapterinto a two-line combo row mirroring the WCS selector: device path on the first line, dimmed USB description (e.g. CH340) on the second. The model holds raw device paths, so no label/value mapping is neededTest plan
pixi run lintclean (ruff, flake8, pyflakes, pyright)