lf indala reader - support continuous mode

This commit is contained in:
iceman1001 2020-11-29 11:39:36 +01:00
commit 2a4fbe6ddc

View file

@ -9,13 +9,10 @@
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
#include "cmdlfindala.h" #include "cmdlfindala.h"
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <ctype.h> #include <ctype.h>
#include <inttypes.h> #include <inttypes.h>
#include "cmdparser.h" // command_t #include "cmdparser.h" // command_t
#include "comms.h" #include "comms.h"
#include "graph.h" #include "graph.h"
@ -28,6 +25,8 @@
#include "cmdlf.h" // lf_read #include "cmdlf.h" // lf_read
#include "protocols.h" // t55 defines #include "protocols.h" // t55 defines
#include "cmdlft55xx.h" // verifywrite #include "cmdlft55xx.h" // verifywrite
#include "cliparser.h"
#include "cmdlfem4x05.h" // EM defines
#define INDALA_ARR_LEN 64 #define INDALA_ARR_LEN 64
@ -499,16 +498,33 @@ static int CmdIndalaDemodAlt(const char *Cmd) {
} }
// this read is the "normal" read, which download lf signal and tries to demod here. // this read is the "normal" read, which download lf signal and tries to demod here.
static int CmdIndalaRead(const char *Cmd) { static int CmdIndalaReader(const char *Cmd) {
char cmdp = tolower(param_getchar(Cmd, 0)); CLIParserContext *ctx;
if (cmdp == 'h') return usage_lf_indala_demod(); CLIParserInit(&ctx, "lf indala reader",
"read a Indala Prox tag",
"lf indala reader -@ -> continuous reader mode"
);
int clk = 32, invert = 0, maxErr = 100; void *argtable[] = {
if (strlen(Cmd) > 0) { arg_param_begin,
sscanf(Cmd, "%i %i %i", &clk, &invert, &maxErr); arg_int0(NULL, "clock", "<dec>", "optional - set clock (as integer), if not set, autodetect."),
} arg_int0(NULL, "maxerr", "<dec>", "optional - set maximum allowed errors, default = 100"),
lf_read(false, 30000); arg_lit0("i", "invert", "optional - invert output"),
return demodIndalaEx(clk, invert, maxErr, true); arg_lit0("@", NULL, "optional - continuous reader mode"),
arg_param_end
};
CLIExecWithReturn(ctx, Cmd, argtable, true);
uint32_t clk = arg_get_u32_def(ctx, 1, 32);
uint32_t max_err = arg_get_u32_def(ctx, 2, 100);
bool invert = arg_get_lit(ctx, 3);
bool cm = arg_get_lit(ctx, 4);
CLIParserFree(ctx);
do {
lf_read(false, 30000);
demodIndalaEx(clk, invert, max_err, !cm);
} while (cm && !kbd_enter_pressed());
return PM3_SUCCESS;
} }
static int CmdIndalaSim(const char *Cmd) { static int CmdIndalaSim(const char *Cmd) {
@ -699,7 +715,7 @@ static command_t CommandTable[] = {
{"help", CmdHelp, AlwaysAvailable, "this help"}, {"help", CmdHelp, AlwaysAvailable, "this help"},
{"demod", CmdIndalaDemod, AlwaysAvailable, "demodulate an indala tag (PSK1) from GraphBuffer"}, {"demod", CmdIndalaDemod, AlwaysAvailable, "demodulate an indala tag (PSK1) from GraphBuffer"},
{"altdemod", CmdIndalaDemodAlt, AlwaysAvailable, "alternative method to Demodulate samples for Indala 64 bit UID (option '224' for 224 bit)"}, {"altdemod", CmdIndalaDemodAlt, AlwaysAvailable, "alternative method to Demodulate samples for Indala 64 bit UID (option '224' for 224 bit)"},
{"read", CmdIndalaRead, IfPm3Lf, "read an Indala Prox tag from the antenna"}, {"reader", CmdIndalaReader, IfPm3Lf, "read an Indala Prox tag from the antenna"},
{"clone", CmdIndalaClone, IfPm3Lf, "clone Indala tag to T55x7 or Q5/T5555"}, {"clone", CmdIndalaClone, IfPm3Lf, "clone Indala tag to T55x7 or Q5/T5555"},
{"sim", CmdIndalaSim, IfPm3Lf, "simulate Indala tag"}, {"sim", CmdIndalaSim, IfPm3Lf, "simulate Indala tag"},
{NULL, NULL, NULL, NULL} {NULL, NULL, NULL, NULL}