print modulation type

This commit is contained in:
merlokk 2022-06-28 00:31:42 +03:00
commit 383dc934d6
2 changed files with 31 additions and 14 deletions

View file

@ -333,7 +333,7 @@ static int CmdHFTexkomReader(const char *Cmd) {
char bitstring[256] = {0}; char bitstring[256] = {0};
char cbitstring[128] = {0}; char cbitstring[128] = {0};
bool codefound = false; int codefound = TexkomModError;
uint32_t sindx = 0; uint32_t sindx = 0;
while (sindx < samplesCount - 5) { while (sindx < samplesCount - 5) {
sindx = TexkomSearchStart(sindx, TEXKOM_NOISE_THRESHOLD); sindx = TexkomSearchStart(sindx, TEXKOM_NOISE_THRESHOLD);
@ -377,7 +377,7 @@ static int CmdHFTexkomReader(const char *Cmd) {
// 65 impulses and 64 intervals // 65 impulses and 64 intervals
if (impulsecnt == 65) { if (impulsecnt == 65) {
if (TexcomTK17Decode(implengths, implengthslen, bitstring, cbitstring, verbose)) { if (TexcomTK17Decode(implengths, implengthslen, bitstring, cbitstring, verbose)) {
codefound = true; codefound = TexkomModTK17;
break; break;
} }
} }
@ -445,11 +445,11 @@ static int CmdHFTexkomReader(const char *Cmd) {
if ((strlen(cbitstring) != 64) || (strncmp(cbitstring, "1111111111111111", 16) != 0)) if ((strlen(cbitstring) != 64) || (strncmp(cbitstring, "1111111111111111", 16) != 0))
continue; continue;
codefound = true; codefound = TexkomModTK13;
break; break;
} }
if (codefound) { if (codefound != TexkomModError) {
uint8_t tcode[8] = {0}; uint8_t tcode[8] = {0};
for (uint32_t i = 0; i < strlen(cbitstring); i++) { for (uint32_t i = 0; i < strlen(cbitstring); i++) {
tcode[i / 8] = (tcode[i / 8] << 1) | ((cbitstring[i] == '1') ? 1 : 0); tcode[i / 8] = (tcode[i / 8] << 1) | ((cbitstring[i] == '1') ? 1 : 0);
@ -464,8 +464,17 @@ static int CmdHFTexkomReader(const char *Cmd) {
if (!verbose) if (!verbose)
PrintAndLogEx(INFO, "Texkom: %s", sprint_hex(tcode, 8)); PrintAndLogEx(INFO, "Texkom: %s", sprint_hex(tcode, 8));
if (codefound == TexkomModTK13)
PrintAndLogEx(INFO, "modulation: TK13");
else if (codefound == TexkomModTK17)
PrintAndLogEx(INFO, "modulation: TK17");
else
PrintAndLogEx(INFO, "modulation: unknown");
if (tcode[2] == 0x63) { if (tcode[2] == 0x63) {
// TK13 // TK13
if (codefound != TexkomModTK13)
PrintAndLogEx(WARNING, " mod type: WRONG");
PrintAndLogEx(INFO, "type : TK13"); PrintAndLogEx(INFO, "type : TK13");
PrintAndLogEx(INFO, "uid : %s", sprint_hex(&tcode[3], 4)); PrintAndLogEx(INFO, "uid : %s", sprint_hex(&tcode[3], 4));
@ -476,6 +485,8 @@ static int CmdHFTexkomReader(const char *Cmd) {
} else if (tcode[2] == 0xca) { } else if (tcode[2] == 0xca) {
// TK17 // TK17
if (codefound != TexkomModTK17)
PrintAndLogEx(WARNING, " mod type: WRONG");
PrintAndLogEx(INFO, "type : TK17"); PrintAndLogEx(INFO, "type : TK17");
PrintAndLogEx(INFO, "uid : %s", sprint_hex(&tcode[3], 4)); PrintAndLogEx(INFO, "uid : %s", sprint_hex(&tcode[3], 4));

View file

@ -30,6 +30,12 @@ enum TK17Bits {
TK17Bit11 TK17Bit11
}; };
enum TexkomModulation {
TexkomModError,
TexkomModTK13,
TexkomModTK17
};
int CmdHFTexkom(const char *Cmd); int CmdHFTexkom(const char *Cmd);
#endif #endif