static int CmdHelp(const char *Cmd);
int usage_lf_fdx_clone(void){
- PrintAndLog("clone a FDX-B Animal tag to a T55x7 tag.");
- PrintAndLog("Usage: lf fdx clone [h] <country id> <animal id> <Q5>");
+ PrintAndLog("Clone a FDX-B animal tag to a T55x7 tag.");
+ PrintAndLog("Usage: lf animal clone [h] <country id> <animal id> <Q5>");
PrintAndLog("Options:");
PrintAndLog(" h : This help");
PrintAndLog(" <country id> : Country id");
//reserved/rfu
//is animal tag
// extended data
- PrintAndLog(" <Q5> : specify write to Q5 (t5555 instead of t55x7)");
+ PrintAndLog(" <Q5> : Specify write to Q5 (t5555 instead of t55x7)");
PrintAndLog("");
- PrintAndLog("Sample: lf fdx clone 999 112233");
+ PrintAndLog("Sample: lf animal clone 999 112233");
return 0;
}
int usage_lf_fdx_sim(void) {
- PrintAndLog("Enables simulation of FDX-B Animal tag");
+ PrintAndLog("Enables simulation of FDX-B animal tag");
PrintAndLog("Simulation runs until the button is pressed or another USB command is issued.");
PrintAndLog("");
- PrintAndLog("Usage: lf fdx sim [h] <country id> <animal id>");
+ PrintAndLog("Usage: lf animal sim [h] <country id> <animal id>");
PrintAndLog("Options:");
PrintAndLog(" h : This help");
- PrintAndLog(" <country id> : Country id");
- PrintAndLog(" <animal id> : Animal id");
+ PrintAndLog(" <country id> : Country ID");
+ PrintAndLog(" <animal id> : Animal ID");
PrintAndLog("");
- PrintAndLog("Sample: lf fdx sim 999 112233");
+ PrintAndLog("Sample: lf animal sim 999 112233");
return 0;
}
// clearing the topbit needed for the preambl detection.
}
}
-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
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);
}
setDemodBuf(DemodBuffer, 128, ans);
+ setGrid_Clock(32);
// remove marker bits (1's every 9th digit after preamble) (pType = 2)
size = removeParity(DemodBuffer, 11, 9, 2, 117);
if ( size != 104 ) {
uint16_t calcCrc = crc16_ccitt_kermit(raw, 8);
PrintAndLog("\nFDX-B / ISO 11784/5 Animal Tag ID Found: Raw : %s", sprint_hex(raw, 8));
- PrintAndLog("Animal ID %04u-%012llu", countryCode, NationalCode);
- PrintAndLog("National Code %012llu (0x%llX)", NationalCode, NationalCode);
+ PrintAndLog("Animal ID %04u-%012" PRIu64, countryCode, NationalCode);
+ PrintAndLog("National Code %012" PRIu64 " (0x%" PRIx64 ")", NationalCode, NationalCode);
PrintAndLog("Country Code %04u", countryCode);
PrintAndLog("Reserved/RFU %u (0x04%X)", reservedCode, reservedCode);
PrintAndLog("");
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));
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);
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;
}
static command_t CommandTable[] = {
{"help", CmdHelp, 1, "This help"},
- {"demod", CmdFdxDemod,1, "Attempt extract tag data from graphbuf"},
+ {"demod", CmdFdxDemod,1, "Attempt to extract tag data from graphbuf"},
{"read", CmdFdxRead, 0, "Attempt to read and extract tag data"},
{"clone", CmdFdxClone,0, "Clone animal ID tag to T55x7"},
{"sim", CmdFdxSim, 0, "Animal ID tag simulator"},