mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-20 21:33:47 -07:00
fix lf search - cotag exiting on deviceside
This commit is contained in:
parent
2cabfd7e9d
commit
2613284dfc
3 changed files with 32 additions and 4 deletions
|
@ -509,11 +509,22 @@ void doCotagAcquisition(void) {
|
||||||
bool firsthigh = false, firstlow = false;
|
bool firsthigh = false, firstlow = false;
|
||||||
uint16_t i = 0, noise_counter = 0;
|
uint16_t i = 0, noise_counter = 0;
|
||||||
|
|
||||||
|
uint16_t checker = 0;
|
||||||
|
|
||||||
while ((i < bufsize - 1) && (noise_counter < COTAG_T1 << 1)) {
|
while ((i < bufsize - 1) && (noise_counter < COTAG_T1 << 1)) {
|
||||||
|
|
||||||
if (BUTTON_PRESS())
|
if (BUTTON_PRESS())
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
if (checker == 4000) {
|
||||||
|
if (data_available())
|
||||||
|
break;
|
||||||
|
else
|
||||||
|
checker = 0;
|
||||||
|
} else {
|
||||||
|
++checker;
|
||||||
|
}
|
||||||
|
|
||||||
WDT_HIT();
|
WDT_HIT();
|
||||||
|
|
||||||
if (AT91C_BASE_SSC->SSC_SR & AT91C_SSC_RXRDY) {
|
if (AT91C_BASE_SSC->SSC_SR & AT91C_SSC_RXRDY) {
|
||||||
|
@ -567,12 +578,22 @@ uint16_t doCotagAcquisitionManchester(uint8_t *dest, uint16_t destlen) {
|
||||||
bool firsthigh = false, firstlow = false;
|
bool firsthigh = false, firstlow = false;
|
||||||
uint8_t curr = 0, prev = 0;
|
uint8_t curr = 0, prev = 0;
|
||||||
uint16_t i = 0;
|
uint16_t i = 0;
|
||||||
uint16_t period = 0;
|
uint16_t period = 0, checker = 0;
|
||||||
|
|
||||||
while ((i < destlen) && BUTTON_PRESS() == false) {
|
while ((i < destlen) && BUTTON_PRESS() == false) {
|
||||||
|
|
||||||
WDT_HIT();
|
WDT_HIT();
|
||||||
|
|
||||||
|
if (checker == 4000) {
|
||||||
|
if (data_available())
|
||||||
|
break;
|
||||||
|
else
|
||||||
|
checker = 0;
|
||||||
|
} else {
|
||||||
|
++checker;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if (AT91C_BASE_SSC->SSC_SR & AT91C_SSC_RXRDY) {
|
if (AT91C_BASE_SSC->SSC_SR & AT91C_SSC_RXRDY) {
|
||||||
volatile uint8_t sample = (uint8_t)AT91C_BASE_SSC->SSC_RHR;
|
volatile uint8_t sample = (uint8_t)AT91C_BASE_SSC->SSC_RHR;
|
||||||
|
|
||||||
|
|
|
@ -1434,8 +1434,8 @@ int CmdLFfind(const char *Cmd) {
|
||||||
return PM3_SUCCESS;
|
return PM3_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (readCOTAGUid()) {
|
|
||||||
PrintAndLogEx(INPLACE, "Searching for COTAG tag...");
|
PrintAndLogEx(INPLACE, "Searching for COTAG tag...");
|
||||||
|
if (readCOTAGUid()) {
|
||||||
PrintAndLogEx(SUCCESS, "\nValid " _GREEN_("COTAG ID") " found!");
|
PrintAndLogEx(SUCCESS, "\nValid " _GREEN_("COTAG ID") " found!");
|
||||||
return PM3_SUCCESS;
|
return PM3_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
|
@ -122,15 +122,23 @@ static int CmdCOTAGReader(const char *Cmd) {
|
||||||
SendCommandNG(CMD_LF_COTAG_READ, (uint8_t *)&payload, sizeof(payload));
|
SendCommandNG(CMD_LF_COTAG_READ, (uint8_t *)&payload, sizeof(payload));
|
||||||
|
|
||||||
uint8_t timeout = 3;
|
uint8_t timeout = 3;
|
||||||
|
int res = PM3_SUCCESS;
|
||||||
while (!WaitForResponseTimeout(CMD_LF_COTAG_READ, &resp, 2000)) {
|
while (!WaitForResponseTimeout(CMD_LF_COTAG_READ, &resp, 2000)) {
|
||||||
timeout--;
|
timeout--;
|
||||||
PrintAndLogEx(NORMAL, "." NOLF);
|
PrintAndLogEx(NORMAL, "." NOLF);
|
||||||
if (timeout == 0) {
|
if (timeout == 0) {
|
||||||
|
PrintAndLogEx(NORMAL, "");
|
||||||
PrintAndLogEx(WARNING, "command execution time out");
|
PrintAndLogEx(WARNING, "command execution time out");
|
||||||
return PM3_ETIMEOUT;
|
SendCommandNG(CMD_BREAK_LOOP, NULL, 0);
|
||||||
|
timeout = 1;
|
||||||
|
res = PM3_ETIMEOUT;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (res != PM3_SUCCESS) {
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
if (timeout != 3)
|
if (timeout != 3)
|
||||||
PrintAndLogEx(NORMAL, "");
|
PrintAndLogEx(NORMAL, "");
|
||||||
|
|
||||||
|
@ -157,7 +165,6 @@ static command_t CommandTable[] = {
|
||||||
{"reader", CmdCOTAGReader, IfPm3Lf, "Attempt to read and extract tag data"},
|
{"reader", CmdCOTAGReader, IfPm3Lf, "Attempt to read and extract tag data"},
|
||||||
{NULL, NULL, NULL, NULL}
|
{NULL, NULL, NULL, NULL}
|
||||||
};
|
};
|
||||||
|
|
||||||
static int CmdHelp(const char *Cmd) {
|
static int CmdHelp(const char *Cmd) {
|
||||||
(void)Cmd; // Cmd is not used so far
|
(void)Cmd; // Cmd is not used so far
|
||||||
CmdsHelp(CommandTable);
|
CmdsHelp(CommandTable);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue