Просмотр исходного кода

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.
maziggy 2 месяцев назад
Родитель
Сommit
4521366a5b
1 измененных файлов с 4 добавлено и 0 удалено
  1. 4 0
      spoolbuddy/scripts/read_tag.py

+ 4 - 0
spoolbuddy/scripts/read_tag.py

@@ -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