Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 3 commits into from
Mar 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions applications/external/nfc_magic/lib/magic/magic.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@

#define MAGIC_CMD_WUPA (0x40)
#define MAGIC_CMD_WIPE (0x41)
#define MAGIC_CMD_READ (0x43)
#define MAGIC_CMD_WRITE (0x43)
#define MAGIC_CMD_ACCESS (0x43)

#define MAGIC_MIFARE_READ_CMD (0x30)
#define MAGIC_MIFARE_WRITE_CMD (0xA0)
Expand Down Expand Up @@ -70,7 +69,7 @@ bool magic_data_access_cmd() {
FuriHalNfcReturn ret = 0;

do {
tx_data[0] = MAGIC_CMD_WRITE;
tx_data[0] = MAGIC_CMD_ACCESS;
ret = furi_hal_nfc_ll_txrx_bits(
tx_data,
8,
Expand Down
8 changes: 5 additions & 3 deletions applications/external/nfc_magic/nfc_magic_worker.c
Original file line number Diff line number Diff line change
Expand Up @@ -85,15 +85,17 @@ void nfc_magic_worker_write(NfcMagicWorker* nfc_magic_worker) {
card_found_notified = true;
}
furi_hal_nfc_sleep();

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(
NfcMagicWorkerEventWrongCard, nfc_magic_worker->context);
break;
}
furi_hal_nfc_sleep();
}
if(magic_wupa()) {
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(
NfcMagicWorkerEventWrongCard, nfc_magic_worker->context);
break;
Expand Down