NFC: Fixed writing gen1a magic tags with invalid BCC (#2511)

Co-authored-by: あく <alleteam@gmail.com>
This commit is contained in:
AloneLiberty 2023-03-21 15:03:14 +03:00 committed by GitHub
parent fd8607398d
commit bf70f4b71a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 6 deletions

View File

@ -6,8 +6,7 @@
#define MAGIC_CMD_WUPA (0x40) #define MAGIC_CMD_WUPA (0x40)
#define MAGIC_CMD_WIPE (0x41) #define MAGIC_CMD_WIPE (0x41)
#define MAGIC_CMD_READ (0x43) #define MAGIC_CMD_ACCESS (0x43)
#define MAGIC_CMD_WRITE (0x43)
#define MAGIC_MIFARE_READ_CMD (0x30) #define MAGIC_MIFARE_READ_CMD (0x30)
#define MAGIC_MIFARE_WRITE_CMD (0xA0) #define MAGIC_MIFARE_WRITE_CMD (0xA0)
@ -70,7 +69,7 @@ bool magic_data_access_cmd() {
FuriHalNfcReturn ret = 0; FuriHalNfcReturn ret = 0;
do { do {
tx_data[0] = MAGIC_CMD_WRITE; tx_data[0] = MAGIC_CMD_ACCESS;
ret = furi_hal_nfc_ll_txrx_bits( ret = furi_hal_nfc_ll_txrx_bits(
tx_data, tx_data,
8, 8,

View File

@ -85,15 +85,17 @@ void nfc_magic_worker_write(NfcMagicWorker* nfc_magic_worker) {
card_found_notified = true; card_found_notified = true;
} }
furi_hal_nfc_sleep(); furi_hal_nfc_sleep();
if(!magic_wupa()) { if(!magic_wupa()) {
FURI_LOG_E(TAG, "Not Magic card"); FURI_LOG_E(TAG, "No card response to WUPA (not a magic card)");
nfc_magic_worker->callback( nfc_magic_worker->callback(
NfcMagicWorkerEventWrongCard, nfc_magic_worker->context); NfcMagicWorkerEventWrongCard, nfc_magic_worker->context);
break; break;
} }
furi_hal_nfc_sleep();
}
if(magic_wupa()) {
if(!magic_data_access_cmd()) { if(!magic_data_access_cmd()) {
FURI_LOG_E(TAG, "Not Magic card"); FURI_LOG_E(TAG, "No card response to data access command (not a magic card)");
nfc_magic_worker->callback( nfc_magic_worker->callback(
NfcMagicWorkerEventWrongCard, nfc_magic_worker->context); NfcMagicWorkerEventWrongCard, nfc_magic_worker->context);
break; break;