]> cvs.zerfleddert.de Git - proxmark3-svn/blobdiff - client/cmdlfpresco.c
ADD: `analyse nuid` - generates NUID 4byte from a UID 7byte. Mifare Classic Ev1...
[proxmark3-svn] / client / cmdlfpresco.c
index 36f99107bc8eddb493104c7b32c8d971b0508e3f..3afb3d24e845fdef8d30107dbb7a6a8c1987a08b 100644 (file)
@@ -116,13 +116,12 @@ int GetPrescoBits(uint32_t fullcode, uint8_t *prescoBits) {
 //see ASKDemod for what args are accepted
 int CmdPrescoDemod(const char *Cmd) {
        bool st = true;
-
-       if (!ASKDemod_ext("32 0 0", FALSE, FALSE, 1, &st)) {
+       if (!ASKDemod_ext("32 0 0 0 0 a", FALSE, FALSE, 1, &st)) {
                if (g_debugMode) PrintAndLog("DEBUG: Error Presco ASKDemod failed");
                return 0;
        }
        size_t size = DemodBufferLen;
-       //call lfdemod.c demod for Viking
+       //call lfdemod.c demod for Presco
        int ans = PrescoDemod(DemodBuffer, &size);
        if (ans < 0) {
                if (g_debugMode){
@@ -138,6 +137,7 @@ int CmdPrescoDemod(const char *Cmd) {
                return 0;
        }
        setDemodBuf(DemodBuffer, 128, ans);
+       setGrid_Clock(32);
        
        //got a good demod
        uint32_t raw1 = bytebits_to_byte(DemodBuffer, 32);
@@ -163,7 +163,7 @@ int CmdPrescoRead(const char *Cmd) {
        // read lf silently
        CmdLFRead("s");
        // get samples silently
-       getSamples("20000", TRUE);
+       getSamples("12000", TRUE);
        // demod and output Presco ID   
        return CmdPrescoDemod(Cmd);
 }
@@ -174,14 +174,14 @@ int CmdPrescoClone(const char *Cmd) {
 
        bool Q5 = false;
        uint32_t sitecode=0, usercode=0, fullcode=0;
-       uint32_t blocks[5] = {T55x7_MODULATION_MANCHESTER | T55x7_BITRATE_RF_32 | 4<<T55x7_MAXBLOCK_SHIFT | T55x7_ST_TERMINATOR, 0, 0, 0, 5};
+       uint32_t blocks[5] = {T55x7_MODULATION_MANCHESTER | T55x7_BITRATE_RF_32 | 4 << T55x7_MAXBLOCK_SHIFT | T55x7_ST_TERMINATOR, 0, 0, 0, 0};
        
        // get wiegand from printed number.
        if (GetWiegandFromPresco(Cmd, &sitecode, &usercode, &fullcode, &Q5) == -1) return usage_lf_presco_clone();
 
        if (Q5)
                //t5555 (Q5) BITRATE = (RF-2)/2 (iceman)
-               blocks[0] = T5555_MODULATION_MANCHESTER | 32<<T5555_BITRATE_SHIFT | 4<<T5555_MAXBLOCK_SHIFT | T5555_ST_TERMINATOR;
+               blocks[0] = T5555_MODULATION_MANCHESTER | ((32-2)>>1) << T5555_BITRATE_SHIFT | 4 << T5555_MAXBLOCK_SHIFT | T5555_ST_TERMINATOR;
 
        if ((sitecode & 0xFF) != sitecode) {
                sitecode &= 0xFF;
@@ -215,7 +215,7 @@ int CmdPrescoClone(const char *Cmd) {
                c.arg[1] = i;
                clearCommandBuffer();
                SendCommand(&c);
-               if (!WaitForResponseTimeout(CMD_ACK, &resp, 1000)){
+               if (!WaitForResponseTimeout(CMD_ACK, &resp, T55XX_WRITE_TIMEOUT)){
                        PrintAndLog("Error occurred, device did not respond during write operation.");
                        return -1;
                }
Impressum, Datenschutz