mirror of
https://github.com/DarkFlippers/unleashed-firmware.git
synced 2024-12-24 05:48:08 +03:00
[FL-1920] Fix NTAG emulation (#776)
* mifare ultralight: fix read signature command * nfc_worker: read signature before pages
This commit is contained in:
parent
2751440193
commit
af1fd0c46d
@ -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);
|
||||
|
@ -72,7 +72,7 @@ void mf_ul_parse_fast_read_response(uint8_t* buff, uint8_t start_page, uint8_t e
|
||||
}
|
||||
|
||||
uint16_t mf_ul_prepare_read_signature(uint8_t* dest) {
|
||||
dest[0] = MF_UL_CHECK_TEARING;
|
||||
dest[0] = MF_UL_READ_SIG;
|
||||
dest[1] = 0;
|
||||
return 2;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user