浏览代码

Fix mifare ultralight/ntag unlock #1624

Co-authored-by: あく <alleteam@gmail.com>
gornekich 3 年之前
父节点
当前提交
8992f8ac36
共有 1 个文件被更改,包括 10 次插入0 次删除
  1. 10 0
      lib/nfc/nfc_worker.c

+ 10 - 0
lib/nfc/nfc_worker.c

@@ -545,6 +545,16 @@ void nfc_worker_mf_ultralight_read_auth(NfcWorker* nfc_worker) {
                 }
 
                 data->auth_success = mf_ultralight_authenticate(&tx_rx, key, &pack);
+
+                if(!data->auth_success) {
+                    // Reset card
+                    furi_hal_nfc_sleep();
+                    if(!furi_hal_nfc_activate_nfca(300, NULL)) {
+                        nfc_worker->callback(NfcWorkerEventFail, nfc_worker->context);
+                        break;
+                    }
+                }
+
                 mf_ul_read_card(&tx_rx, &reader, data);
                 if(data->auth_success) {
                     MfUltralightConfigPages* config_pages = mf_ultralight_get_config_pages(data);