hf 14b reader - added simple ask ct detection

This commit is contained in:
iceman1001 2020-10-02 01:29:21 +02:00
parent d7046ee89c
commit affd92f79a

View file

@ -810,6 +810,39 @@ static bool HF14B_Std_Reader(bool verbose) {
return is_success;
}
static bool HF14B_ask_ct_Reader(bool verbose) {
uint8_t cmd[] = {0x10};
uint8_t datalen = 1;
// 14b get and print UID only (general info)
uint32_t flags = ISO14B_CONNECT | ISO14B_RAW | ISO14B_APPEND_CRC;
clearCommandBuffer();
PacketResponseNG resp;
SendCommandMIX(CMD_HF_ISO14443B_COMMAND, flags, datalen, 0, cmd, sizeof(cmd));
if (!WaitForResponseTimeout(CMD_HF_ISO14443B_COMMAND, &resp, TIMEOUT)) {
if (verbose) PrintAndLogEx(WARNING, "command execution timeout");
switch_off_field_14b();
return false;
}
int status = resp.oldarg[0];
PrintAndLogEx(DEBUG, "status %d", status);
bool retval = false;
if (status == 0) {
PrintAndLogEx(SUCCESS, "\nASK CT - 14443-3b tag found:");
retval = true;
} else if (status > 0) {
PrintAndLogEx(SUCCESS, "\nASK CT - 14443-3b tag found:");
PrintAndLogEx(SUCCESS, "%s", sprint_hex(resp.data.asBytes, status));
retval = true;
}
switch_off_field_14b();
return retval;
}
// test for other 14b type tags (mimic another reader - don't have tags to identify)
static bool HF14B_Other_Reader(bool verbose) {
@ -1749,6 +1782,9 @@ int readHF14B(bool verbose) {
if (HF14B_Other_Reader(verbose))
return 1;
if (HF14B_ask_ct_Reader(verbose))
return 1;
if (verbose) PrintAndLogEx(FAILED, "no 14443-B tag found");
return 0;
}