fix: handle OSError and macOS port detection for NanoVNA V2 - #848
Open
chihyunan wants to merge 1 commit into
Open
fix: handle OSError and macOS port detection for NanoVNA V2#848chihyunan wants to merge 1 commit into
chihyunan wants to merge 1 commit into
Conversation
- Wrap LiteVNA64.is_lite_vna_64() call in try/except OSError to prevent crash on startup during port scanning - Extend _fix_v2_hwinfo() to also apply on macOS (Darwin), not just Windows, so devices enumerating as DEMO with vid=None are correctly detected Verified on macOS [your version] with NanoVNA V2.
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.
Pull Request type
What is the current behavior?
On macOS with a NanoVNA V2, two bugs prevent the app from working:
On startup,
LiteVNA64.is_lite_vna_64()throws an unhandledOSErrorduring port scanning, crashing the app before the UI opens. It opens fine
when no port is connected, but the fix below ensures opening regardless.
get_interfaces()only applied_fix_v2_hwinfo()on Windows. On macOSthe V2 enumerates with
vid=Noneand hwid containingDEMO, so it wassilently filtered out and no device was ever detected on port scan.
Issue Number: N/A
What is the new behavior?
detect_version()now wrapsLiteVNA64.is_lite_vna_64()intry/except OSError, falling back to"v2"on failure. No behaviorchange on Windows/Linux where the call succeeds normally. This ensures
that the program will execute even when port is already connected.
get_interfaces()now applies_fix_v2_hwinfo()on both Windows andmacOS (
Darwin). The fix is safe on macOS because_fix_v2_hwinfo()only modifies a device if its hwid contains the string
PORTS\VID_04B4&PID_0008, which is a Windows-style path that will neverappear on Linux, leaving that platform's behavior unchanged. Now port scan
works on MacOS correctly.
Does this introduce a breaking change?
Other information
Tested on macOS [Tahoe 26.3] with NanoVNA V2 (SAA-2). App now
launches and detects the device successfully. Both fixes are isolated to
Hardware/Hardware.pywith minimal diff.