]> git.zerfleddert.de Git - proxmark3-svn/blobdiff - client/cmdlffdx.c
ADD: new settings file for buspirate and at91sam7s512 ref: https://github.com/Proxmar...
[proxmark3-svn] / client / cmdlffdx.c
index 6c0f0751a576cd5e24cdb4d56c35d42dbf469c29..292ebad6617e1a5472b5d7638688051121ace189 100644 (file)
@@ -72,12 +72,6 @@ static void verify_values(uint32_t countryid, uint64_t animalid){
        }
 }
 
-static uint16_t getFDXchksum (uint64_t raw){
-       uint8_t arr[8];
-       num_to_bytes(raw, 64, arr);
-       return crc16_ccitt_kermit(arr, 8);
-}
-
 int getFDXBits(uint64_t national_id, uint16_t country, uint8_t isanimal, uint8_t isextended, uint32_t extended, uint8_t *bits) {
 
     // add preamble ten 0x00 and one 0x01
@@ -117,7 +111,7 @@ int getFDXBits(uint64_t national_id, uint16_t country, uint8_t isanimal, uint8_t
        for (uint8_t i=0; i<8; ++i)
                raw[i] = bytebits_to_byte(bits + 11 + i * 9, 8);
                
-       crc = crc16_ccitt_kermit(raw, 8);
+       uint16_t crc = crc16_ccitt_kermit(raw, 8);
        num_to_bytebitsLSBF(crc >> 0, 8, bits+83);
        num_to_bytebitsLSBF(crc >> 8, 8, bits+92);
        
@@ -208,7 +202,7 @@ int CmdFdxClone(const char *Cmd) {
 
        uint32_t countryid = 0;
        uint64_t animalid = 0;
-       uint32_t blocks[5] = {T55x7_MODULATION_DIPHASE | T55x7_BITRATE_RF_32 | 4<<T55x7_MAXBLOCK_SHIFT, 0, 0, 0, 0};
+       uint32_t blocks[5] = {T55x7_MODULATION_DIPHASE | T55x7_BITRATE_RF_32 | 4 << T55x7_MAXBLOCK_SHIFT, 0, 0, 0, 0};
        uint8_t bits[128];
        uint8_t *bs = bits;
        memset(bs, 0, sizeof(bits));
@@ -220,9 +214,9 @@ int CmdFdxClone(const char *Cmd) {
        animalid = param_get64ex(Cmd, 1, 0, 10);
        
        //Q5
-       if (param_getchar(Cmd, 1) == 'Q' || param_getchar(Cmd, 1) == 'q') {
+       if (param_getchar(Cmd, 2) == 'Q' || param_getchar(Cmd, 2) == 'q') {
                //t5555 (Q5) BITRATE = (RF-2)/2 (iceman)
-               blocks[0] = T5555_MODULATION_BIPHASE | T5555_INVERT_OUTPUT | 32<<T5555_BITRATE_SHIFT | 4<<T5555_MAXBLOCK_SHIFT;
+               blocks[0] = T5555_MODULATION_BIPHASE | T5555_INVERT_OUTPUT | ((32-2)>>1) << T5555_BITRATE_SHIFT | 4 << T5555_MAXBLOCK_SHIFT;
        }
        
        verify_values(countryid, animalid);
@@ -256,7 +250,7 @@ int CmdFdxClone(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