Repository navigation
shearwater_predator_parser: gate GTR-mode sidemount detection by log version - #144
Merged
mikeller merged 1 commit intoOct 15, 2026
Conversation
…version In LOG_RECORD_OPENING_4, the GTR (Gas Time Remaining) mode byte at offset 29 was read unconditionally, while the adjacent AI (Air Integration) mode byte at offset 28 is read only for logversion >= 7. For logversion < 7 (pre-Perdix AI logs), offset 29 is not part of any documented field and could contain arbitrary data, risking a spurious DC_TANK_USAGE_SIDEMOUNT classification from popcount(gtrmode) >= 2. Evidence for the gate: - Shearwater's "SRIAppLayer - Log File Formats" document (log upload protocol spec) describes GTR Mode's "prior to Log Version 13" value set (0 = disabled, 1 = T1, 2 = T2) as structurally identical to AI Mode's pre-13 value set, and GTR is explicitly computed from the T1/T2 wireless air-integration transmitters, so it cannot be meaningful before AI support exists. - libdc's own code consistently gates every AI-dependent field (aimode at offset 28, dive-sample tank pressure, battery type reporting) with `logversion >= 7`, with the tank-pressure gate commented "introduced for Perdix AI". No source states in so many words "GTR Mode introduced in log version 7"; the conclusion is inferred from the matching pre-13 value scheme and GTR's dependency on AI transmitter data, which is the same reasoning basis used for the existing aimode gate. Given that, this change reuses the same `logversion >= 7` condition that already guards the aimode read, rather than inventing a separate threshold. Behaviour is unchanged for logversion >= 7 (including all versions that can actually produce a sidemount configuration, which needs the multi-bit combinations introduced in version 13). Logs with logversion < 7 (and the logversion == 0 default used before the opening record is seen) no longer read offset 29 or assign DC_TANK_USAGE_SIDEMOUNT from it. No change to the popcount(gtrmode) >= 2 rule, tank indexing, or any other backend. Signed-off-by: Michael Keller <github@ike.ch>
2 of 6 tasks
mikeller
marked this pull request as ready for review
October 13, 2026 11:28
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.
In LOG_RECORD_OPENING_4, the GTR (Gas Time Remaining) mode byte at
offset 29 was read unconditionally, while the adjacent AI (Air
Integration) mode byte at offset 28 is read only for logversion >= 7.
For logversion < 7 (pre-Perdix AI logs), offset 29 is not part of any
documented field and could contain arbitrary data, risking a spurious
DC_TANK_USAGE_SIDEMOUNT classification from popcount(gtrmode) >= 2.
Evidence for the gate:
protocol spec) describes GTR Mode's "prior to Log Version 13" value
set (0 = disabled, 1 = T1, 2 = T2) as structurally identical to AI
Mode's pre-13 value set, and GTR is explicitly computed from the T1/T2
wireless air-integration transmitters, so it cannot be meaningful
before AI support exists.
(aimode at offset 28, dive-sample tank pressure, battery type
reporting) with
logversion >= 7, with the tank-pressure gatecommented "introduced for Perdix AI".
No source states in so many words "GTR Mode introduced in log version
7"; the conclusion is inferred from the matching pre-13 value scheme
and GTR's dependency on AI transmitter data, which is the same
reasoning basis used for the existing aimode gate. Given that, this
change reuses the same
logversion >= 7condition that already guardsthe aimode read, rather than inventing a separate threshold.
Behaviour is unchanged for logversion >= 7 (including all versions
that can actually produce a sidemount configuration, which needs the
multi-bit combinations introduced in version 13). Logs with
logversion < 7 (and the logversion == 0 default used before the
opening record is seen) no longer read offset 29 or assign
DC_TANK_USAGE_SIDEMOUNT from it.
No change to the popcount(gtrmode) >= 2 rule, tank indexing, or any
other backend.