fix lf search when running it without any tag on it. In short hitag get uid loop on device side just sits an waits

This commit is contained in:
iceman1001 2024-02-20 00:42:35 +01:00
commit 392c251c81
2 changed files with 10 additions and 3 deletions

View file

@ -1665,7 +1665,7 @@ int CmdLFfind(const char *Cmd) {
if (is_online) { if (is_online) {
if (IfPm3Hitag()) { if (IfPm3Hitag()) {
if (readHitagUid()) { if (readHitagUid() == PM3_SUCCESS) {
PrintAndLogEx(SUCCESS, "\nValid " _GREEN_("Hitag") " found!"); PrintAndLogEx(SUCCESS, "\nValid " _GREEN_("Hitag") " found!");
if (search_cont) { if (search_cont) {
found++; found++;

View file

@ -447,7 +447,6 @@ static bool getHitag2Uid(uint32_t *uid) {
if (uid) { if (uid) {
*uid = bytes_to_num(resp.data.asBytes, HITAG_UID_SIZE); *uid = bytes_to_num(resp.data.asBytes, HITAG_UID_SIZE);
} }
return true; return true;
} }
@ -645,6 +644,7 @@ static int CmdLFHitagReader(const char *Cmd) {
PacketResponseNG resp; PacketResponseNG resp;
if (WaitForResponseTimeout(CMD_ACK, &resp, 2000) == false) { if (WaitForResponseTimeout(CMD_ACK, &resp, 2000) == false) {
PrintAndLogEx(WARNING, "timeout while waiting for reply."); PrintAndLogEx(WARNING, "timeout while waiting for reply.");
SendCommandNG(CMD_BREAK_LOOP, NULL, 0);
return PM3_ETIMEOUT; return PM3_ETIMEOUT;
} }
if (resp.oldarg[0] == false) { if (resp.oldarg[0] == false) {
@ -1343,6 +1343,13 @@ int CmdLFHitag(const char *Cmd) {
} }
int readHitagUid(void) { int readHitagUid(void) {
return (CmdLFHitagReader("--ht2 --pwd") == PM3_SUCCESS); uint32_t uid = 0;
if (getHitag2Uid(&uid) == false) {
return PM3_ESOFT;
}
PrintAndLogEx(SUCCESS, "UID.... " _GREEN_("%08X"), uid);
PrintAndLogEx(SUCCESS, "TYPE... " _GREEN_("%s"), getHitagTypeStr(uid));
return PM3_SUCCESS;
} }