mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-21 22:03:42 -07:00
refactor continuous mode
This commit is contained in:
parent
fcc70f7536
commit
8f954ebf9d
3 changed files with 33 additions and 39 deletions
|
@ -311,18 +311,7 @@ int CmdHFSniff(const char *Cmd) {
|
||||||
return PM3_SUCCESS;
|
return PM3_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
int CmdHFPlot(const char *Cmd) {
|
int handle_hf_plot(void) {
|
||||||
CLIParserContext *ctx;
|
|
||||||
CLIParserInit(&ctx, "hf plot",
|
|
||||||
"Plots HF signal after RF signal path and A/D conversion.",
|
|
||||||
"This can be used after any hf command and will show the last few milliseconds of the HF signal.\n"
|
|
||||||
"Note: If the last hf command terminated because of a timeout you will most probably see nothing.\n");
|
|
||||||
void *argtable[] = {
|
|
||||||
arg_param_begin,
|
|
||||||
arg_param_end
|
|
||||||
};
|
|
||||||
CLIExecWithReturn(ctx, Cmd, argtable, true);
|
|
||||||
CLIParserFree(ctx);
|
|
||||||
|
|
||||||
uint8_t buf[FPGA_TRACE_SIZE];
|
uint8_t buf[FPGA_TRACE_SIZE];
|
||||||
|
|
||||||
|
@ -333,7 +322,7 @@ int CmdHFPlot(const char *Cmd) {
|
||||||
}
|
}
|
||||||
|
|
||||||
for (size_t i = 0; i < FPGA_TRACE_SIZE; i++) {
|
for (size_t i = 0; i < FPGA_TRACE_SIZE; i++) {
|
||||||
GraphBuffer[i] = ((int)buf[i]) - 127;
|
GraphBuffer[i] = ((int)buf[i]) - 128;
|
||||||
}
|
}
|
||||||
|
|
||||||
GraphTraceLen = FPGA_TRACE_SIZE;
|
GraphTraceLen = FPGA_TRACE_SIZE;
|
||||||
|
@ -349,6 +338,22 @@ int CmdHFPlot(const char *Cmd) {
|
||||||
return PM3_SUCCESS;
|
return PM3_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int CmdHFPlot(const char *Cmd) {
|
||||||
|
CLIParserContext *ctx;
|
||||||
|
CLIParserInit(&ctx, "hf plot",
|
||||||
|
"Plots HF signal after RF signal path and A/D conversion.",
|
||||||
|
"This can be used after any hf command and will show the last few milliseconds of the HF signal.\n"
|
||||||
|
"Note: If the last hf command terminated because of a timeout you will most probably see nothing.\n");
|
||||||
|
void *argtable[] = {
|
||||||
|
arg_param_begin,
|
||||||
|
arg_param_end
|
||||||
|
};
|
||||||
|
CLIExecWithReturn(ctx, Cmd, argtable, true);
|
||||||
|
CLIParserFree(ctx);
|
||||||
|
|
||||||
|
return handle_hf_plot();
|
||||||
|
}
|
||||||
|
|
||||||
static command_t CommandTable[] = {
|
static command_t CommandTable[] = {
|
||||||
|
|
||||||
{"--------", CmdHelp, AlwaysAvailable, "----------------------- " _CYAN_("High Frequency") " -----------------------"},
|
{"--------", CmdHelp, AlwaysAvailable, "----------------------- " _CYAN_("High Frequency") " -----------------------"},
|
||||||
|
|
|
@ -19,4 +19,5 @@ int CmdHFSearch(const char *Cmd);
|
||||||
int CmdHFSniff(const char *Cmd);
|
int CmdHFSniff(const char *Cmd);
|
||||||
int CmdHFPlot(const char *Cmd);
|
int CmdHFPlot(const char *Cmd);
|
||||||
|
|
||||||
|
int handle_hf_plot(void);
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -27,10 +27,8 @@
|
||||||
#include "crc16.h"
|
#include "crc16.h"
|
||||||
#include "util_posix.h" // msclock
|
#include "util_posix.h" // msclock
|
||||||
#include "aidsearch.h"
|
#include "aidsearch.h"
|
||||||
#include "proxgui.h"
|
#include "cmdhf.h" // handle HF plot
|
||||||
#include "cmddata.h"
|
|
||||||
#include "graph.h"
|
|
||||||
#include "fpga.h"
|
|
||||||
|
|
||||||
bool APDUInFramingEnable = true;
|
bool APDUInFramingEnable = true;
|
||||||
|
|
||||||
|
@ -569,34 +567,24 @@ static int CmdHF14AReader(const char *Cmd) {
|
||||||
}
|
}
|
||||||
plot:
|
plot:
|
||||||
if (continuous) {
|
if (continuous) {
|
||||||
uint8_t buf[FPGA_TRACE_SIZE];
|
res = handle_hf_plot();
|
||||||
|
if (res != PM3_SUCCESS) {
|
||||||
PacketResponseNG response;
|
break;
|
||||||
if (!GetFromDevice(FPGA_MEM, buf, FPGA_TRACE_SIZE, 0, NULL, 0, &response, 4000, true)) {
|
}
|
||||||
PrintAndLogEx(WARNING, "timeout while waiting for reply.");
|
|
||||||
return PM3_ETIMEOUT;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (size_t i = 0; i < FPGA_TRACE_SIZE; i++) {
|
|
||||||
GraphBuffer[i] = ((int)buf[i]) - 127;
|
|
||||||
}
|
|
||||||
|
|
||||||
GraphTraceLen = FPGA_TRACE_SIZE;
|
|
||||||
|
|
||||||
// remove signal offset
|
|
||||||
CmdHpf("");
|
|
||||||
|
|
||||||
setClockGrid(0, 0);
|
|
||||||
DemodBufferLen = 0;
|
|
||||||
RepaintGraphWindow();
|
|
||||||
}
|
|
||||||
if (kbd_enter_pressed()) {
|
if (kbd_enter_pressed()) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
} while (continuous);
|
} while (continuous);
|
||||||
|
|
||||||
if (disconnectAfter) {
|
if (disconnectAfter) {
|
||||||
if (!silent) PrintAndLogEx(INFO, "field dropped.");
|
if (silent == false) {
|
||||||
|
PrintAndLogEx(INFO, "field dropped.");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (continuous)
|
if (continuous)
|
||||||
return PM3_SUCCESS;
|
return PM3_SUCCESS;
|
||||||
else
|
else
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue