Handle 5-byte Modbus exception frames without false “malformed packet” errors in state 7#18
Draft
Copilot wants to merge 6 commits into
Draft
Handle 5-byte Modbus exception frames without false “malformed packet” errors in state 7#18Copilot wants to merge 6 commits into
Copilot wants to merge 6 commits into
Conversation
Agent-Logs-Url: https://github.com/bbr111/python-bydhvs/sessions/89807568-498c-413a-9058-daaf24f1ddc3 Co-authored-by: bbr111 <46243805+bbr111@users.noreply.github.com>
Agent-Logs-Url: https://github.com/bbr111/python-bydhvs/sessions/89807568-498c-413a-9058-daaf24f1ddc3 Co-authored-by: bbr111 <46243805+bbr111@users.noreply.github.com>
Agent-Logs-Url: https://github.com/bbr111/python-bydhvs/sessions/89807568-498c-413a-9058-daaf24f1ddc3 Co-authored-by: bbr111 <46243805+bbr111@users.noreply.github.com>
Agent-Logs-Url: https://github.com/bbr111/python-bydhvs/sessions/89807568-498c-413a-9058-daaf24f1ddc3 Co-authored-by: bbr111 <46243805+bbr111@users.noreply.github.com>
Agent-Logs-Url: https://github.com/bbr111/python-bydhvs/sessions/89807568-498c-413a-9058-daaf24f1ddc3 Co-authored-by: bbr111 <46243805+bbr111@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix invalid CRC or malformed packet in state 7 error
Handle 5-byte Modbus exception frames without false “malformed packet” errors in state 7
May 19, 2026
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.
A single-tower LVS setup can return a 5-byte Modbus exception response during state 7 polling, which was being reported as
Invalid CRC or malformed packet ... (len=5). This PR treats that frame as a valid protocol exception instead of a malformed packet.Protocol-aware exception frame handling
_is_modbus_exception_response(data, request)to recognize valid Modbus exception packets (address,function|0x80,exception_code,crc).MODBUS_EXCEPTION_PACKET_LENGTH,MIN_MODBUS_REQUEST_LENGTH,MODBUS_EXCEPTION_FLAG).State read-path behavior update
_send_and_receive(...), when a valid exception frame is detected:Guardrails for false positives