Add 'hf.field.timeout' to prefs

This commit is contained in:
kormax committed 2026-03-31 12:02:23 +03:00
1 parent bdb05a8037
commit b443fc7723
9 files changed
+172 -1

No files matched your search

+29
View File
@@ -846,6 +846,28 @@ bool OpenProxmark(pm3_device_t **dev, const char *port, bool wait_for_port, int
}
}
int SetHfFieldTimeout(uint32_t timeout_ms, bool quiet) {
if (g_session.pm3_present == false) {
return PM3_ENOTTY;
}
clearCommandBuffer();
SendCommandNG(CMD_SET_HF_FIELD_TIMEOUT, (uint8_t *)&timeout_ms, sizeof(timeout_ms));
PacketResponseNG resp;
if (WaitForResponseTimeoutW(CMD_SET_HF_FIELD_TIMEOUT, &resp, 1000, false) == false) {
if (!quiet) {
PrintAndLogEx(WARNING, "timeout while setting HF field timeout");
}
return PM3_ETIMEOUT;
}
if (resp.status != PM3_SUCCESS && !quiet) {
PrintAndLogEx(WARNING, "HF field timeout command failed (%d)", resp.status);
}
return resp.status;
}
// check if we can communicate with Pm3
int TestProxmark(pm3_device_t *dev) {
@@ -921,6 +943,13 @@ int TestProxmark(pm3_device_t *dev) {
return res;
}
}
if (g_session.hf_field_timeout > 0) {
int timeout_res = SetHfFieldTimeout(g_session.hf_field_timeout, true);
if (timeout_res != PM3_SUCCESS) {
PrintAndLogEx(WARNING, "Failed to apply HF field timeout (" _YELLOW_("%u") " ms)", g_session.hf_field_timeout);
}
}
return PM3_SUCCESS;
}