+ uint8_t got[12000];\r
+ GetFromBigBuf(got,sizeof(got),0);\r
+ WaitForResponse(CMD_ACK,NULL);\r
+ setGraphBuf(got, 12000);\r
+\r
+ DecodeT55xxBlock();\r
+ printT55xxBlock("");\r
+ return 0;\r
+}\r
+\r
+void DecodeT55xxBlock(){\r
+ \r
+ char buf[6] = {0x00};\r
+ char *cmdStr = buf;\r
+\r
+ // clearing the DemodBuffer.\r
+ DemodBufferLen = 0x00;\r
+ \r
+ // use the configuration\r
+ switch( config.modulation ){\r
+ case 1:\r
+ sprintf(cmdStr,"0 %d", config.inversed );\r
+ FSKrawDemod(cmdStr, FALSE);\r
+ break;\r
+ case 2:\r
+ sprintf(cmdStr,"0 %d 1", config.inversed );\r
+ ASKmanDemod(cmdStr, FALSE, FALSE);\r
+ break;\r
+ case 3:\r
+ sprintf(cmdStr,"0 %d 1", config.inversed );\r
+ PSKDemod(cmdStr, FALSE);\r
+ break;\r
+ case 4:\r
+ sprintf(cmdStr,"0 %d 1", config.inversed );\r
+ NRZrawDemod(cmdStr, FALSE);\r
+ break;\r
+ case 5:\r
+ //BiphaseRawDecode("0",FALSE);\r
+ break;\r
+ default:\r
+ return;\r
+ }\r
+}\r
+\r
+int CmdT55xxDetect(const char *Cmd){\r
+ char cmdp = param_getchar(Cmd, 0);\r
+ if (cmdp == 'h' || cmdp == 'H')\r
+ return usage_t55xx_detect();\r
+ \r
+ // read block 0, Page 0. Configuration.\r
+ UsbCommand c = {CMD_T55XX_READ_BLOCK, {0, 0, 0}};\r
+ c.d.asBytes[0] = 0x0; \r
+\r
+ //Password mode\r
+ // if ( res == 2 ) {\r
+ // c.arg[2] = password;\r
+ // c.d.asBytes[0] = 0x1; \r
+ // }\r
+\r
+ SendCommand(&c);\r
+ if ( !WaitForResponseTimeout(CMD_ACK,NULL,2500) ) {\r
+ PrintAndLog("command execution time out");\r
+ return FALSE;\r
+ }\r
+ \r
+ uint8_t got[12000];\r
+ GetFromBigBuf(got,sizeof(got),0);\r
+ WaitForResponse(CMD_ACK,NULL);\r
+ setGraphBuf(got, 12000);\r
+ \r
+ if ( !tryDetectModulation() ){\r
+ PrintAndLog("Could not detect modulation automatically. Try setting it manually with \'lf t55xx config\'");\r
+ }\r
+ return 0;\r
+}\r