fix(iso15): request 1-slot inventory in scan() so UID parses correctly
scan() sent flags=0x06 (16-slot inventory). Since 16-slot became the firmware default, the device replies with an iso15_slot_result_t struct, which this parser misread as a zeroed UID (response_flags 16, uid 0000...). Set SLOT1 (0x26) to get the simple single-tag [flags][dsfid][uid] response. Use hf 15 reader --all for multi-tag anti-collision. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -27,8 +27,12 @@ class HF15Commands:
|
||||
|
||||
async def scan(self) -> dict:
|
||||
"""Scan for ISO15693 tags using inventory command."""
|
||||
# ISO15693 inventory: flags=0x06 (high data rate + inventory), cmd=0x01
|
||||
iso_cmd = bytes([0x06, 0x01, 0x00]) # flags, inventory cmd, mask_len=0
|
||||
# ISO15693 inventory: flags=0x26 (high data rate + inventory + 1-slot), cmd=0x01.
|
||||
# SLOT1 (0x20) is required: without it the firmware runs a 16-slot anti-collision
|
||||
# round and replies with an iso15_slot_result_t struct, not [flags][dsfid][uid],
|
||||
# so this parser would read the struct header as a zeroed UID. 1-slot gives the
|
||||
# simple single-tag response this method expects. Use hf 15 reader --all for many.
|
||||
iso_cmd = bytes([0x26, 0x01, 0x00]) # flags, inventory cmd, mask_len=0
|
||||
flags = ISO15_CONNECT | ISO15_READ_RESPONSE | ISO15_APPEND_CRC
|
||||
payload = struct.pack("<BH", flags, len(iso_cmd)) + iso_cmd
|
||||
resp = await self._t.send_ng(Cmd.HF_ISO15693_COMMAND, payload, timeout=5.0)
|
||||
|
||||
Reference in New Issue
Block a user