This commit is contained in:
iceman1001 2020-08-26 14:37:39 +02:00
commit d6e3366c43
2 changed files with 25 additions and 9 deletions

View file

@ -954,7 +954,11 @@ static void PacketReceived(PacketCommandNG *packet) {
break;
}
case CMD_LF_COTAG_READ: {
Cotag(packet->oldarg[0]);
struct p {
uint8_t mode;
} PACKED;
struct p *payload = (struct p *)packet->data.asBytes;
Cotag(payload->mode);
break;
}
#endif

View file

@ -82,21 +82,33 @@ static int CmdCOTAGDemod(const char *Cmd) {
// 2 = raw signal - maxlength bigbuff
static int CmdCOTAGRead(const char *Cmd) {
if (tolower(Cmd[0]) == 'h') return usage_lf_cotag_read();
if (tolower(Cmd[0]) == 'h')
return usage_lf_cotag_read();
uint32_t rawsignal = 1;
sscanf(Cmd, "%u", &rawsignal);
struct p {
uint8_t mode;
} PACKED payload;
payload.mode = param_get8ex(Cmd, 0, 1, 10);
PacketResponseNG resp;
clearCommandBuffer();
SendCommandMIX(CMD_LF_COTAG_READ, rawsignal, 0, 0, NULL, 0);
SendCommandNG(CMD_LF_COTAG_READ, (uint8_t*)&payload, sizeof(payload));
if (!WaitForResponseTimeout(CMD_LF_COTAG_READ, &resp, 7000)) {
PrintAndLogEx(WARNING, "command execution time out");
return PM3_ETIMEOUT;
uint8_t timeout = 3;
while (!WaitForResponseTimeout(CMD_LF_COTAG_READ, &resp, 2000)) {
timeout--;
printf(".");
fflush(stdout);
if (timeout == 0) {
PrintAndLogEx(WARNING, "command execution time out");
return PM3_ETIMEOUT;
}
}
if (timeout != 3)
PrintAndLogEx(NORMAL, "");
switch (rawsignal) {
switch (payload.mode) {
case 0:
case 2: {
CmdPlot("");