From efd40243b7dbf8c994dac7dbaff8a94c03e22194 Mon Sep 17 00:00:00 2001 From: Lennart Schmidt Date: Mon, 30 Nov 2026 12:58:31 +0100 Subject: [PATCH] Accept NTAG215 tags whose CC declares 504 bytes (0x3F) Since a13bc9e the Ultralight reader rejects any CC size byte that is not in FM175XX_ULTRALIGHT_PAGE_COUNTS_BY_CC_SIZE. NTAG215 tags with CC E1 10 3F 00 declare the full 504-byte user area (pages 04h-81h) and are valid, but are now rejected. The CC is OTP, so these tags cannot be reset to NXP's delivery value 0x3E. Map 0x3F to the NTAG215's 135 physical pages and add a synthetic case plus a real tag dump as an OpenSpool fixture. --- src/reader/fm175xx/constants.py | 1 + .../OpenSpool/Geeetech PLA FFC5AB CC 3F.bin | Bin 0 -> 540 bytes .../OpenSpool/Geeetech PLA FFC5AB CC 3F.yml | 16 ++++++++++++++++ test/test_mifare_ultralight_reader.py | 5 +++-- 4 files changed, 20 insertions(+), 2 deletions(-) create mode 100644 test/tags/OpenSpool/Geeetech PLA FFC5AB CC 3F.bin create mode 100644 test/tags/OpenSpool/Geeetech PLA FFC5AB CC 3F.yml diff --git a/src/reader/fm175xx/constants.py b/src/reader/fm175xx/constants.py index 2b20ebc..7efc711 100644 --- a/src/reader/fm175xx/constants.py +++ b/src/reader/fm175xx/constants.py @@ -122,6 +122,7 @@ 0x06: 16, # MIFARE Ultralight 0x12: 45, # NTAG213 0x3E: 135, # NTAG215 + 0x3F: 135, # NTAG215, exact 504-byte user area 0x6D: 231, # NTAG216 } diff --git a/test/tags/OpenSpool/Geeetech PLA FFC5AB CC 3F.bin b/test/tags/OpenSpool/Geeetech PLA FFC5AB CC 3F.bin new file mode 100644 index 0000000000000000000000000000000000000000..fc35d5f33cf133010592227fd5d6d2691d03a32b GIT binary patch literal 540 zcmZSaoF66isIY<4gMs0pfIS2Aq)P(zi3J5YnaPPInfZD8S;hHz)k+0L`6cxjS!z)+P!UknP|pC!FR3g@1#$v>9Dy95^8BLsjMNICh?|?UsiPB6 zFsUdpF9j&zo|>9klA4?W6w1xai!VvdEdZHf2{I)&u>vMwWMrUJ`;UR4mSGgoIt2Ez MFfjaQU`1F10IG;LhyVZp literal 0 HcmV?d00001 diff --git a/test/tags/OpenSpool/Geeetech PLA FFC5AB CC 3F.yml b/test/tags/OpenSpool/Geeetech PLA FFC5AB CC 3F.yml new file mode 100644 index 0000000..d3b26d4 --- /dev/null +++ b/test/tags/OpenSpool/Geeetech PLA FFC5AB CC 3F.yml @@ -0,0 +1,16 @@ +source_processor: OpenspoolTagProcessor +unique_id: 3ce8c47fa2d438e7db003cf265cb2d85dc75baf942c49f93c05a81cd59b01f52 +manufacturer: Geeetech +type: PLA +modifiers: [] +colors: + - 0xFFFFC5AB +diameter_mm: 1.75 +weight_grams: 1000 +hotend_min_temp_c: 190 +hotend_max_temp_c: 220 +bed_temp_c: 60.0 +drying_temp_c: 50.0 +drying_time_hours: 8.0 +manufacturing_date: "0001-01-01" +td: 0.0 diff --git a/test/test_mifare_ultralight_reader.py b/test/test_mifare_ultralight_reader.py index 7adb63b..0276941 100644 --- a/test/test_mifare_ultralight_reader.py +++ b/test/test_mifare_ultralight_reader.py @@ -38,7 +38,7 @@ def scan(): def memory(size_byte): - physical_sizes = {0x06: 64, 0x12: 180, 0x3E: 540, 0x6D: 924} + physical_sizes = {0x06: 64, 0x12: 180, 0x3E: 540, 0x3F: 540, 0x6D: 924} data = bytearray(i % 251 for i in range(physical_sizes[size_byte])) data[12:16] = bytes([0xE1, 0x10, size_byte, 0x00]) return bytes(data) @@ -77,6 +77,7 @@ def execute(cmd): pytest.param(0x06, 64, 12, id="ultralight"), pytest.param(0x12, 180, 41, id="ntag213"), pytest.param(0x3E, 540, 131, id="ntag215"), + pytest.param(0x3F, 540, 131, id="ntag215-cc-504"), pytest.param(0x6D, 924, 227, id="ntag216"), ]) def test_reads_all_physical_pages(reader, scan, monkeypatch, size_byte, total_size, last_page): @@ -146,7 +147,7 @@ def test_physical_dump_preserves_processor_output(reader, scan, monkeypatch, fix data = fixture_path.read_bytes() # Some older NTAG213 dumps include rollover bytes. Simulate only physical # memory and pass the real reader's exact-length output to each processor. - physical_sizes = {0x06: 64, 0x12: 180, 0x3E: 540, 0x6D: 924} + physical_sizes = {0x06: 64, 0x12: 180, 0x3E: 540, 0x3F: 540, 0x6D: 924} physical_size = physical_sizes[data[14]] assert len(data) >= physical_size mock_tag(reader, monkeypatch, data[:physical_size])