]> git.zerfleddert.de Git - proxmark3-svn/blobdiff - client/cmdlfem4x.c
Merge branch 'graphwork2' into graphwork
[proxmark3-svn] / client / cmdlfem4x.c
index 7eb6070dc424623802ac975ab878561aed9178ee..66c4221ac91e1932ecaaea0ee93ecafcd5440bb9 100644 (file)
@@ -146,17 +146,20 @@ void printEM410x(uint32_t hi, uint64_t id)
 int AskEm410xDecode(bool verbose, uint32_t *hi, uint64_t *lo )
 {
        size_t idx = 0;
-       size_t BitLen = DemodBufferLen;
-       uint8_t BitStream[MAX_GRAPH_TRACE_LEN]={0};
-       memcpy(BitStream, DemodBuffer, BitLen); 
-       if (Em410xDecode(BitStream, &BitLen, &idx, hi, lo)){
+       uint8_t BitStream[512]={0};
+       size_t BitLen = sizeof(BitStream);
+       if ( !getDemodBuf(BitStream, &BitLen) ) return 0;
+
+       if (Em410xDecode(BitStream, &BitLen, &idx, hi, lo)) {
                //set GraphBuffer for clone or sim command
-               setDemodBuf(BitStream, BitLen, idx);
-               if (g_debugMode){
+               setDemodBuf(DemodBuffer, (BitLen==40) ? 64 : 128, idx+1);
+               setClockGrid(g_DemodClock, g_DemodStartIdx + ((idx+1)*g_DemodClock));
+
+               if (g_debugMode) {
                        PrintAndLog("DEBUG: idx: %d, Len: %d, Printing Demod Buffer:", idx, BitLen);
                        printDemodBuff();
                }
-               if (verbose){
+               if (verbose) {
                        PrintAndLog("EM410x pattern found: ");
                        printEM410x(*hi, *lo);
                        g_em410xId = *lo;
@@ -298,9 +301,7 @@ int CmdEM410xWatch(const char *Cmd)
                        printf("\naborted via keyboard!\n");
                        break;
                }
-               
-               CmdLFRead("s");
-               getSamples("8201",true); 
+               lf_read(true, 8201);
        } while (!CmdAskEM410xDemod(""));
 
        return 0;
@@ -704,6 +705,8 @@ bool EM4x05testDemodReadData(uint32_t *word, bool readCmd) {
                }
 
                setDemodBuf(DemodBuffer, 32, 0);
+               //setClockGrid(0,0);
+
                *word = bytebits_to_byteLSBF(DemodBuffer, 32);
        }
        return true;
Impressum, Datenschutz