fix(params): decode ProcessData descriptor Length per Table B.6#12
Merged
Conversation
The ProcessData In/Out descriptor (Direct Parameter Page 1, Figure B.5) carries Length in bits 0-4 only; bit 6 is SIO and bit 7 is BYTE. The decoder masked the whole byte, so a device that legally sets the SIO bit had its PD length corrupted, and BYTE=0 sub-byte lengths were truncated by integer division instead of rounded up. Mask to bits 0-4 and round bit lengths up to whole octets, matching Table B.6. Also documents the V1.1.5 conformance audit in IMPLEMENTATION_STATUS.md: field encodings are conformant; the startup/OPERATE-transition octets (should be MC=0xA2 read then MasterCommand 0x99) and the ISDU I-Service nibble (Table A.12) are known co-designed deviations from the device stack, pending a coordinated change. New parameter test covers SIO-bit and sub-byte descriptors. 14/14 ctest, strict compile, and cppcheck green.
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.
Part of a V1.1.5 spec-conformance audit. This is the one deviation that is safe to fix in isolation (it only affects decoding a device-reported descriptor — no wire-protocol/interop change).
Bug
The ProcessData In/Out descriptor (Direct Parameter Page 1, Figure B.5) carries Length in bits 0-4 only; bit 6 is SIO, bit 7 is BYTE. The decoder masked the whole byte (
& 0x7F//8), so:0xC3→ 68 octets instead of 4);Fix
Mask Length to bits 0-4 and round bit lengths up to whole octets, per Table B.6. All existing byte-aligned descriptors decode identically; new test covers the SIO-bit and sub-byte cases.
Audit context (documented, not fixed here)
docs/IMPLEMENTATION_STATUS.mdnow records the full audit. Field encodings (MinCycleTime B.3, Direct Parameter B.1, M-seqCapability B.3, MC octet A.1/A.2) are conformant. Two co-designed deviations remain and need a coordinated master+device change (they'd break the on-wire model until both land):MC=0xA2(read MinCycleTime) then MasterCommand0x99"DeviceOperate" on the page channel — not a bare0x0F;0x9/0xA/0xB(read) /0x1/0x2/0x3(write) per Table A.12 — not0x08/0x09.14/14 ctest (incl. new Table B.6 test), strict compile, cppcheck green.