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; break;
} }
case CMD_LF_COTAG_READ: { 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; break;
} }
#endif #endif

View file

@ -82,21 +82,33 @@ static int CmdCOTAGDemod(const char *Cmd) {
// 2 = raw signal - maxlength bigbuff // 2 = raw signal - maxlength bigbuff
static int CmdCOTAGRead(const char *Cmd) { 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; struct p {
sscanf(Cmd, "%u", &rawsignal); uint8_t mode;
} PACKED payload;
payload.mode = param_get8ex(Cmd, 0, 1, 10);
PacketResponseNG resp; PacketResponseNG resp;
clearCommandBuffer(); 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)) { 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"); PrintAndLogEx(WARNING, "command execution time out");
return PM3_ETIMEOUT; return PM3_ETIMEOUT;
} }
}
if (timeout != 3)
PrintAndLogEx(NORMAL, "");
switch (rawsignal) { switch (payload.mode) {
case 0: case 0:
case 2: { case 2: {
CmdPlot(""); CmdPlot("");