]> git.zerfleddert.de Git - proxmark3-svn/blobdiff - client/cmdlft55xx.c
added the changes from PM3 master.
[proxmark3-svn] / client / cmdlft55xx.c
index 513eb0ef668683334191f388243951ba5567cfc3..6ea9d2d3a575beff7868050ab5a298284abc01b6 100644 (file)
@@ -46,18 +46,17 @@ int CmdReadBlk(const char *Cmd)
        SendCommand(&c);\r
        WaitForResponse(CMD_ACK, NULL);\r
        \r
        SendCommand(&c);\r
        WaitForResponse(CMD_ACK, NULL);\r
        \r
-//     uint8_t data[LF_TRACE_BUFF_SIZE] = {0x00};\r
+       uint8_t data[LF_TRACE_BUFF_SIZE] = {0x00};\r
        \r
        \r
-       // GetFromBigBuf(data,LF_TRACE_BUFF_SIZE,3560);  //3560 -- should be offset..\r
-       // WaitForResponseTimeout(CMD_ACK,NULL, 1500);\r
-\r
-       // for (int j = 0; j < LF_TRACE_BUFF_SIZE; j++) {\r
-               // GraphBuffer[j] = (int)data[j];\r
-       // }\r
-       // GraphTraceLen = LF_TRACE_BUFF_SIZE;\r
-       CmdSamples("12000");\r
+       GetFromBigBuf(data,LF_TRACE_BUFF_SIZE,3560);  //3560 -- should be offset..\r
+       WaitForResponseTimeout(CMD_ACK,NULL, 1500);\r
+\r
+       for (int j = 0; j < LF_TRACE_BUFF_SIZE; j++) {\r
+               GraphBuffer[j] = (int)data[j];\r
+       }\r
+       GraphTraceLen = LF_TRACE_BUFF_SIZE;\r
        ManchesterDemod(block);\r
        ManchesterDemod(block);\r
-       // RepaintGraphWindow();\r
+       RepaintGraphWindow();\r
   return 0;\r
 }\r
 \r
   return 0;\r
 }\r
 \r
@@ -321,7 +320,7 @@ int CmdDump(const char *Cmd){
                        return 0;\r
                }\r
        }\r
                        return 0;\r
                }\r
        }\r
-\r
+       \r
        for ( int i = 0; i <8; ++i){\r
                memset(s,0,sizeof(s));\r
                if ( hasPwd ) {\r
        for ( int i = 0; i <8; ++i){\r
                memset(s,0,sizeof(s));\r
                if ( hasPwd ) {\r
@@ -352,6 +351,7 @@ int ManchesterDemod(int blockNum){
        if (!HasGraphData()) return 0;\r
                \r
        uint8_t sizebyte = 32;\r
        if (!HasGraphData()) return 0;\r
                \r
        uint8_t sizebyte = 32;\r
+       // the value 5 was selected during empirical studies of the decoded data. Some signal noise to skip.\r
        uint8_t offset = 5;\r
        uint32_t blockData;\r
        uint8_t  bits[LF_BITSSTREAM_LEN] = {0x00};\r
        uint8_t offset = 5;\r
        uint32_t blockData;\r
        uint8_t  bits[LF_BITSSTREAM_LEN] = {0x00};\r
@@ -468,6 +468,9 @@ uint32_t PackBits(uint8_t start, uint8_t len, uint8_t* bits){
        \r
        int i = start;\r
        int j = len-1;\r
        \r
        int i = start;\r
        int j = len-1;\r
+       if (len > 32) {\r
+               return 0;\r
+       }\r
        uint32_t tmp = 0;\r
        for (; j >= 0; --j, ++i){\r
                tmp     |= bits[i] << j;\r
        uint32_t tmp = 0;\r
        for (; j >= 0; --j, ++i){\r
                tmp     |= bits[i] << j;\r
Impressum, Datenschutz