mirror of
https://github.com/maziggy/bambuddy.git
synced 2026-10-09 23:45:40 +02:00
Fix Read Tag diagnostic failing on NTAG tags
The read_tag.py diagnostic script had stale PN5180 NTAG methods: TX CRC was off (should be on), no Crypto1 clear, no IDLE→TRANSCEIVE state reset. Multi-batch reads failed because the PN5180 enters an unrecoverable state after an NTAG READ — requires a full GPIO hardware reset between 4-page batches. Also rejected SAK 0x04 as unsupported, and failed hard when reading past the end of smaller tags (MIFARE Ultralight has 16 pages vs NTAG's 44+). Synced write methods with daemon.
This commit is contained in:
@@ -423,6 +423,10 @@ class PN5180:
|
||||
rx_status = self.read_reg(0x13)
|
||||
rx_len = rx_status & 0x1FF
|
||||
if rx_len < 16:
|
||||
# Tag may have fewer pages than requested (e.g. MIFARE Ultralight
|
||||
# has only 16 pages). Return what we have so far.
|
||||
if result:
|
||||
return bytes(result)
|
||||
print(f" NTAG read page {start_page + pages_read}: rx_len={rx_len} (expected >=16)")
|
||||
return None
|
||||
|
||||
|
||||
Reference in New Issue
Block a user