chg: 'lf hitag list' - getfrombigbuf has now timeout

This commit is contained in:
iceman1001 2018-04-27 16:47:29 +02:00
commit d7e6b5d6a1

View file

@ -40,7 +40,12 @@ int CmdLFHitagList(const char *Cmd) {
// Query for the actual size of the trace // Query for the actual size of the trace
UsbCommand response; UsbCommand response;
GetFromBigBuf(got, USB_CMD_DATA_SIZE, 0); GetFromBigBuf(got, USB_CMD_DATA_SIZE, 0);
WaitForResponse(CMD_ACK, &response); if ( !WaitForResponseTimeout(CMD_ACK, &response, 2500) ) {
PrintAndLogEx(WARNING, "command execution time out");
free(got);
return 2;
}
uint16_t traceLen = response.arg[2]; uint16_t traceLen = response.arg[2];
if (traceLen > USB_CMD_DATA_SIZE) { if (traceLen > USB_CMD_DATA_SIZE) {
uint8_t *p = realloc(got, traceLen); uint8_t *p = realloc(got, traceLen);
@ -51,7 +56,11 @@ int CmdLFHitagList(const char *Cmd) {
} }
got = p; got = p;
GetFromBigBuf(got, traceLen, 0); GetFromBigBuf(got, traceLen, 0);
WaitForResponse(CMD_ACK,NULL); if ( !WaitForResponseTimeout(CMD_ACK, NULL, 2500) ) {
PrintAndLogEx(WARNING, "command execution time out");
free(got);
return 2;
}
} }
PrintAndLogEx(NORMAL, "recorded activity (TraceLen = %d bytes):"); PrintAndLogEx(NORMAL, "recorded activity (TraceLen = %d bytes):");