CHG: help text changes in cmdlfjablotron.c

CHG: increase byte size to uint16_t in crc.c CRC16Legic
This commit is contained in:
iceman1001 2016-07-29 20:58:52 +02:00
commit 514ddaa2ff
3 changed files with 16 additions and 12 deletions

View file

@ -14,32 +14,36 @@ static int CmdHelp(const char *Cmd);
int usage_legic_calccrc8(void){ int usage_legic_calccrc8(void){
PrintAndLog("Calculates the legic crc8/crc16 on the input hexbytes."); PrintAndLog("Calculates the legic crc8/crc16 on the input hexbytes.");
PrintAndLog("There must be an even number of hexsymbols as input."); PrintAndLog("There must be an even number of hexsymbols as input.");
PrintAndLog("Usage: hf legic crc8 [h] b <hexbytes> u <uidcrc>"); PrintAndLog("Usage: hf legic crc8 [h] b <hexbytes> u <uidcrc> c <crc type>");
PrintAndLog("Options :"); PrintAndLog("Options:");
PrintAndLog(" b <hexbytes> : hex bytes"); PrintAndLog(" b <hexbytes> : hex bytes");
PrintAndLog(" u <uidcrc> : MCC hexbyte"); PrintAndLog(" u <uidcrc> : MCC hexbyte");
PrintAndLog(" c <crc type> : 8|16 bit crc size");
PrintAndLog(""); PrintAndLog("");
PrintAndLog("Samples :"); PrintAndLog("Samples:");
PrintAndLog(" hf legic crc8 b deadbeef1122"); PrintAndLog(" hf legic crc8 b deadbeef1122");
PrintAndLog(" hf legic crc8 b deadbeef1122 u 9A"); PrintAndLog(" hf legic crc8 b deadbeef1122 u 9A c 16");
return 0; return 0;
} }
int usage_legic_load(void){ int usage_legic_load(void){
PrintAndLog("It loads datasamples from the file `filename` to device memory"); PrintAndLog("It loads datasamples from the file `filename` to device memory");
PrintAndLog("Usage: hf legic load <file name>"); PrintAndLog("Usage: hf legic load <file name>");
PrintAndLog(" sample: hf legic load filename"); PrintAndLog("");
PrintAndLog("Samples:");
PrintAndLog(" hf legic load filename");
return 0; return 0;
} }
int usage_legic_read(void){ int usage_legic_read(void){
PrintAndLog("Read data from a legic tag."); PrintAndLog("Read data from a legic tag.");
PrintAndLog("Usage: hf legic read <offset> <num of bytes>"); PrintAndLog("Usage: hf legic read <offset> <num of bytes>");
PrintAndLog("Options :"); PrintAndLog("Options:");
PrintAndLog(" <offset> : offset in data array to start download from"); PrintAndLog(" <offset> : offset in data array to start download from");
PrintAndLog(" <num of bytes> : number of bytes to download"); PrintAndLog(" <num of bytes> : number of bytes to download");
PrintAndLog(""); PrintAndLog("");
PrintAndLog(" sample: hf legic read"); PrintAndLog("Samples:");
PrintAndLog(" hf legic read");
return 0; return 0;
} }
@ -621,7 +625,7 @@ int CmdLegicCalcCrc8(const char *Cmd){
break; break;
} }
free(data); if (data != NULL) free(data);
return 0; return 0;
} }

View file

@ -18,7 +18,7 @@ int usage_lf_jablotron_clone(void){
PrintAndLog(" <card ID> : jablotron card ID"); PrintAndLog(" <card ID> : jablotron card ID");
PrintAndLog(" <Q5> : specify write to Q5 (t5555 instead of t55x7)"); PrintAndLog(" <Q5> : specify write to Q5 (t5555 instead of t55x7)");
PrintAndLog(""); PrintAndLog("");
PrintAndLog("Sample: lf jablotron clone d 112233"); PrintAndLog("Sample: lf jablotron clone 112233");
return 0; return 0;
} }
@ -31,7 +31,7 @@ int usage_lf_jablotron_sim(void) {
PrintAndLog(" h : This help"); PrintAndLog(" h : This help");
PrintAndLog(" <card ID> : jablotron card ID"); PrintAndLog(" <card ID> : jablotron card ID");
PrintAndLog(""); PrintAndLog("");
PrintAndLog("Sample: lf jablotron sim d 112233"); PrintAndLog("Sample: lf jablotron sim 112233");
return 0; return 0;
} }

View file

@ -99,8 +99,8 @@ uint32_t CRC8Legic(uint8_t *buff, size_t size) {
uint32_t CRC16Legic(uint8_t *buff, size_t size, uint8_t uidcrc) { uint32_t CRC16Legic(uint8_t *buff, size_t size, uint8_t uidcrc) {
#define CRC16_POLY_LEGIC 0xB400 #define CRC16_POLY_LEGIC 0xB400
//uint8_t initial = reflect(uidcrc, 8); uint16_t initial = reflect(uidcrc, 8);
uint16_t initial = uidcrc; //uint16_t initial = uidcrc;
initial |= initial << 8; initial |= initial << 8;
crc_t crc; crc_t crc;
crc_init_ref(&crc, 16, CRC16_POLY_LEGIC, initial, 0, TRUE, TRUE); crc_init_ref(&crc, 16, CRC16_POLY_LEGIC, initial, 0, TRUE, TRUE);