lf cmdread: change --crc to --crc-ht

This commit is contained in:
Philippe Teuwen 2021-12-18 14:39:54 +01:00
commit 2389d899b1
2 changed files with 6 additions and 3 deletions

View file

@ -3,6 +3,7 @@ All notable changes to this project will be documented in this file.
This project uses the changelog in accordance with [keepchangelog](http://keepachangelog.com/). Please use this to write notable changes, which is not the same as git commit log...
## [unreleased][unreleased]
- Added option `--crc-ht` to `lf cmdread` to compute and add CRC-8/HITAG (@doegox)
- Added option `-k` to `lf cmdread` to keep field on (@doegox)
- Added `hf mf acl` - decode and print MIFARE access rights (@iceman1001)
- Added for readline, <tab> autocomplete work inside pm3 client (@iceman1001)

View file

@ -233,7 +233,7 @@ int CmdLFCommandRead(const char *Cmd) {
arg_u64_0("s", "samples", "<dec>", "number of samples to collect"),
arg_lit0("v", "verbose", "verbose output"),
arg_lit0("k", "keep", "keep signal field ON after receive"),
arg_lit0(NULL, "crc", "calculate and append CRC-8 Hitag/ZX8211"),
arg_lit0(NULL, "crc-ht", "calculate and append CRC-8/HITAG (also for ZX8211)"),
arg_lit0("@", NULL, "continuous mode"),
arg_param_end
};
@ -253,7 +253,7 @@ int CmdLFCommandRead(const char *Cmd) {
uint32_t samples = arg_get_u32_def(ctx, 6, 0);
bool verbose = arg_get_lit(ctx, 7);
bool keep_field_on = arg_get_lit(ctx, 8);
bool add_crc = arg_get_lit(ctx, 9);
bool add_crc_ht = arg_get_lit(ctx, 9);
bool cm = arg_get_lit(ctx, 10);
CLIParserFree(ctx);
@ -279,7 +279,9 @@ int CmdLFCommandRead(const char *Cmd) {
payload.keep_field_on = keep_field_on;
payload.verbose = verbose;
if (add_crc && (cmd_len <= 120)) {
if (add_crc_ht && (cmd_len <= 120)) {
// Hitag 1, Hitag S, ZX8211
// width=8 poly=0x1d init=0xff refin=false refout=false xorout=0x00 check=0xb4 residue=0x00 name="CRC-8/HITAG"
crc_t crc;
uint8_t data = 0;
uint8_t n = 0;