diff options
author | gornekich <n.gorbadey@gmail.com> | 2021-10-21 15:46:47 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-10-21 15:46:47 +0300 |
commit | af1fd0c46d71e5deeabf3b08500c0ce073b8cbf7 (patch) | |
tree | d880414bf16a7faa166b1a09c3312944663435cb /applications/nfc/nfc_worker.c | |
parent | 275144019372c9d6dc5874b75a3c1056b0fbea48 (diff) |
[FL-1920] Fix NTAG emulation (#776)
* mifare ultralight: fix read signature command
* nfc_worker: read signature before pages
Diffstat (limited to 'applications/nfc/nfc_worker.c')
-rwxr-xr-x | applications/nfc/nfc_worker.c | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/applications/nfc/nfc_worker.c b/applications/nfc/nfc_worker.c index 97858a94..e8312b88 100755 --- a/applications/nfc/nfc_worker.c +++ b/applications/nfc/nfc_worker.c @@ -509,6 +509,14 @@ void nfc_worker_read_mifare_ul(NfcWorker* nfc_worker) { "Mifare Ultralight Type: %d, Pages: %d", mf_ul_read.type, mf_ul_read.pages_to_read); + FURI_LOG_I(NFC_WORKER_TAG, "Reading signature ..."); + tx_len = mf_ul_prepare_read_signature(tx_buff); + if(furi_hal_nfc_data_exchange(tx_buff, tx_len, &rx_buff, &rx_len, false)) { + FURI_LOG_W(NFC_WORKER_TAG, "Failed reading signature"); + memset(mf_ul_read.data.signature, 0, sizeof(mf_ul_read.data.signature)); + } else { + mf_ul_parse_read_signature_response(rx_buff, &mf_ul_read); + } } else if(err == ERR_TIMEOUT) { FURI_LOG_W( NFC_WORKER_TAG, @@ -540,15 +548,6 @@ void nfc_worker_read_mifare_ul(NfcWorker* nfc_worker) { rx_buff, 0x00, mf_ul_read.pages_to_read - 1, &mf_ul_read); } - FURI_LOG_I(NFC_WORKER_TAG, "Reading signature ..."); - tx_len = mf_ul_prepare_read_signature(tx_buff); - if(furi_hal_nfc_data_exchange(tx_buff, tx_len, &rx_buff, &rx_len, false)) { - FURI_LOG_W(NFC_WORKER_TAG, "Failed reading signature"); - memset(mf_ul_read.data.signature, 0, sizeof(mf_ul_read.data.signature)); - } else { - mf_ul_parse_read_signature_response(rx_buff, &mf_ul_read); - } - FURI_LOG_I(NFC_WORKER_TAG, "Reading 3 counters ..."); for(uint8_t i = 0; i < 3; i++) { tx_len = mf_ul_prepare_read_cnt(tx_buff, i); |