mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-20 21:33:47 -07:00
style
This commit is contained in:
parent
bb0445d886
commit
607f1bb26c
14 changed files with 53 additions and 33 deletions
|
@ -914,7 +914,7 @@ int CmdHF14ASim(const char *Cmd) {
|
||||||
bool keypress = kbd_enter_pressed();
|
bool keypress = kbd_enter_pressed();
|
||||||
while (keypress == false) {
|
while (keypress == false) {
|
||||||
|
|
||||||
if (WaitForResponseTimeout(CMD_HF_MIFARE_SIMULATE, &resp, 1500) == 0)
|
if (WaitForResponseTimeout(CMD_HF_MIFARE_SIMULATE, &resp, 1500) == false)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (resp.status != PM3_SUCCESS)
|
if (resp.status != PM3_SUCCESS)
|
||||||
|
@ -4037,7 +4037,7 @@ int CmdHF14AAIDSim(const char *Cmd) {
|
||||||
bool keypress = kbd_enter_pressed();
|
bool keypress = kbd_enter_pressed();
|
||||||
while (keypress == false) {
|
while (keypress == false) {
|
||||||
|
|
||||||
if (WaitForResponseTimeout(CMD_HF_MIFARE_SIMULATE, &resp, 1500) == 0) {
|
if (WaitForResponseTimeout(CMD_HF_MIFARE_SIMULATE, &resp, 1500) == false) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -131,7 +131,7 @@ static int lto_send_cmd_raw(uint8_t *cmd, uint8_t len, uint8_t *response, uint16
|
||||||
SendCommandMIX(CMD_HF_ISO14443A_READER, arg0, arg1, 0, cmd, len);
|
SendCommandMIX(CMD_HF_ISO14443A_READER, arg0, arg1, 0, cmd, len);
|
||||||
PacketResponseNG resp;
|
PacketResponseNG resp;
|
||||||
|
|
||||||
if (!WaitForResponseTimeout(CMD_ACK, &resp, 1500)) {
|
if (WaitForResponseTimeout(CMD_ACK, &resp, 1500) == false) {
|
||||||
if (verbose) PrintAndLogEx(WARNING, "timeout while waiting for reply");
|
if (verbose) PrintAndLogEx(WARNING, "timeout while waiting for reply");
|
||||||
return PM3_ETIMEOUT;
|
return PM3_ETIMEOUT;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1915,9 +1915,13 @@ static int CmdHF14AMfNested(const char *Cmd) { //TODO: single mode broken? can't
|
||||||
SendCommandNG(CMD_HF_MIFARE_READBL, (uint8_t *)&payload, sizeof(mf_readblock_t));
|
SendCommandNG(CMD_HF_MIFARE_READBL, (uint8_t *)&payload, sizeof(mf_readblock_t));
|
||||||
|
|
||||||
PacketResponseNG resp;
|
PacketResponseNG resp;
|
||||||
if (!WaitForResponseTimeout(CMD_HF_MIFARE_READBL, &resp, 1500)) continue;
|
if (WaitForResponseTimeout(CMD_HF_MIFARE_READBL, &resp, 1500) == false) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (resp.status != PM3_SUCCESS) continue;
|
if (resp.status != PM3_SUCCESS) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
uint8_t *data = resp.data.asBytes;
|
uint8_t *data = resp.data.asBytes;
|
||||||
key64 = bytes_to_num(data + 10, 6);
|
key64 = bytes_to_num(data + 10, 6);
|
||||||
|
@ -4005,9 +4009,13 @@ static int CmdHF14AMfChk(const char *Cmd) {
|
||||||
SendCommandNG(CMD_HF_MIFARE_READBL, (uint8_t *)&payload, sizeof(mf_readblock_t));
|
SendCommandNG(CMD_HF_MIFARE_READBL, (uint8_t *)&payload, sizeof(mf_readblock_t));
|
||||||
|
|
||||||
PacketResponseNG resp;
|
PacketResponseNG resp;
|
||||||
if (!WaitForResponseTimeout(CMD_HF_MIFARE_READBL, &resp, 1500)) continue;
|
if (WaitForResponseTimeout(CMD_HF_MIFARE_READBL, &resp, 1500) == false) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (resp.status != PM3_SUCCESS) continue;
|
if (resp.status != PM3_SUCCESS) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
uint8_t *data = resp.data.asBytes;
|
uint8_t *data = resp.data.asBytes;
|
||||||
key64 = bytes_to_num(data + 10, MIFARE_KEY_SIZE);
|
key64 = bytes_to_num(data + 10, MIFARE_KEY_SIZE);
|
||||||
|
@ -4070,7 +4078,7 @@ out:
|
||||||
// Disable fast mode and send a dummy command to make it effective
|
// Disable fast mode and send a dummy command to make it effective
|
||||||
g_conn.block_after_ACK = false;
|
g_conn.block_after_ACK = false;
|
||||||
SendCommandNG(CMD_PING, NULL, 0);
|
SendCommandNG(CMD_PING, NULL, 0);
|
||||||
if (!WaitForResponseTimeout(CMD_PING, NULL, 1000)) {
|
if (WaitForResponseTimeout(CMD_PING, NULL, 1000) == false) {
|
||||||
PrintAndLogEx(WARNING, "command execution time out");
|
PrintAndLogEx(WARNING, "command execution time out");
|
||||||
return PM3_ETIMEOUT;
|
return PM3_ETIMEOUT;
|
||||||
}
|
}
|
||||||
|
@ -6176,7 +6184,9 @@ static int CmdHF14AMfice(const char *Cmd) {
|
||||||
clearCommandBuffer();
|
clearCommandBuffer();
|
||||||
SendCommandMIX(CMD_HF_MIFARE_ACQ_NONCES, blockNo + keyType * 0x100, trgBlockNo + trgKeyType * 0x100, flags, NULL, 0);
|
SendCommandMIX(CMD_HF_MIFARE_ACQ_NONCES, blockNo + keyType * 0x100, trgBlockNo + trgKeyType * 0x100, flags, NULL, 0);
|
||||||
|
|
||||||
if (!WaitForResponseTimeout(CMD_ACK, &resp, 3000)) goto out;
|
if (WaitForResponseTimeout(CMD_ACK, &resp, 3000) == false) {
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
if (resp.oldarg[0]) goto out;
|
if (resp.oldarg[0]) goto out;
|
||||||
|
|
||||||
uint32_t items = resp.oldarg[2];
|
uint32_t items = resp.oldarg[2];
|
||||||
|
|
|
@ -4628,7 +4628,7 @@ static int CmdHF14AMfuOtpTearoff(const char *Cmd) {
|
||||||
|
|
||||||
// we be getting ACK that we are silently ignoring here..
|
// we be getting ACK that we are silently ignoring here..
|
||||||
|
|
||||||
if (!WaitForResponseTimeout(CMD_HF_MFU_OTP_TEAROFF, &resp, 2000)) {
|
if (WaitForResponseTimeout(CMD_HF_MFU_OTP_TEAROFF, &resp, 2000) == false) {
|
||||||
PrintAndLogEx(WARNING, "Failed");
|
PrintAndLogEx(WARNING, "Failed");
|
||||||
return PM3_ESOFT;
|
return PM3_ESOFT;
|
||||||
}
|
}
|
||||||
|
@ -4649,11 +4649,13 @@ static int CmdHF14AMfuOtpTearoff(const char *Cmd) {
|
||||||
got_post = true;
|
got_post = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (! got_post) {
|
|
||||||
|
if (!got_post) {
|
||||||
PrintAndLogEx(FAILED, "Failed to read block BEFORE");
|
PrintAndLogEx(FAILED, "Failed to read block BEFORE");
|
||||||
error_retries++;
|
error_retries++;
|
||||||
continue; // try again
|
continue; // try again
|
||||||
}
|
}
|
||||||
|
|
||||||
error_retries = 0;
|
error_retries = 0;
|
||||||
char prestr[20] = {0};
|
char prestr[20] = {0};
|
||||||
snprintf(prestr, sizeof(prestr), "%s", sprint_hex_inrow(pre, sizeof(pre)));
|
snprintf(prestr, sizeof(prestr), "%s", sprint_hex_inrow(pre, sizeof(pre)));
|
||||||
|
@ -4936,7 +4938,7 @@ static int CmdHF14AMfuEv1CounterTearoff(const char *Cmd) {
|
||||||
clearCommandBuffer();
|
clearCommandBuffer();
|
||||||
PacketResponseNG resp;
|
PacketResponseNG resp;
|
||||||
SendCommandNG(CMD_HF_MFU_COUNTER_TEAROFF, (uint8_t*)&payload, sizeof(payload));
|
SendCommandNG(CMD_HF_MFU_COUNTER_TEAROFF, (uint8_t*)&payload, sizeof(payload));
|
||||||
if (!WaitForResponseTimeout(CMD_HF_MFU_COUNTER_TEAROFF, &resp, 2000)) {
|
if (WaitForResponseTimeout(CMD_HF_MFU_COUNTER_TEAROFF, &resp, 2000) == false) {
|
||||||
PrintAndLogEx(WARNING, "\ntear off command failed");
|
PrintAndLogEx(WARNING, "\ntear off command failed");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
|
@ -664,7 +664,7 @@ static int CmdHFTexkomReader(const char *Cmd) {
|
||||||
SendCommandNG(CMD_HF_ACQ_RAW_ADC, (uint8_t *)&samplesCount, sizeof(uint32_t));
|
SendCommandNG(CMD_HF_ACQ_RAW_ADC, (uint8_t *)&samplesCount, sizeof(uint32_t));
|
||||||
|
|
||||||
PacketResponseNG resp;
|
PacketResponseNG resp;
|
||||||
if (!WaitForResponseTimeout(CMD_HF_ACQ_RAW_ADC, &resp, 2500)) {
|
if (WaitForResponseTimeout(CMD_HF_ACQ_RAW_ADC, &resp, 2500) == false) {
|
||||||
PrintAndLogEx(WARNING, "command execution time out");
|
PrintAndLogEx(WARNING, "command execution time out");
|
||||||
return PM3_ETIMEOUT;
|
return PM3_ETIMEOUT;
|
||||||
}
|
}
|
||||||
|
|
|
@ -187,7 +187,7 @@ int CmdHfThinFilmSim(const char *Cmd) {
|
||||||
int ret;
|
int ret;
|
||||||
while (!(ret = kbd_enter_pressed())) {
|
while (!(ret = kbd_enter_pressed())) {
|
||||||
|
|
||||||
if (WaitForResponseTimeout(CMD_HF_THINFILM_SIMULATE, &resp, 500) == 0) {
|
if (WaitForResponseTimeout(CMD_HF_THINFILM_SIMULATE, &resp, 500) == false) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -928,15 +928,19 @@ static int CmdTune(const char *Cmd) {
|
||||||
SendCommandNG(CMD_MEASURE_ANTENNA_TUNING, NULL, 0);
|
SendCommandNG(CMD_MEASURE_ANTENNA_TUNING, NULL, 0);
|
||||||
PacketResponseNG resp;
|
PacketResponseNG resp;
|
||||||
PrintAndLogEx(INPLACE, "% 3i", timeout_max - timeout);
|
PrintAndLogEx(INPLACE, "% 3i", timeout_max - timeout);
|
||||||
while (!WaitForResponseTimeout(CMD_MEASURE_ANTENNA_TUNING, &resp, 500)) {
|
|
||||||
|
while (WaitForResponseTimeout(CMD_MEASURE_ANTENNA_TUNING, &resp, 500) == false) {
|
||||||
|
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
if (timeout >= timeout_max) {
|
if (timeout >= timeout_max) {
|
||||||
PrintAndLogEx(WARNING, "\nNo response from Proxmark3. Aborting...");
|
PrintAndLogEx(WARNING, "\nNo response from Proxmark3. Aborting...");
|
||||||
return PM3_ETIMEOUT;
|
return PM3_ETIMEOUT;
|
||||||
}
|
}
|
||||||
|
|
||||||
timeout++;
|
timeout++;
|
||||||
PrintAndLogEx(INPLACE, "% 3i", timeout_max - timeout);
|
PrintAndLogEx(INPLACE, "% 3i", timeout_max - timeout);
|
||||||
}
|
}
|
||||||
|
|
||||||
PrintAndLogEx(NORMAL, "");
|
PrintAndLogEx(NORMAL, "");
|
||||||
|
|
||||||
if (resp.status != PM3_SUCCESS) {
|
if (resp.status != PM3_SUCCESS) {
|
||||||
|
|
|
@ -435,15 +435,17 @@ int CmdLFCommandRead(const char *Cmd) {
|
||||||
|
|
||||||
i = 10;
|
i = 10;
|
||||||
// 20sec wait loop
|
// 20sec wait loop
|
||||||
while (!WaitForResponseTimeout(CMD_LF_MOD_THEN_ACQ_RAW_ADC, &resp, 2000) && i != 0) {
|
while (WaitForResponseTimeout(CMD_LF_MOD_THEN_ACQ_RAW_ADC, &resp, 2000) == false && i != 0) {
|
||||||
if (verbose) {
|
if (verbose) {
|
||||||
PrintAndLogEx(NORMAL, "." NOLF);
|
PrintAndLogEx(NORMAL, "." NOLF);
|
||||||
}
|
}
|
||||||
i--;
|
i--;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (verbose) {
|
if (verbose) {
|
||||||
PrintAndLogEx(NORMAL, "");
|
PrintAndLogEx(NORMAL, "");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (resp.status != PM3_SUCCESS) {
|
if (resp.status != PM3_SUCCESS) {
|
||||||
PrintAndLogEx(WARNING, "command failed.");
|
PrintAndLogEx(WARNING, "command failed.");
|
||||||
return PM3_ESOFT;
|
return PM3_ESOFT;
|
||||||
|
@ -595,7 +597,7 @@ int lf_getconfig(sample_config *config) {
|
||||||
|
|
||||||
SendCommandNG(CMD_LF_SAMPLING_GET_CONFIG, NULL, 0);
|
SendCommandNG(CMD_LF_SAMPLING_GET_CONFIG, NULL, 0);
|
||||||
PacketResponseNG resp;
|
PacketResponseNG resp;
|
||||||
if (!WaitForResponseTimeout(CMD_LF_SAMPLING_GET_CONFIG, &resp, 2000)) {
|
if (WaitForResponseTimeout(CMD_LF_SAMPLING_GET_CONFIG, &resp, 2000) == false) {
|
||||||
PrintAndLogEx(WARNING, "command execution time out");
|
PrintAndLogEx(WARNING, "command execution time out");
|
||||||
return PM3_ETIMEOUT;
|
return PM3_ETIMEOUT;
|
||||||
}
|
}
|
||||||
|
@ -797,10 +799,12 @@ static int lf_read_internal(bool realtime, bool verbose, uint64_t samples) {
|
||||||
payload.samples = (samples > MAX_LF_SAMPLES) ? MAX_LF_SAMPLES : samples;
|
payload.samples = (samples > MAX_LF_SAMPLES) ? MAX_LF_SAMPLES : samples;
|
||||||
SendCommandNG(CMD_LF_ACQ_RAW_ADC, (uint8_t *)&payload, sizeof(payload));
|
SendCommandNG(CMD_LF_ACQ_RAW_ADC, (uint8_t *)&payload, sizeof(payload));
|
||||||
PacketResponseNG resp;
|
PacketResponseNG resp;
|
||||||
|
|
||||||
if (is_trigger_threshold_set) {
|
if (is_trigger_threshold_set) {
|
||||||
WaitForResponse(CMD_LF_ACQ_RAW_ADC, &resp);
|
WaitForResponse(CMD_LF_ACQ_RAW_ADC, &resp);
|
||||||
} else {
|
} else {
|
||||||
if (!WaitForResponseTimeout(CMD_LF_ACQ_RAW_ADC, &resp, 2500)) {
|
|
||||||
|
if (WaitForResponseTimeout(CMD_LF_ACQ_RAW_ADC, &resp, 2500) == false) {
|
||||||
PrintAndLogEx(WARNING, "(lf_read) command execution time out");
|
PrintAndLogEx(WARNING, "(lf_read) command execution time out");
|
||||||
return PM3_ETIMEOUT;
|
return PM3_ETIMEOUT;
|
||||||
}
|
}
|
||||||
|
|
|
@ -466,7 +466,7 @@ int clone_t55xx_tag(uint32_t *blockdata, uint8_t numblocks) {
|
||||||
ng.flags = 0;
|
ng.flags = 0;
|
||||||
|
|
||||||
SendCommandNG(CMD_LF_T55XX_WRITEBL, (uint8_t *)&ng, sizeof(ng));
|
SendCommandNG(CMD_LF_T55XX_WRITEBL, (uint8_t *)&ng, sizeof(ng));
|
||||||
if (!WaitForResponseTimeout(CMD_LF_T55XX_WRITEBL, &resp, T55XX_WRITE_TIMEOUT)) {
|
if (WaitForResponseTimeout(CMD_LF_T55XX_WRITEBL, &resp, T55XX_WRITE_TIMEOUT) == false) {
|
||||||
PrintAndLogEx(ERR, "Error occurred, device did not respond during write operation.");
|
PrintAndLogEx(ERR, "Error occurred, device did not respond during write operation.");
|
||||||
return PM3_ETIMEOUT;
|
return PM3_ETIMEOUT;
|
||||||
}
|
}
|
||||||
|
@ -664,7 +664,7 @@ int t55xxWrite(uint8_t block, bool page1, bool usepwd, bool testMode, uint32_t p
|
||||||
PacketResponseNG resp;
|
PacketResponseNG resp;
|
||||||
clearCommandBuffer();
|
clearCommandBuffer();
|
||||||
SendCommandNG(CMD_LF_T55XX_WRITEBL, (uint8_t *)&ng, sizeof(ng));
|
SendCommandNG(CMD_LF_T55XX_WRITEBL, (uint8_t *)&ng, sizeof(ng));
|
||||||
if (!WaitForResponseTimeout(CMD_LF_T55XX_WRITEBL, &resp, 2000)) {
|
if (WaitForResponseTimeout(CMD_LF_T55XX_WRITEBL, &resp, 2000) == false) {
|
||||||
PrintAndLogEx(ERR, "Error occurred, device did not ACK write operation.");
|
PrintAndLogEx(ERR, "Error occurred, device did not ACK write operation.");
|
||||||
return PM3_ETIMEOUT;
|
return PM3_ETIMEOUT;
|
||||||
}
|
}
|
||||||
|
@ -1992,7 +1992,7 @@ static int CmdT55xxDangerousRaw(const char *Cmd) {
|
||||||
PacketResponseNG resp;
|
PacketResponseNG resp;
|
||||||
clearCommandBuffer();
|
clearCommandBuffer();
|
||||||
SendCommandNG(CMD_LF_T55XX_DANGERRAW, (uint8_t *)&ng, sizeof(ng));
|
SendCommandNG(CMD_LF_T55XX_DANGERRAW, (uint8_t *)&ng, sizeof(ng));
|
||||||
if (!WaitForResponseTimeout(CMD_LF_T55XX_DANGERRAW, &resp, 2000)) {
|
if (WaitForResponseTimeout(CMD_LF_T55XX_DANGERRAW, &resp, 2000) == false) {
|
||||||
PrintAndLogEx(ERR, "Error occurred, device did not ACK write operation.");
|
PrintAndLogEx(ERR, "Error occurred, device did not ACK write operation.");
|
||||||
return PM3_ETIMEOUT;
|
return PM3_ETIMEOUT;
|
||||||
}
|
}
|
||||||
|
@ -2840,7 +2840,7 @@ bool AcquireData(uint8_t page, uint8_t block, bool pwdmode, uint32_t password, u
|
||||||
|
|
||||||
clearCommandBuffer();
|
clearCommandBuffer();
|
||||||
SendCommandNG(CMD_LF_T55XX_READBL, (uint8_t *)&payload, sizeof(payload));
|
SendCommandNG(CMD_LF_T55XX_READBL, (uint8_t *)&payload, sizeof(payload));
|
||||||
if (!WaitForResponseTimeout(CMD_LF_T55XX_READBL, NULL, 2500)) {
|
if (WaitForResponseTimeout(CMD_LF_T55XX_READBL, NULL, 2500) == false) {
|
||||||
PrintAndLogEx(WARNING, "command execution time out");
|
PrintAndLogEx(WARNING, "command execution time out");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -3435,7 +3435,7 @@ static int CmdT55xxChkPwds(const char *Cmd) {
|
||||||
PacketResponseNG resp;
|
PacketResponseNG resp;
|
||||||
|
|
||||||
uint8_t timeout = 0;
|
uint8_t timeout = 0;
|
||||||
while (!WaitForResponseTimeout(CMD_LF_T55XX_CHK_PWDS, &resp, 2000)) {
|
while (WaitForResponseTimeout(CMD_LF_T55XX_CHK_PWDS, &resp, 2000) == false) {
|
||||||
timeout++;
|
timeout++;
|
||||||
PrintAndLogEx(NORMAL, "." NOLF);
|
PrintAndLogEx(NORMAL, "." NOLF);
|
||||||
if (timeout > 180) {
|
if (timeout > 180) {
|
||||||
|
|
|
@ -172,7 +172,7 @@ static int CmdVikingClone(const char *Cmd) {
|
||||||
|
|
||||||
SendCommandNG(CMD_LF_VIKING_CLONE, (uint8_t *)&payload, sizeof(payload));
|
SendCommandNG(CMD_LF_VIKING_CLONE, (uint8_t *)&payload, sizeof(payload));
|
||||||
PacketResponseNG resp;
|
PacketResponseNG resp;
|
||||||
if (!WaitForResponseTimeout(CMD_LF_VIKING_CLONE, &resp, T55XX_WRITE_TIMEOUT)) {
|
if (WaitForResponseTimeout(CMD_LF_VIKING_CLONE, &resp, T55XX_WRITE_TIMEOUT) == false) {
|
||||||
PrintAndLogEx(ERR, "Error occurred, device did not respond during write operation.");
|
PrintAndLogEx(ERR, "Error occurred, device did not respond during write operation.");
|
||||||
return PM3_ETIMEOUT;
|
return PM3_ETIMEOUT;
|
||||||
}
|
}
|
||||||
|
|
|
@ -663,7 +663,7 @@ static int CmdSmartUpgrade(const char *Cmd) {
|
||||||
|
|
||||||
clearCommandBuffer();
|
clearCommandBuffer();
|
||||||
SendCommandNG(CMD_SMART_UPLOAD, (uint8_t *)&upload, sizeof(upload));
|
SendCommandNG(CMD_SMART_UPLOAD, (uint8_t *)&upload, sizeof(upload));
|
||||||
if (!WaitForResponseTimeout(CMD_SMART_UPLOAD, &resp, 2000)) {
|
if (WaitForResponseTimeout(CMD_SMART_UPLOAD, &resp, 2000) == false) {
|
||||||
PrintAndLogEx(WARNING, "timeout while waiting for reply");
|
PrintAndLogEx(WARNING, "timeout while waiting for reply");
|
||||||
free(firmware);
|
free(firmware);
|
||||||
return PM3_ETIMEOUT;
|
return PM3_ETIMEOUT;
|
||||||
|
@ -695,7 +695,7 @@ static int CmdSmartUpgrade(const char *Cmd) {
|
||||||
|
|
||||||
free(firmware);
|
free(firmware);
|
||||||
SendCommandNG(CMD_SMART_UPGRADE, (uint8_t *)&payload, sizeof(payload));
|
SendCommandNG(CMD_SMART_UPGRADE, (uint8_t *)&payload, sizeof(payload));
|
||||||
if (!WaitForResponseTimeout(CMD_SMART_UPGRADE, &resp, 2500)) {
|
if (WaitForResponseTimeout(CMD_SMART_UPGRADE, &resp, 2500) == false) {
|
||||||
PrintAndLogEx(WARNING, "timeout while waiting for reply");
|
PrintAndLogEx(WARNING, "timeout while waiting for reply");
|
||||||
return PM3_ETIMEOUT;
|
return PM3_ETIMEOUT;
|
||||||
}
|
}
|
||||||
|
@ -876,7 +876,7 @@ static int CmdSmartSetClock(const char *Cmd) {
|
||||||
clearCommandBuffer();
|
clearCommandBuffer();
|
||||||
SendCommandNG(CMD_SMART_SETCLOCK, (uint8_t *)&payload, sizeof(payload));
|
SendCommandNG(CMD_SMART_SETCLOCK, (uint8_t *)&payload, sizeof(payload));
|
||||||
PacketResponseNG resp;
|
PacketResponseNG resp;
|
||||||
if (!WaitForResponseTimeout(CMD_SMART_SETCLOCK, &resp, 2500)) {
|
if (WaitForResponseTimeout(CMD_SMART_SETCLOCK, &resp, 2500) == false) {
|
||||||
PrintAndLogEx(WARNING, "smart card select failed");
|
PrintAndLogEx(WARNING, "smart card select failed");
|
||||||
return PM3_ETIMEOUT;
|
return PM3_ETIMEOUT;
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,7 +35,7 @@ static int usart_tx(uint8_t *data, size_t len) {
|
||||||
clearCommandBuffer();
|
clearCommandBuffer();
|
||||||
SendCommandNG(CMD_USART_TX, data, len);
|
SendCommandNG(CMD_USART_TX, data, len);
|
||||||
PacketResponseNG resp;
|
PacketResponseNG resp;
|
||||||
if (!WaitForResponseTimeout(CMD_USART_TX, &resp, 1000)) {
|
if (WaitForResponseTimeout(CMD_USART_TX, &resp, 1000) == false) {
|
||||||
return PM3_ETIMEOUT;
|
return PM3_ETIMEOUT;
|
||||||
}
|
}
|
||||||
return resp.status;
|
return resp.status;
|
||||||
|
@ -49,7 +49,7 @@ static int usart_rx(uint8_t *data, size_t *len, uint32_t waittime) {
|
||||||
payload.waittime = waittime;
|
payload.waittime = waittime;
|
||||||
SendCommandNG(CMD_USART_RX, (uint8_t *)&payload, sizeof(payload));
|
SendCommandNG(CMD_USART_RX, (uint8_t *)&payload, sizeof(payload));
|
||||||
PacketResponseNG resp;
|
PacketResponseNG resp;
|
||||||
if (!WaitForResponseTimeout(CMD_USART_RX, &resp, waittime + 500)) {
|
if (WaitForResponseTimeout(CMD_USART_RX, &resp, waittime + 500) == false) {
|
||||||
return PM3_ETIMEOUT;
|
return PM3_ETIMEOUT;
|
||||||
}
|
}
|
||||||
if (resp.status == PM3_SUCCESS) {
|
if (resp.status == PM3_SUCCESS) {
|
||||||
|
@ -99,7 +99,7 @@ static int set_usart_config(uint32_t baudrate, uint8_t parity) {
|
||||||
payload.parity = parity;
|
payload.parity = parity;
|
||||||
SendCommandNG(CMD_USART_CONFIG, (uint8_t *)&payload, sizeof(payload));
|
SendCommandNG(CMD_USART_CONFIG, (uint8_t *)&payload, sizeof(payload));
|
||||||
PacketResponseNG resp;
|
PacketResponseNG resp;
|
||||||
if (!WaitForResponseTimeout(CMD_USART_CONFIG, &resp, 1000)) {
|
if (WaitForResponseTimeout(CMD_USART_CONFIG, &resp, 1000) == false) {
|
||||||
return PM3_ETIMEOUT;
|
return PM3_ETIMEOUT;
|
||||||
}
|
}
|
||||||
return resp.status;
|
return resp.status;
|
||||||
|
|
|
@ -871,7 +871,7 @@ int TestProxmark(pm3_device_t *dev) {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
PacketResponseNG resp;
|
PacketResponseNG resp;
|
||||||
if (WaitForResponseTimeoutW(CMD_PING, &resp, timeout, false) == 0) {
|
if (WaitForResponseTimeoutW(CMD_PING, &resp, timeout, false) == false) {
|
||||||
return PM3_ETIMEOUT;
|
return PM3_ETIMEOUT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -881,7 +881,7 @@ int TestProxmark(pm3_device_t *dev) {
|
||||||
}
|
}
|
||||||
|
|
||||||
SendCommandNG(CMD_CAPABILITIES, NULL, 0);
|
SendCommandNG(CMD_CAPABILITIES, NULL, 0);
|
||||||
if (WaitForResponseTimeoutW(CMD_CAPABILITIES, &resp, 1000, false) == 0) {
|
if (WaitForResponseTimeoutW(CMD_CAPABILITIES, &resp, 1000, false) == false) {
|
||||||
return PM3_ETIMEOUT;
|
return PM3_ETIMEOUT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -303,7 +303,7 @@ static int l_GetFromFlashMemSpiffs(lua_State *L) {
|
||||||
// get size from spiffs itself !
|
// get size from spiffs itself !
|
||||||
SendCommandNG(CMD_SPIFFS_STAT, (uint8_t *)destfilename, 32);
|
SendCommandNG(CMD_SPIFFS_STAT, (uint8_t *)destfilename, 32);
|
||||||
PacketResponseNG resp;
|
PacketResponseNG resp;
|
||||||
if (!WaitForResponseTimeout(CMD_SPIFFS_STAT, &resp, 2000))
|
if (WaitForResponseTimeout(CMD_SPIFFS_STAT, &resp, 2000) == false)
|
||||||
return returnToLuaWithError(L, "No response from the device");
|
return returnToLuaWithError(L, "No response from the device");
|
||||||
|
|
||||||
len = resp.data.asDwords[0];
|
len = resp.data.asDwords[0];
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue