Description
Shearwater dive computers (e.g. Perdix 2) with firmware version 100 or higher display the firmware version incorrectly in Subsurface's Extra Info tab. Instead of showing the decimal firmware version (e.g. 100, 102), it shows the raw hex BCD-encoded byte value (e.g. a0, a2).
Background: This was first discussed in #4537, which tracked a related connection failure for Perdix 2 on firmware v100 (fixed in libdivecomputer). The firmware version display issue in the parser was noted as a separate follow-up there.
The firmware version is stored as a BCD (Binary-Coded Decimal) encoded byte in the dive log data (byte 19 of the Shearwater parser). BCD normally represents values 0–99 cleanly. When Shearwater reached firmware v100, the high nibble exceeded the standard BCD range — 0xA0 = v100, 0xA1 = v101, 0xA2 = v102, etc. The current code formats this byte as raw hex (%2x), causing it to display as a0 or a2 instead of 100 or 102.
Subsurface Version
- macOS: 6.0.5605
- iOS: 6.0.5581
Platform(s)
Platform Version
Divecomputer Model
Shearwater Perdix 2
Steps to Reproduce
- Connect a Shearwater Perdix 2 running firmware v100 or later
- Download dives in Subsurface
- Open the Extra Info tab for any dive
- Observe the FW Version field shows
a0 (for v100) or a2 (for v102) instead of the correct decimal value
Proposed Fix
In shearwater_predator_parser.c, decode the BCD byte properly instead of printing as raw hex:
dc_field_add_string_fmt(&parser->cache, "FW Version", "%u", bcd2dec(data[19]));
Suggested by @jefdriesen in #4537. Note that @mikeller was waiting for Shearwater to clarify the exact encoding, but the general BCD decoding approach is likely correct.
References
Mentions
@jefdriesen @mikeller
Description
Shearwater dive computers (e.g. Perdix 2) with firmware version 100 or higher display the firmware version incorrectly in Subsurface's Extra Info tab. Instead of showing the decimal firmware version (e.g.
100,102), it shows the raw hex BCD-encoded byte value (e.g.a0,a2).Background: This was first discussed in #4537, which tracked a related connection failure for Perdix 2 on firmware v100 (fixed in
libdivecomputer). The firmware version display issue in the parser was noted as a separate follow-up there.The firmware version is stored as a BCD (Binary-Coded Decimal) encoded byte in the dive log data (byte 19 of the Shearwater parser). BCD normally represents values 0–99 cleanly. When Shearwater reached firmware v100, the high nibble exceeded the standard BCD range —
0xA0= v100,0xA1= v101,0xA2= v102, etc. The current code formats this byte as raw hex (%2x), causing it to display asa0ora2instead of100or102.Subsurface Version
Platform(s)
Platform Version
Divecomputer Model
Shearwater Perdix 2
Steps to Reproduce
a0(for v100) ora2(for v102) instead of the correct decimal valueProposed Fix
In
shearwater_predator_parser.c, decode the BCD byte properly instead of printing as raw hex:Suggested by @jefdriesen in #4537. Note that @mikeller was waiting for Shearwater to clarify the exact encoding, but the general BCD decoding approach is likely correct.
References
Mentions
@jefdriesen @mikeller