diff options
author | ghettorce <799240+ghettorce@users.noreply.github.com> | 2021-12-15 21:27:25 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-12-15 21:27:25 +0300 |
commit | de006aa06aad160a1207cd4b6d414d28981da152 (patch) | |
tree | 96b6f5d79231ec6abdd3b097f0898dbc635adc06 /applications/nfc/nfc_worker.c | |
parent | 757ea073a8308815fcb3e7b18cbb96865d70c186 (diff) |
NFC: fixes & improvements (#897)
* nfc: (mf_ul) fix overflow while reading
* nfc: (mf_ul) fix FAST_READ command emulation
* nfc: (mf_ul) implement non-strict PWD_AUTH command emulation for NTAG21x
* nfc: (mf_ul) improve emulation stability by removing frequent furi_hal_console_put() calls that cause delays or something
* nfc: (mf_ul) remove calls to blocking functions from emulation worker
Co-authored-by: あく <alleteam@gmail.com>
Diffstat (limited to 'applications/nfc/nfc_worker.c')
-rw-r--r-- | applications/nfc/nfc_worker.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/applications/nfc/nfc_worker.c b/applications/nfc/nfc_worker.c index 3f7f87e4..27eab370 100644 --- a/applications/nfc/nfc_worker.c +++ b/applications/nfc/nfc_worker.c @@ -613,6 +613,9 @@ void nfc_worker_emulate_mifare_ul(NfcWorker* nfc_worker) { // Setup emulation parameters from mifare ultralight data structure mf_ul_prepare_emulation(&mf_ul_emulate, &data->mf_ul_data); while(nfc_worker->state == NfcWorkerStateEmulateMifareUl) { + // WARNING + // DO NOT call any blocking functions (e.g. FURI_LOG_*) in this loop, + // as any delay will negatively affect the stability of the emulation. if(furi_hal_nfc_listen( data->nfc_data.uid, data->nfc_data.uid_len, @@ -620,7 +623,6 @@ void nfc_worker_emulate_mifare_ul(NfcWorker* nfc_worker) { data->nfc_data.sak, true, 200)) { - FURI_LOG_D(TAG, "Anticollision passed"); if(furi_hal_nfc_get_first_frame(&rx_buff, &rx_len)) { // Data exchange loop while(nfc_worker->state == NfcWorkerStateEmulateMifareUl) { @@ -632,17 +634,14 @@ void nfc_worker_emulate_mifare_ul(NfcWorker* nfc_worker) { if(err == ERR_NONE) { continue; } else { - FURI_LOG_E(TAG, "Communication error: %d", err); break; } } else { - FURI_LOG_W(TAG, "Not valid command: %02X", rx_buff[0]); furi_hal_nfc_deactivate(); break; } } } else { - FURI_LOG_W(TAG, "Error in 1st data exchange"); furi_hal_nfc_deactivate(); } } @@ -653,7 +652,6 @@ void nfc_worker_emulate_mifare_ul(NfcWorker* nfc_worker) { nfc_worker->callback(nfc_worker->context); } } - FURI_LOG_W(TAG, "Can't find reader"); osThreadYield(); } } |