You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit c9e5832
Browse filesBrowse the repository at this point in the historyBrowse files
fix(protocol): correct forceTrim body, complete gen5 brick set, flag frame-rev-2
Three verified, low-risk protocol-safety fixes:
1. forceTrim (0x19) comment was wrong. It claimed the body is "two LE i32
range args (full erase = both 0xFEFEFEFE)". It isn't: the body is
[u32 trim_page][u32 wrap_count] — the same 8 bytes as the HISTORY_END
trim token — not a range/erase. Comment corrected; the false 0xFEFEFEFE
claim dropped.
2. dangerousCmds vs OpcodeSafety disconnect. dangerousCmds (the ENFORCED
never-send set) listed only startUpdateLoad/loadUpdateData/
processUpdateImage = 0x24-0x26, but on gen5 those opcode numbers are
NOT IMPLEMENTED — a gen5 strap does not act on them. The gen5 device-update
trio is 0x8E/0x8F/0x90 (142/143/144), which lived only in
OpcodeSafety.destructive — a classification set that enforces nothing.
Added 0x8E/0x8F/0x90 to dangerousCmds so they are actually refused, and
tightened comments: 0x24-0x26 are gen4-empirical/unverified numbering
(kept, not deletable), 0x8E-0x90 are the gen5 device-update trio, and
OpcodeSafety.destructive is classification-only / self-enforces nothing.
3. Frame rev-2 hardening. Frame.packetType/seq/opcode read inner[0]/[1]/[2],
assuming rev-1 layout. The gen5 header carries a frame-revision byte at
header[1] (0x01 on every real strap frame; see BandProfile.buildHeader);
a rev-2 frame stamps 0x02 there, passes both CRCs, yet shifts those field
offsets so opcode would silently return a body byte. parseFrame now sets
Frame.frameRevOk=false for a gen5 non-rev-1 frame and exposes
Frame.decodable (valid && frameRevOk) so callers surface it rather than
mis-decode. Non-breaking: gen4 has no revision byte and is always rev-1;
frameRevOk defaults true.
Tests: +5 (dangerousCmds membership incl. 0x8E/0x8F/0x90; gen5 rev-2 frame is
CRC-valid but flagged non-decodable; gen4 always rev-1). dart test 164 pass /
4 skip, dart analyze clean.
Also drops two stale doc pointers that reference material not present in
this package (commands.dart, gen5_records.dart).
Also renames the 0x24-0x26 constants to neutral device-update names
(startUpdateLoad/loadUpdateData/processUpdateImage); they are package-internal
and nothing outside this repo referenced them.
0 commit comments