fix some potential empty responses and too much inline calls
This commit is contained in:
1 parent
a2ea5e3a24
commit
24a138eeb1
5 files changed
+32
-8
No files matched your search
@@ -382,6 +382,17 @@ int CmdLFCommandRead(const char *Cmd) {
|
||||
SendCommandNG(CMD_LF_MOD_THEN_ACQ_RAW_ADC, (uint8_t *)&payload, PAYLOAD_HEADER_SIZE + cmd_len);
|
||||
|
||||
PacketResponseNG resp;
|
||||
// init to ZERO
|
||||
resp.cmd = 0,
|
||||
resp.length = 0,
|
||||
resp.magic = 0,
|
||||
resp.status = 0,
|
||||
resp.crc = 0,
|
||||
resp.ng = false,
|
||||
resp.oldarg[0] = 0;
|
||||
resp.oldarg[1] = 0;
|
||||
resp.oldarg[2] = 0;
|
||||
memset(resp.data.asBytes, 0, PM3_CMD_DATA_SIZE);
|
||||
|
||||
i = 10;
|
||||
// 20sec wait loop
|
||||
|
||||
@@ -1230,9 +1230,22 @@ int CmdEM4x50Sim(const char *Cmd) {
|
||||
|
||||
clearCommandBuffer();
|
||||
SendCommandNG(CMD_LF_EM4X50_SIM, (uint8_t *)&password, sizeof(password));
|
||||
PacketResponseNG resp;
|
||||
|
||||
|
||||
PrintAndLogEx(INFO, "Press " _GREEN_("<Enter>") " or pm3-button to abort simulation");
|
||||
|
||||
PacketResponseNG resp;
|
||||
// init to ZERO
|
||||
resp.cmd = 0,
|
||||
resp.length = 0,
|
||||
resp.magic = 0,
|
||||
resp.status = 0,
|
||||
resp.crc = 0,
|
||||
resp.ng = false,
|
||||
resp.oldarg[0] = 0;
|
||||
resp.oldarg[1] = 0;
|
||||
resp.oldarg[2] = 0;
|
||||
memset(resp.data.asBytes, 0, PM3_CMD_DATA_SIZE);
|
||||
|
||||
bool keypress;
|
||||
do {
|
||||
keypress = kbd_enter_pressed();
|
||||
|
||||
+4
-4
@@ -742,10 +742,6 @@ static size_t communication_delay(void) {
|
||||
bool WaitForResponseTimeoutW(uint32_t cmd, PacketResponseNG *response, size_t ms_timeout, bool show_warning) {
|
||||
|
||||
PacketResponseNG resp;
|
||||
if (response == NULL) {
|
||||
response = &resp;
|
||||
}
|
||||
|
||||
// init to ZERO
|
||||
resp.cmd = 0,
|
||||
resp.length = 0,
|
||||
@@ -758,6 +754,10 @@ bool WaitForResponseTimeoutW(uint32_t cmd, PacketResponseNG *response, size_t ms
|
||||
resp.oldarg[2] = 0;
|
||||
memset(resp.data.asBytes, 0, PM3_CMD_DATA_SIZE);
|
||||
|
||||
if (response == NULL) {
|
||||
response = &resp;
|
||||
}
|
||||
|
||||
// Add delay depending on the communication channel & speed
|
||||
if (ms_timeout != (size_t) - 1)
|
||||
ms_timeout += communication_delay();
|
||||
|
||||
Reference in new issue
Block a user