fix: resolve UART disconnect/reconnection detection failures#43
Merged
wizzomafizzo merged 2 commits intomainfrom Feb 7, 2026
Merged
fix: resolve UART disconnect/reconnection detection failures#43wizzomafizzo merged 2 commits intomainfrom
wizzomafizzo merged 2 commits intomainfrom
Conversation
Fix multiple bugs that prevented reliable detection of PN532 UART device disconnection and reconnection: - Clear stale detection cache when no devices found, and filter cached results through IgnorePaths/Blocklist (previously bypassed on cache hit) - Add device existence check before returning synthetic "no tags" response in receiveFrame, preventing disconnect masking for one poll cycle - Add DeviceHealthChecker interface and check device health after failed hard reset on NoACK errors, eliminating a wasted poll cycle - Add disconnected flag to UART transport so IsConnected() returns false after device-gone is detected during I/O - Wrap port.Read errors as TransportError with proper ErrorType so IsFatal() can classify them without relying on serial library internals - Export IsDeviceGoneError for cross-package use
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
- UART: tests for wrapReadError (transient + device-gone), CheckHealth (healthy, already-disconnected, device-file-gone), IsConnected with disconnected flag, handleWriteError with OS-level EIO, markDisconnected, checkDeviceExists setting disconnected flag - Polling: test for checkDeviceHealth with nil device
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
receiveFrame, preventing disconnect from being masked for one poll cycleDeviceHealthCheckerinterface; check device health after failed hard reset on NoACK, eliminating a wasted poll cycle before disconnect is recognizedIsConnected(): adddisconnectedflag set on device-gone detection during I/O, soIsConnected()returns false immediately after unplugport.Readerrors asTransportErrorwith properErrorTypesoIsFatal()classifies them without relying on serial library error internalsIsDeviceGoneError: make it available for cross-package useTest plan
make checkpasses (lint + tests with race detection + deadlock check)IsDeviceGoneErrorexport