Removed automatic version cache clearing, added [nocache] flag to "hw ver" to force cache clearing

This commit is contained in:
LW 2018-02-17 16:02:13 -08:00
commit 6e0b2d0beb
3 changed files with 5 additions and 18 deletions

View file

@ -404,23 +404,14 @@ int CmdTune(const char *Cmd)
}
int CmdVersion(const char *Cmd)
{
return CmdVersionC(Cmd, false);
}
int CmdVersionClearCache()
{
return CmdVersionC(NULL, true);
}
int CmdVersionC(const char *Cmd, const bool clear_cache)
{
UsbCommand c = {CMD_VERSION};
static UsbCommand resp = {0, {0, 0, 0}};
if (clear_cache) {
if(*Cmd == 'n') {
PrintAndLog("Version Cache Cleared");
PrintAndLog("");
memset( &resp, 0, sizeof(resp) );
return 0;
}
clearCommandBuffer();
@ -483,7 +474,7 @@ static command_t CommandTable[] =
{"setlfdivisor", CmdSetDivisor, 0, "<19 - 255> -- Drive LF antenna at 12Mhz/(divisor+1)"},
{"setmux", CmdSetMux, 0, "<loraw|hiraw|lopkd|hipkd> -- Set the ADC mux to a specific value"},
{"tune", CmdTune, 0, "['l'|'h'] -- Measure antenna tuning (option 'l' or 'h' to limit to LF or HF)"},
{"version", CmdVersion, 0, "Show version information about the connected Proxmark"},
{"version", CmdVersion, 0, "['n'] -- Show version information about the connected Proxmark (option 'nocache' to force getting version from hardware)"},
{"status", CmdStatus, 0, "Show runtime status information about the connected Proxmark"},
{"ping", CmdPing, 0, "Test if the pm3 is responsive"},
{NULL, NULL, 0, NULL}

View file

@ -23,7 +23,5 @@ int CmdSetDivisor(const char *Cmd);
int CmdSetMux(const char *Cmd);
int CmdTune(const char *Cmd);
int CmdVersion(const char *Cmd);
int CmdVersionClearCache();
int CmdVersionC(const char *Cmd, const bool clear_cache);
#endif

View file

@ -72,7 +72,6 @@ static void *uart_receiver(void *targ) {
struct receiver_arg *arg = (struct receiver_arg*)targ;
size_t rxlen;
bool need_reconnect = false;
UsbCommand version_cmd = {CMD_VERSION};
while (arg->run) {
if( need_reconnect ) {
@ -95,7 +94,6 @@ static void *uart_receiver(void *targ) {
need_reconnect = false;
offline = 0;
clearCommandBuffer();
CmdVersionClearCache();
}
rxlen = 0;
@ -145,7 +143,7 @@ void main_loop(char *script_cmds_file, char *script_cmd, bool usb_present) {
rarg.run = 1;
pthread_create(&reader_thread, NULL, &uart_receiver, &rarg);
// cache Version information now:
CmdVersion(NULL);
CmdVersion("nocache");
}
// file with script