fix return value that break 'hf search', Thanks @atk!

This commit is contained in:
iceman1001 committed 2026-08-30 19:11:37 +02:00
1 parent 70aa0309e7
commit b7bd6ddadb
1 file changed
+17 -6
+17 -6
View File
@@ -1814,7 +1814,7 @@ int read_iclass_csn(bool loop, bool verbose, bool shallow_mod) {
payload.flags |= FLAG_ICLASS_READER_SHALLOW_MOD; payload.flags |= FLAG_ICLASS_READER_SHALLOW_MOD;
} }
int res = PM3_SUCCESS; int res = PM3_ETIMEOUT;
do { do {
clearCommandBuffer(); clearCommandBuffer();
@@ -1823,14 +1823,19 @@ int read_iclass_csn(bool loop, bool verbose, bool shallow_mod) {
if (WaitForResponseTimeout(CMD_HF_ICLASS_READER, &resp, 2000)) { if (WaitForResponseTimeout(CMD_HF_ICLASS_READER, &resp, 2000)) {
iclass_card_select_resp_t *r = (iclass_card_select_resp_t *)resp.data.asBytes; if (resp.status == PM3_ERFTRANS || resp.length < sizeof(iclass_card_select_resp_t)) {
if (loop) { if (loop) {
if (resp.status == PM3_ERFTRANS) {
continue; continue;
} }
} else { if (verbose) PrintAndLogEx(WARNING, "iCLASS / Picopass card select failed ( %d )", resp.status);
res = PM3_EOPABORTED;
break;
}
if (r->status == FLAG_ICLASS_NULL || resp.status == PM3_ERFTRANS) { iclass_card_select_resp_t *r = (iclass_card_select_resp_t *)resp.data.asBytes;
if (loop == false) {
if (r->status == FLAG_ICLASS_NULL) {
if (verbose) PrintAndLogEx(WARNING, "iCLASS / Picopass card select failed ( %d , %d)", r->status, resp.status); if (verbose) PrintAndLogEx(WARNING, "iCLASS / Picopass card select failed ( %d , %d)", r->status, resp.status);
res = PM3_EOPABORTED; res = PM3_EOPABORTED;
break; break;
@@ -1852,6 +1857,12 @@ int read_iclass_csn(bool loop, bool verbose, bool shallow_mod) {
free(card); free(card);
res = PM3_SUCCESS; res = PM3_SUCCESS;
} }
} else {
if (verbose) PrintAndLogEx(WARNING, "iCLASS / Picopass card select timeout");
res = PM3_ETIMEOUT;
if (loop == false) {
break;
}
} }
} while (loop && (kbd_enter_pressed() == false)); } while (loop && (kbd_enter_pressed() == false));