\r
if (CmdDetectClockRate("f")){ //wave is almost certainly FSK\r
// FSK\r
- if ( FSKrawDemod("0 0", FALSE))\r
+ if ( FSKrawDemod("0 0", FALSE) && test())\r
printT55xx("FSK");\r
// FSK inverted\r
- if ( FSKrawDemod("0 1", FALSE)) \r
+ if ( FSKrawDemod("0 1", FALSE) && test()) \r
printT55xx("FSK inv");\r
} else {\r
// ASK/MAN (autoclock, normal, maxerrors 1)\r
- if ( ASKmanDemod("0 0 1", FALSE, FALSE) )\r
+ if ( ASKmanDemod("0 0 1", FALSE, FALSE) && test()) \r
printT55xx("ASK/MAN");\r
\r
// ASK/MAN (autoclock, inverted, maxerrors 1)\r
- if ( ASKmanDemod("0 1 1", FALSE, FALSE) )\r
+ if ( ASKmanDemod("0 1 1", FALSE, FALSE) && test()) \r
printT55xx("ASK/MAN Inv");\r
\r
// NZR (autoclock, normal, maxerrors 1)\r
- if ( NRZrawDemod("0 0 1", FALSE) )\r
+ if ( NRZrawDemod("0 0 1", FALSE) && test()) \r
printT55xx("NZR");\r
// NZR (autoclock, inverted, maxerrors 1)\r
- if ( NRZrawDemod("0 1 1", FALSE) )\r
+ if ( NRZrawDemod("0 1 1", FALSE) && test()) \r
printT55xx("NZR inv");\r
\r
// PSK (autoclock, normal, maxerrors 1)\r
- if (!PSKDemod("0 0 1", FALSE))\r
+ if ( PSKDemod("0 0 1", FALSE) && test()) \r
printT55xx("PSK");\r
\r
// PSK (autoclock, inverted, maxerrors 1)\r
- if (!PSKDemod("0 1 1", FALSE))\r
+ if ( PSKDemod("0 1 1", FALSE) && test()) \r
printT55xx("PSK inv");\r
\r
//PSK2?\r
\r
- // if (!BiphaseRawDecode("0",FALSE))\r
+ // if (!BiphaseRawDecode("0",FALSE) && test()) \r
// printT55xx("BIPHASE");\r
\r
- // if (!BiphaseRawDecode("1",FALSE))\r
+ // if (!BiphaseRawDecode("1",FALSE) && test()) \r
// printT55xx("BIPHASE inv");\r
}\r
return 0;\r
}\r
+bool test(){\r
+\r
+ if ( !DemodBufferLen) \r
+ return false;\r
+ \r
+ uint8_t si = 1;\r
+ uint8_t safer = PackBits(si, 4, DemodBuffer); si += 4; \r
+ uint8_t resv = PackBits(si, 7, DemodBuffer); si += 7+3;\r
+ uint8_t extend = PackBits(si, 1, DemodBuffer); si += 1;\r
+\r
+ //PrintAndLog("test: %X %X %X ", safer, resv, extend);\r
+ \r
+ // 2nibble must be zeroed.\r
+ if ( resv > 0x00) return FALSE;\r
+\r
+ if ( safer == 0x6 || safer == 0x9){\r
+ if ( extend == 0x00)\r
+ return TRUE;\r
+ }\r
+ if ( resv== 0x00) return TRUE;\r
+ return FALSE;\r
+}\r
\r
void printT55xx(const char *demodStr){\r
\r
uint32_t resv = PackBits(si, 7, bits); si += 7;\r
uint32_t dbr = PackBits(si, 3, bits); si += 3;\r
uint32_t extend = PackBits(si, 1, bits); si += 1;\r
- uint32_t datamodulation = PackBits(si, 5, bits); si += 5;\r
+ uint32_t datamod = PackBits(si, 5, bits); si += 5;\r
uint32_t pskcf = PackBits(si, 2, bits); si += 2;\r
uint32_t aor = PackBits(si, 1, bits); si += 1; \r
uint32_t otp = PackBits(si, 1, bits); si += 1; \r
PrintAndLog(" reserved : %d", resv);\r
PrintAndLog(" Data bit rate : %s", GetBitRateStr(dbr));\r
PrintAndLog(" eXtended mode : %s", (extend) ? "Yes - Warning":"No");\r
- PrintAndLog(" Modulation : %s", GetModulationStr(datamodulation) );\r
+ PrintAndLog(" Modulation : %s", GetModulationStr(datamod));\r
PrintAndLog(" PSK clock freq : %d", pskcf);\r
PrintAndLog(" AOR - Answer on Request : %s", (aor) ? "Yes":"No");\r
PrintAndLog(" OTP - One Time Pad : %s", (otp) ? "Yes - Warning":"No" );\r
PrintAndLog(" Max block : %d", maxblk);\r
PrintAndLog(" Password mode : %s", (pwd) ? "Yes":"No");\r
PrintAndLog(" Sequence Start Terminator : %s", (sst) ? "Yes":"No");\r
- PrintAndLog(" Fast Write : %s", (fw) ? "Yes":"No");\r
+ PrintAndLog(" Fast Write : %s", (fw) ? "Yes":"No");\r
PrintAndLog(" Inverse data : %s", (inv) ? "Yes":"No");\r
PrintAndLog(" POR-Delay : %s", (por) ? "Yes":"No");\r
PrintAndLog("-------------------------------------------------------------");\r
\r
sprintf(retStr,"%d",id);\r
if (id == 6) {\r
- sprintf(retStr,"%d - pasdwd",id);\r
+ sprintf(retStr,"%d - passwd",id);\r
}\r
if (id == 9 ){\r
- sprintf(retStr,"%d - testmode ",id);\r
+ sprintf(retStr,"%d - testmode",id);\r
}\r
\r
return buf;\r