Merge pull request #1719 from merlokk/tk_get_grafbug

get samples from graph buffer instead of reading
This commit is contained in:
Oleg Moiseenko 2022-07-18 12:49:07 +03:00 committed by GitHub
commit 47a8fd4ad5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -577,14 +577,16 @@ static int CmdHFTexkomReader(const char *Cmd) {
void *argtable[] = { void *argtable[] = {
arg_param_begin, arg_param_begin,
arg_lit0("g", "gbuffer", "Get data from graph buffer"),
arg_lit0("v", "verbose", "Verbose scan and output"), arg_lit0("v", "verbose", "Verbose scan and output"),
arg_lit0("@", NULL, "optional - continuous reader mode"), arg_lit0("@", NULL, "optional - continuous reader mode"),
arg_param_end arg_param_end
}; };
CLIExecWithReturn(ctx, Cmd, argtable, true); CLIExecWithReturn(ctx, Cmd, argtable, true);
bool verbose = arg_get_lit(ctx, 1); bool gbuffer = arg_get_lit(ctx, 1);
bool cm = arg_get_lit(ctx, 2); bool verbose = arg_get_lit(ctx, 2);
bool cm = arg_get_lit(ctx, 3);
CLIParserFree(ctx); CLIParserFree(ctx);
@ -594,21 +596,25 @@ static int CmdHFTexkomReader(const char *Cmd) {
} }
uint32_t samplesCount = 30000; uint32_t samplesCount = 30000;
clearCommandBuffer(); if (gbuffer) {
SendCommandNG(CMD_HF_ACQ_RAW_ADC, (uint8_t *)&samplesCount, sizeof(uint32_t)); samplesCount = g_GraphTraceLen;
} else {
clearCommandBuffer();
SendCommandNG(CMD_HF_ACQ_RAW_ADC, (uint8_t *)&samplesCount, sizeof(uint32_t));
PacketResponseNG resp; PacketResponseNG resp;
if (!WaitForResponseTimeout(CMD_HF_ACQ_RAW_ADC, &resp, 2500)) { if (!WaitForResponseTimeout(CMD_HF_ACQ_RAW_ADC, &resp, 2500)) {
PrintAndLogEx(WARNING, "command execution time out"); PrintAndLogEx(WARNING, "command execution time out");
return PM3_ETIMEOUT; return PM3_ETIMEOUT;
} }
uint32_t size = (resp.data.asDwords[0]); uint32_t size = (resp.data.asDwords[0]);
if (size > 0) { if (size > 0) {
if (getSamples(samplesCount, false) != PM3_SUCCESS) { if (getSamples(samplesCount, false) != PM3_SUCCESS) {
PrintAndLogEx(ERR, "Get samples error"); PrintAndLogEx(ERR, "Get samples error");
return PM3_EFAILED; return PM3_EFAILED;
}; };
}
} }
char bitstring[256] = {0}; char bitstring[256] = {0};