basicallty the flush queue commmand is replaced with clearCommandBuffer();.
int CmdHF14A(const char *Cmd) {
// flush
- WaitForResponseTimeout(CMD_ACK,NULL,100);
+ clearCommandBuffer();
+ //WaitForResponseTimeout(CMD_ACK,NULL,100);
// parse
CmdsParse(CommandTable, Cmd);
int CmdHFDESReader(const char *Cmd)
{
- UsbCommand c ={CMD_MIFARE_DES_READER, {3, 0x60, 0}};
+ UsbCommand c = { CMD_MIFARE_DES_READER, {3, 0x60, 0} };
SendCommand(&c);
-
UsbCommand resp;
- WaitForResponseTimeout(CMD_ACK,&resp,2000);
+ if (!WaitForResponseTimeout(CMD_ACK,&resp,2000) ){
+ PrintAndLog("Command time-out");
+ return 1;
+ }
return 0;
}
int CmdHFDES(const char *Cmd)
{
//flush
- WaitForResponseTimeout(CMD_ACK,NULL,100);
+ clearCommandBuffer();
+ //WaitForResponseTimeout(CMD_ACK,NULL,100);
CmdsParse(CommandTable, Cmd);
return 0;
}
int CmdHFEPA(const char *Cmd)
{
// flush
- WaitForResponseTimeout(CMD_ACK,NULL,100);
+ clearCommandBuffer();
+ //WaitForResponseTimeout(CMD_ACK,NULL,100);
// parse
- CmdsParse(CommandTable, Cmd);
- return 0;
+ CmdsParse(CommandTable, Cmd);
+ return 0;
}
int CmdHFMF(const char *Cmd)\r
{\r
// flush\r
- WaitForResponseTimeout(CMD_ACK,NULL,100);\r
+ clearCommandBuffer();\r
+ //WaitForResponseTimeout(CMD_ACK,NULL,100);\r
CmdsParse(CommandTable, Cmd);\r
return 0;\r
}\r
}
-static command_t CommandTable[] =
-{
+static command_t CommandTable[] = {
{"help", CmdHelp, 1, "This help"},
{"info", CmdHF14ADesInfo, 0, "Get MIFARE DesFire information"},
{"enum", CmdHF14ADesEnumApplications,0, "Tries enumerate all applications"},
{NULL, NULL, 0, NULL}
};
-int CmdHFMFDes(const char *Cmd)
-{
+int CmdHFMFDes(const char *Cmd) {
// flush
- WaitForResponseTimeout(CMD_ACK,NULL,100);
- CmdsParse(CommandTable, Cmd);
- return 0;
+ clearCommandBuffer();
+ //WaitForResponseTimeout(CMD_ACK,NULL,100);
+ CmdsParse(CommandTable, Cmd);
+ return 0;
}
-int CmdHelp(const char *Cmd)
-{
- CmdsHelp(CommandTable);
- return 0;
+int CmdHelp(const char *Cmd) {
+ CmdsHelp(CommandTable);
+ return 0;
}
int CmdHFMFDesfire(const char *Cmd){
// flush
- WaitForResponseTimeout(CMD_ACK,NULL,100);
+ clearCommandBuffer();
+ //WaitForResponseTimeout(CMD_ACK,NULL,100);
CmdsParse(CommandTable, Cmd);
return 0;
}
};
int CmdHFMFUltra(const char *Cmd){
- WaitForResponseTimeout(CMD_ACK,NULL,100);
+ clearCommandBuffer();
+ //WaitForResponseTimeout(CMD_ACK,NULL,100);
CmdsParse(CommandTable, Cmd);
return 0;
}
struct Crypto1State *p1, *p2, *p3, *p4;\r
\r
// flush queue\r
- WaitForResponseTimeout(CMD_ACK,NULL,100);\r
+ clearCommandBuffer();\r
+ //WaitForResponseTimeout(CMD_ACK,NULL,100);\r
\r
UsbCommand c = {CMD_MIFARE_NESTED, {blockNo + keyType * 0x100, trgBlockNo + trgKeyType * 0x100, calibrate}};\r
memcpy(c.d.asBytes, key, 6);\r