feat(lf): test-mode T55xx write (opcode 01) for recovery
Add a `test` flag to lf.t55.writebl that sets the firmware test-mode bit, sending the datasheet's opcode-01 reconfiguration write (§5.10.3) instead of the standard opcode-10 write. This is the path that can rewrite a tag a normal write can't (corrupted/locked config), when the master key still permits it. Matches the C client's `lf t55 write -t`. Default off; routine writes are unaffected. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -57,6 +57,17 @@ def test_lf_t55_writebl():
|
||||
# PwdMode(0x01) | Page(0x02) | downlink 2<<3 (0x10) = 0x13
|
||||
assert flags == 0x13
|
||||
|
||||
def test_lf_t55_writebl_testmode():
|
||||
t = AsyncMock()
|
||||
lf = LFCommands(t)
|
||||
t.send_ng.return_value = make_response(Cmd.LF_T55XX_WRITEBL, 0, b"")
|
||||
asyncio.get_event_loop().run_until_complete(
|
||||
lf.t55.writebl(block=0, data=0x00148040, test=True))
|
||||
_, _, blockno, flags = struct.unpack("<IIBB", t.send_ng.call_args.args[1])
|
||||
assert blockno == 0
|
||||
assert flags & 0x04 # test-mode bit set (downlink opcode 01)
|
||||
assert not (flags & 0x01) # no password mode by default
|
||||
|
||||
def test_lf_t55_wakeup():
|
||||
t = AsyncMock()
|
||||
lf = LFCommands(t)
|
||||
|
||||
Reference in New Issue
Block a user