Skip to content

Read the firmware version of a v6/v7 .md as the string it is - #61

Open
lgnap wants to merge 1 commit into
antoinevalentinHA:masterfrom
lgnap:fix/issue-17-firmware-version-parse
Open

lgnap wants to merge 1 commit into
antoinevalentinHA:masterfrom
lgnap:fix/issue-17-firmware-version-parse

Conversation

@lgnap

@lgnap lgnap commented Sep 11, 2026

Copy link
Copy Markdown

What

parseDeviceInfosMeta6to7 read the firmware version as one digit for the major, one skipped byte, one digit for the minor. On a real v7 card the field is a NUL-terminated ASCII string in a 6-byte slot — 3.2.3\0 (see FORMATS.md §2, #59) — so the patch level was dropped, and a firmware 3.10.x would have come back as 3.1, 10.0.x as 1.0. Harmless today, since the version is only displayed; exactly the kind of thing that bites the day code decides something from it.

The field is now read whole and split on dots. Major and minor keep their meaning; FsDeviceInfos exposes the full string, which StoryTellerService reports to the UI when present (the v1–3 path is untouched and still reports major.minor). The serial and the key material keep their offsets — the skip shrinks by what the read grew. A field without two components fails as a truncated .md already did. The two digit-only helpers this leaves unused are removed.

Tests

DeviceMetadataCharacterizationTest gains a fixture that writes the firmware field whole, and two tests: 3.2.3\0 → 3.2 / "3.2.3", 3.10.1 → 3.10, 10.0.0 → 10.0, 3.3 (the old fixture shape) → 3.3; and the serial / key / IV read from the same bytes as before. The existing tests, including the truncated-.md one, pass unchanged.

Locally: mvn … test → 332 run, 0 failures (39 FAT32 opt-in skips). git diff --exit-code clean.

Tracked in lgnap#17.

🤖 Generated with Claude Code

The field is a NUL-terminated ASCII string in a 6-byte slot — "3.2.3\0"
on a real v7 card (FORMATS.md §2). The parser took one digit for the
major, skipped a byte, took one digit for the minor: the patch level was
dropped, and a firmware "3.10.x" would have come back as 3.1, "10.0.x"
as 1.0. Harmless today, since the version is only displayed, and exactly
the kind of thing that bites the day code decides something from it.

The field is now read whole and split on dots; major and minor keep
their meaning, and FsDeviceInfos exposes the full string, which the
service reports to the UI when present. The serial and the key material
keep their offsets (the skip shrinks by what the read grew). A field
without two components fails as a truncated .md did before. The two
digit-only helpers this leaves unused are removed.

Closes #17

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant