From 11c4d2ae813f72924feb02544ba9b12ca46e62f1 Mon Sep 17 00:00:00 2001 From: Edouard Vincent Date: Mon, 1 Jan 2024 21:30:44 -0800 Subject: [PATCH] nfc_magic: Fix support of 4K fobs (#102) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: あく --- nfc_magic/.catalog/changelog.md | 4 ++++ nfc_magic/application.fam | 2 +- nfc_magic/lib/magic/protocols/gen4/gen4_poller.c | 4 ++-- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/nfc_magic/.catalog/changelog.md b/nfc_magic/.catalog/changelog.md index 3abd18cc..cdca3c28 100644 --- a/nfc_magic/.catalog/changelog.md +++ b/nfc_magic/.catalog/changelog.md @@ -1,3 +1,7 @@ +## 1.4 + + - Fix incorrect max sector configuration + ## 1.4 - Auth with password option moved into new submenu "Gen4 actions" diff --git a/nfc_magic/application.fam b/nfc_magic/application.fam index 25dff8c6..546a7df3 100644 --- a/nfc_magic/application.fam +++ b/nfc_magic/application.fam @@ -10,7 +10,7 @@ App( ], stack_size=4 * 1024, fap_description="Application for writing to NFC tags with modifiable sector 0", - fap_version="1.4", + fap_version="1.5", fap_icon="assets/125_10px.png", fap_category="NFC", fap_private_libs=[ diff --git a/nfc_magic/lib/magic/protocols/gen4/gen4_poller.c b/nfc_magic/lib/magic/protocols/gen4/gen4_poller.c index 6181936b..1764585c 100644 --- a/nfc_magic/lib/magic/protocols/gen4/gen4_poller.c +++ b/nfc_magic/lib/magic/protocols/gen4/gen4_poller.c @@ -274,7 +274,7 @@ static NfcCommand gen4_poller_write_mf_classic(Gen4Poller* instance) { instance->config[25] = iso3_data->atqa[1]; instance->config[26] = iso3_data->sak; instance->config[27] = 0x00; - instance->config[28] = instance->total_blocks; + instance->config[28] = instance->total_blocks - 1; instance->config[29] = 0x01; Gen4PollerError error = gen4_poller_set_config( @@ -353,7 +353,7 @@ static NfcCommand gen4_poller_write_mf_ultralight(Gen4Poller* instance) { instance->config[25] = iso3_data->atqa[1]; instance->config[26] = iso3_data->sak; instance->config[27] = 0x00; - instance->config[28] = instance->total_blocks; + instance->config[28] = instance->total_blocks - 1; instance->config[29] = 0x01; Gen4PollerError error = gen4_poller_set_config(