mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-21 22:03:42 -07:00
added the timeout to preferences, so its stored in the pref file but... there need to be adaptations to the uart_p*/uart_w* files to use the the session value..
This commit is contained in:
parent
748b0f0874
commit
78e1a84515
4 changed files with 118 additions and 50 deletions
|
@ -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...
|
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]
|
## [unreleased][unreleased]
|
||||||
|
- Added client communication timeout to preferences (@iceman1001)
|
||||||
- Added IPv6 support (@wh201906)
|
- Added IPv6 support (@wh201906)
|
||||||
- Fixed `lf hid clone --bin` - now correctly handles sentinel bits (@iceman1001)
|
- Fixed `lf hid clone --bin` - now correctly handles sentinel bits (@iceman1001)
|
||||||
- Experimental UDP support in linux (@iceman1001, @wh201906)
|
- Experimental UDP support in linux (@iceman1001, @wh201906)
|
||||||
|
|
|
@ -932,13 +932,12 @@ static int CmdTimeout(const char *Cmd) {
|
||||||
CLIParserInit(&ctx, "hw timeout",
|
CLIParserInit(&ctx, "hw timeout",
|
||||||
"Set the communication timeout on the client side",
|
"Set the communication timeout on the client side",
|
||||||
"hw timeout --> Show current timeout\n"
|
"hw timeout --> Show current timeout\n"
|
||||||
"hw timeout -t 20 --> Set the timeout to 20ms\n"
|
"hw timeout --ms 500\n"
|
||||||
"hw timeout -t 500 --> Set the timeout to 500ms\n"
|
|
||||||
);
|
);
|
||||||
|
|
||||||
void *argtable[] = {
|
void *argtable[] = {
|
||||||
arg_param_begin,
|
arg_param_begin,
|
||||||
arg_int0("t", "timeout", "<dec>", "timeout in ms"),
|
arg_int0(NULL, "ms", "<ms>", "timeout in micro seconds"),
|
||||||
arg_param_end
|
arg_param_end
|
||||||
};
|
};
|
||||||
CLIExecWithReturn(ctx, Cmd, argtable, true);
|
CLIExecWithReturn(ctx, Cmd, argtable, true);
|
||||||
|
@ -949,20 +948,20 @@ static int CmdTimeout(const char *Cmd) {
|
||||||
|
|
||||||
// timeout is not given/invalid, just show the current timeout then return
|
// timeout is not given/invalid, just show the current timeout then return
|
||||||
if (arg < 0) {
|
if (arg < 0) {
|
||||||
PrintAndLogEx(INFO, "Current communication timeout: %ums", oldTimeout);
|
PrintAndLogEx(INFO, "Current communication timeout... " _GREEN_("%u") " ms", oldTimeout);
|
||||||
return PM3_SUCCESS;
|
return PM3_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t newTimeout = arg;
|
uint32_t newTimeout = arg;
|
||||||
// UART_USB_CLIENT_RX_TIMEOUT_MS is considered as the minimum required timeout.
|
// UART_USB_CLIENT_RX_TIMEOUT_MS is considered as the minimum required timeout.
|
||||||
if (newTimeout < UART_USB_CLIENT_RX_TIMEOUT_MS) {
|
if (newTimeout < UART_USB_CLIENT_RX_TIMEOUT_MS) {
|
||||||
PrintAndLogEx(WARNING, "Timeout less than %ums might cause errors.", UART_USB_CLIENT_RX_TIMEOUT_MS);
|
PrintAndLogEx(WARNING, "Timeout less than %u ms might cause errors.", UART_USB_CLIENT_RX_TIMEOUT_MS);
|
||||||
} else if (newTimeout > 5000) {
|
} else if (newTimeout > 5000) {
|
||||||
PrintAndLogEx(WARNING, "Timeout greater than 5000ms makes the client unresponsive.");
|
PrintAndLogEx(WARNING, "Timeout greater than 5000 ms makes the client unresponsive.");
|
||||||
}
|
}
|
||||||
uart_reconfigure_timeouts(newTimeout);
|
uart_reconfigure_timeouts(newTimeout);
|
||||||
PrintAndLogEx(INFO, "Old communication timeout: %ums", oldTimeout);
|
PrintAndLogEx(INFO, "Old communication timeout... %u ms", oldTimeout);
|
||||||
PrintAndLogEx(INFO, "New communication timeout: %ums", newTimeout);
|
PrintAndLogEx(INFO, "New communication timeout... " _GREEN_("%u") " ms", newTimeout);
|
||||||
return PM3_SUCCESS;
|
return PM3_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -34,6 +34,7 @@
|
||||||
#include <dirent.h>
|
#include <dirent.h>
|
||||||
#include <proxmark3.h>
|
#include <proxmark3.h>
|
||||||
#include "cliparser.h"
|
#include "cliparser.h"
|
||||||
|
#include "uart/uart.h" // uart_reconfigure_timeouts
|
||||||
|
|
||||||
static int CmdHelp(const char *Cmd);
|
static int CmdHelp(const char *Cmd);
|
||||||
static int setCmdHelp(const char *Cmd);
|
static int setCmdHelp(const char *Cmd);
|
||||||
|
@ -52,6 +53,8 @@ int preferences_load(void) {
|
||||||
// Set all defaults
|
// Set all defaults
|
||||||
g_session.client_debug_level = cdbOFF;
|
g_session.client_debug_level = cdbOFF;
|
||||||
// g_session.device_debug_level = ddbOFF;
|
// g_session.device_debug_level = ddbOFF;
|
||||||
|
g_session.timeout = uart_get_timeouts();
|
||||||
|
|
||||||
g_session.window_changed = false;
|
g_session.window_changed = false;
|
||||||
g_session.plot.x = 10;
|
g_session.plot.x = 10;
|
||||||
g_session.plot.y = 30;
|
g_session.plot.y = 30;
|
||||||
|
@ -260,7 +263,7 @@ void preferences_save_callback(json_t *root) {
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
JsonSaveInt(root, "client.exe.delay", g_session.client_exe_delay);
|
JsonSaveInt(root, "client.exe.delay", g_session.client_exe_delay);
|
||||||
|
JsonSaveInt(root, "client.timeout", g_session.timeout);
|
||||||
}
|
}
|
||||||
void preferences_load_callback(json_t *root) {
|
void preferences_load_callback(json_t *root) {
|
||||||
json_error_t up_error = {0};
|
json_error_t up_error = {0};
|
||||||
|
@ -355,6 +358,10 @@ void preferences_load_callback(json_t *root) {
|
||||||
// client command execution delay
|
// client command execution delay
|
||||||
if (json_unpack_ex(root, &up_error, 0, "{s:i}", "client.exe.delay", &i1) == 0)
|
if (json_unpack_ex(root, &up_error, 0, "{s:i}", "client.exe.delay", &i1) == 0)
|
||||||
g_session.client_exe_delay = i1;
|
g_session.client_exe_delay = i1;
|
||||||
|
|
||||||
|
// client command timeout
|
||||||
|
if (json_unpack_ex(root, &up_error, 0, "{s:i}", "client.timeout", &i1) == 0)
|
||||||
|
g_session.timeout = i1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Help Functions
|
// Help Functions
|
||||||
|
@ -379,44 +386,44 @@ static void showEmojiState(prefShowOpt_t opt) {
|
||||||
|
|
||||||
switch (g_session.emoji_mode) {
|
switch (g_session.emoji_mode) {
|
||||||
case EMO_ALIAS:
|
case EMO_ALIAS:
|
||||||
PrintAndLogEx(INFO, " %s emoji.................. "_GREEN_("alias"), prefShowMsg(opt));
|
PrintAndLogEx(INFO, " %s emoji................... "_GREEN_("alias"), prefShowMsg(opt));
|
||||||
break;
|
break;
|
||||||
case EMO_EMOJI:
|
case EMO_EMOJI:
|
||||||
PrintAndLogEx(INFO, " %s emoji.................. "_GREEN_("emoji"), prefShowMsg(opt));
|
PrintAndLogEx(INFO, " %s emoji................... "_GREEN_("emoji"), prefShowMsg(opt));
|
||||||
break;
|
break;
|
||||||
case EMO_ALTTEXT:
|
case EMO_ALTTEXT:
|
||||||
PrintAndLogEx(INFO, " %s emoji.................. "_GREEN_("alttext"), prefShowMsg(opt));
|
PrintAndLogEx(INFO, " %s emoji................... "_GREEN_("alttext"), prefShowMsg(opt));
|
||||||
break;
|
break;
|
||||||
case EMO_NONE:
|
case EMO_NONE:
|
||||||
PrintAndLogEx(INFO, " %s emoji.................. "_GREEN_("none"), prefShowMsg(opt));
|
PrintAndLogEx(INFO, " %s emoji................... "_GREEN_("none"), prefShowMsg(opt));
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
PrintAndLogEx(INFO, " %s emoji.................. "_RED_("unknown"), prefShowMsg(opt));
|
PrintAndLogEx(INFO, " %s emoji................... "_RED_("unknown"), prefShowMsg(opt));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void showColorState(prefShowOpt_t opt) {
|
static void showColorState(prefShowOpt_t opt) {
|
||||||
|
|
||||||
if (g_session.supports_colors)
|
if (g_session.supports_colors)
|
||||||
PrintAndLogEx(INFO, " %s color.................. "_GREEN_("ansi"), prefShowMsg(opt));
|
PrintAndLogEx(INFO, " %s color................... "_GREEN_("ansi"), prefShowMsg(opt));
|
||||||
else
|
else
|
||||||
PrintAndLogEx(INFO, " %s color.................. "_WHITE_("off"), prefShowMsg(opt));
|
PrintAndLogEx(INFO, " %s color................... "_WHITE_("off"), prefShowMsg(opt));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void showClientDebugState(prefShowOpt_t opt) {
|
static void showClientDebugState(prefShowOpt_t opt) {
|
||||||
|
|
||||||
switch (g_session.client_debug_level) {
|
switch (g_session.client_debug_level) {
|
||||||
case cdbOFF:
|
case cdbOFF:
|
||||||
PrintAndLogEx(INFO, " %s client debug........... "_WHITE_("off"), prefShowMsg(opt));
|
PrintAndLogEx(INFO, " %s client debug............ "_WHITE_("off"), prefShowMsg(opt));
|
||||||
break;
|
break;
|
||||||
case cdbSIMPLE:
|
case cdbSIMPLE:
|
||||||
PrintAndLogEx(INFO, " %s client debug........... "_GREEN_("simple"), prefShowMsg(opt));
|
PrintAndLogEx(INFO, " %s client debug............ "_GREEN_("simple"), prefShowMsg(opt));
|
||||||
break;
|
break;
|
||||||
case cdbFULL:
|
case cdbFULL:
|
||||||
PrintAndLogEx(INFO, " %s client debug........... "_GREEN_("full"), prefShowMsg(opt));
|
PrintAndLogEx(INFO, " %s client debug............ "_GREEN_("full"), prefShowMsg(opt));
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
PrintAndLogEx(INFO, " %s client debug........... "_RED_("unknown"), prefShowMsg(opt));
|
PrintAndLogEx(INFO, " %s client debug............ "_RED_("unknown"), prefShowMsg(opt));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
|
@ -448,17 +455,17 @@ static void showSavePathState(savePaths_t path_index, prefShowOpt_t opt) {
|
||||||
char s[50];
|
char s[50];
|
||||||
switch (path_index) {
|
switch (path_index) {
|
||||||
case spDefault:
|
case spDefault:
|
||||||
strcpy(s, "default save path......");
|
strcpy(s, "default save path.......");
|
||||||
break;
|
break;
|
||||||
case spDump:
|
case spDump:
|
||||||
strcpy(s, "dump save path.........");
|
strcpy(s, "dump save path..........");
|
||||||
break;
|
break;
|
||||||
case spTrace:
|
case spTrace:
|
||||||
strcpy(s, "trace save path........");
|
strcpy(s, "trace save path.........");
|
||||||
break;
|
break;
|
||||||
case spItemCount:
|
case spItemCount:
|
||||||
default:
|
default:
|
||||||
strcpy(s, _RED_("unknown")" save path......");
|
strcpy(s, _RED_("unknown")" save path.......");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (path_index < spItemCount) {
|
if (path_index < spItemCount) {
|
||||||
|
@ -478,7 +485,7 @@ static void showSavePathState(savePaths_t path_index, prefShowOpt_t opt) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static void showPlotPosState(void) {
|
static void showPlotPosState(void) {
|
||||||
PrintAndLogEx(INFO, " Plot window............ X "_GREEN_("%4d")" Y "_GREEN_("%4d")" H "_GREEN_("%4d")" W "_GREEN_("%4d"),
|
PrintAndLogEx(INFO, " plot window............. X "_GREEN_("%4d")" Y "_GREEN_("%4d")" H "_GREEN_("%4d")" W "_GREEN_("%4d"),
|
||||||
g_session.plot.x,
|
g_session.plot.x,
|
||||||
g_session.plot.y,
|
g_session.plot.y,
|
||||||
g_session.plot.h,
|
g_session.plot.h,
|
||||||
|
@ -487,7 +494,7 @@ static void showPlotPosState(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static void showOverlayPosState(void) {
|
static void showOverlayPosState(void) {
|
||||||
PrintAndLogEx(INFO, " Slider/Overlay window.. X "_GREEN_("%4d")" Y "_GREEN_("%4d")" H "_GREEN_("%4d")" W "_GREEN_("%4d"),
|
PrintAndLogEx(INFO, " slider/overlay window... X "_GREEN_("%4d")" Y "_GREEN_("%4d")" H "_GREEN_("%4d")" W "_GREEN_("%4d"),
|
||||||
g_session.overlay.x,
|
g_session.overlay.x,
|
||||||
g_session.overlay.y,
|
g_session.overlay.y,
|
||||||
g_session.overlay.h,
|
g_session.overlay.h,
|
||||||
|
@ -497,44 +504,47 @@ static void showOverlayPosState(void) {
|
||||||
|
|
||||||
static void showHintsState(prefShowOpt_t opt) {
|
static void showHintsState(prefShowOpt_t opt) {
|
||||||
if (g_session.show_hints)
|
if (g_session.show_hints)
|
||||||
PrintAndLogEx(INFO, " %s hints.................. "_GREEN_("on"), prefShowMsg(opt));
|
PrintAndLogEx(INFO, " %s hints................... "_GREEN_("on"), prefShowMsg(opt));
|
||||||
else
|
else
|
||||||
PrintAndLogEx(INFO, " %s hints.................. "_WHITE_("off"), prefShowMsg(opt));
|
PrintAndLogEx(INFO, " %s hints................... "_WHITE_("off"), prefShowMsg(opt));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void showPlotSliderState(prefShowOpt_t opt) {
|
static void showPlotSliderState(prefShowOpt_t opt) {
|
||||||
if (g_session.overlay_sliders)
|
if (g_session.overlay_sliders)
|
||||||
PrintAndLogEx(INFO, " %s show plot sliders...... "_GREEN_("on"), prefShowMsg(opt));
|
PrintAndLogEx(INFO, " %s show plot sliders....... "_GREEN_("on"), prefShowMsg(opt));
|
||||||
else
|
else
|
||||||
PrintAndLogEx(INFO, " %s show plot sliders...... "_WHITE_("off"), prefShowMsg(opt));
|
PrintAndLogEx(INFO, " %s show plot sliders....... "_WHITE_("off"), prefShowMsg(opt));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void showBarModeState(prefShowOpt_t opt) {
|
static void showBarModeState(prefShowOpt_t opt) {
|
||||||
|
|
||||||
switch (g_session.bar_mode) {
|
switch (g_session.bar_mode) {
|
||||||
case STYLE_BAR:
|
case STYLE_BAR:
|
||||||
PrintAndLogEx(INFO, " %s barmode................ "_GREEN_("bar"), prefShowMsg(opt));
|
PrintAndLogEx(INFO, " %s barmode................. "_GREEN_("bar"), prefShowMsg(opt));
|
||||||
break;
|
break;
|
||||||
case STYLE_MIXED:
|
case STYLE_MIXED:
|
||||||
PrintAndLogEx(INFO, " %s barmode................ "_GREEN_("mixed"), prefShowMsg(opt));
|
PrintAndLogEx(INFO, " %s barmode................. "_GREEN_("mixed"), prefShowMsg(opt));
|
||||||
break;
|
break;
|
||||||
case STYLE_VALUE:
|
case STYLE_VALUE:
|
||||||
PrintAndLogEx(INFO, " %s barmode................ "_GREEN_("value"), prefShowMsg(opt));
|
PrintAndLogEx(INFO, " %s barmode................. "_GREEN_("value"), prefShowMsg(opt));
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
PrintAndLogEx(INFO, " %s barmode............... "_RED_("unknown"), prefShowMsg(opt));
|
PrintAndLogEx(INFO, " %s barmode................ "_RED_("unknown"), prefShowMsg(opt));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void showOutputState(prefShowOpt_t opt) {
|
static void showOutputState(prefShowOpt_t opt) {
|
||||||
PrintAndLogEx(INFO, " %s output................. %s", prefShowMsg(opt),
|
PrintAndLogEx(INFO, " %s output.................. %s", prefShowMsg(opt),
|
||||||
g_session.dense_output ? _GREEN_("dense") : _WHITE_("normal"));
|
g_session.dense_output ? _GREEN_("dense") : _WHITE_("normal"));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void showClientExeDelayState(void) {
|
static void showClientExeDelayState(void) {
|
||||||
PrintAndLogEx(INFO, " Cmd execution delay.... "_GREEN_("%u"), g_session.client_exe_delay);
|
PrintAndLogEx(INFO, " cmd execution delay..... "_GREEN_("%u"), g_session.client_exe_delay);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void showClientTimeoutState(void) {
|
||||||
|
PrintAndLogEx(INFO, " communication timeout... " _GREEN_("%u") " ms", g_session.timeout);
|
||||||
|
}
|
||||||
|
|
||||||
static int setCmdEmoji(const char *Cmd) {
|
static int setCmdEmoji(const char *Cmd) {
|
||||||
CLIParserContext *ctx;
|
CLIParserContext *ctx;
|
||||||
|
@ -636,9 +646,9 @@ static int setCmdColor(const char *Cmd) {
|
||||||
|
|
||||||
static int setCmdDebug(const char *Cmd) {
|
static int setCmdDebug(const char *Cmd) {
|
||||||
CLIParserContext *ctx;
|
CLIParserContext *ctx;
|
||||||
CLIParserInit(&ctx, "prefs set clientdebug ",
|
CLIParserInit(&ctx, "prefs set client.debug ",
|
||||||
"Set persistent preference of using clientside debug level",
|
"Set persistent preference of using clientside debug level",
|
||||||
"prefs set clientdebug --simple"
|
"prefs set client.debug --simple"
|
||||||
);
|
);
|
||||||
|
|
||||||
void *argtable[] = {
|
void *argtable[] = {
|
||||||
|
@ -798,10 +808,10 @@ static int setCmdOutput(const char *Cmd) {
|
||||||
|
|
||||||
static int setCmdExeDelay(const char *Cmd) {
|
static int setCmdExeDelay(const char *Cmd) {
|
||||||
CLIParserContext *ctx;
|
CLIParserContext *ctx;
|
||||||
CLIParserInit(&ctx, "prefs set clientdelay",
|
CLIParserInit(&ctx, "prefs set client.delay",
|
||||||
"Set persistent preference of delay before executing a command in the client",
|
"Set persistent preference of delay before executing a command in the client",
|
||||||
"prefs set clientdelay --ms 0 --> unsets any delay\n"
|
"prefs set client.delay --ms 0 --> unsets any delay\n"
|
||||||
"prefs set clientdelay --ms 1000 --> sets 1000ms delay"
|
"prefs set client.delay --ms 1000 --> sets 1000ms delay"
|
||||||
);
|
);
|
||||||
|
|
||||||
void *argtable[] = {
|
void *argtable[] = {
|
||||||
|
@ -824,9 +834,46 @@ static int setCmdExeDelay(const char *Cmd) {
|
||||||
return PM3_SUCCESS;
|
return PM3_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int setClientTimeout(const char *Cmd) {
|
||||||
|
CLIParserContext *ctx;
|
||||||
|
CLIParserInit(&ctx, "prefs set client.timeout",
|
||||||
|
"Set persistent preference of client communication timeout",
|
||||||
|
"prefs set client.timeout --ms 0 --> unsets any timeout\n"
|
||||||
|
"prefs set client.timeout --ms 500\n"
|
||||||
|
);
|
||||||
|
|
||||||
|
void *argtable[] = {
|
||||||
|
arg_param_begin,
|
||||||
|
arg_int0(NULL, "ms", "<ms>", "timeout in micro seconds"),
|
||||||
|
arg_param_end
|
||||||
|
};
|
||||||
|
CLIExecWithReturn(ctx, Cmd, argtable, true);
|
||||||
|
uint32_t new_value = (uint32_t)arg_get_int_def(ctx, 1, 0);
|
||||||
|
CLIParserFree(ctx);
|
||||||
|
|
||||||
|
// UART_USB_CLIENT_RX_TIMEOUT_MS is considered as the minimum required timeout.
|
||||||
|
if (new_value < UART_USB_CLIENT_RX_TIMEOUT_MS) {
|
||||||
|
PrintAndLogEx(WARNING, "Timeout less than %u ms might cause errors.", UART_USB_CLIENT_RX_TIMEOUT_MS);
|
||||||
|
} else if (new_value > 5000) {
|
||||||
|
PrintAndLogEx(WARNING, "Timeout greater than 5000 ms makes the client unresponsive.");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (g_session.timeout != new_value) {
|
||||||
|
showClientTimeoutState();
|
||||||
|
g_session.timeout = new_value;
|
||||||
|
uart_reconfigure_timeouts(new_value);
|
||||||
|
showClientTimeoutState();
|
||||||
|
preferences_save();
|
||||||
|
} else {
|
||||||
|
showClientTimeoutState();
|
||||||
|
}
|
||||||
|
return PM3_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static int setCmdHint(const char *Cmd) {
|
static int setCmdHint(const char *Cmd) {
|
||||||
CLIParserContext *ctx;
|
CLIParserContext *ctx;
|
||||||
CLIParserInit(&ctx, "prefs set hints ",
|
CLIParserInit(&ctx, "prefs set hints",
|
||||||
"Set persistent preference of showing hint messages in the client",
|
"Set persistent preference of showing hint messages in the client",
|
||||||
"prefs set hints --on"
|
"prefs set hints --on"
|
||||||
);
|
);
|
||||||
|
@ -1087,9 +1134,9 @@ static int getCmdColor(const char *Cmd) {
|
||||||
|
|
||||||
static int getCmdDebug(const char *Cmd) {
|
static int getCmdDebug(const char *Cmd) {
|
||||||
CLIParserContext *ctx;
|
CLIParserContext *ctx;
|
||||||
CLIParserInit(&ctx, "prefs get clientdebug",
|
CLIParserInit(&ctx, "prefs get client.debug",
|
||||||
"Get preference of using clientside debug level",
|
"Get preference of using clientside debug level",
|
||||||
"prefs get clientdebug"
|
"prefs get client.debug"
|
||||||
);
|
);
|
||||||
void *argtable[] = {
|
void *argtable[] = {
|
||||||
arg_param_begin,
|
arg_param_begin,
|
||||||
|
@ -1169,9 +1216,9 @@ static int getCmdSavePaths(const char *Cmd) {
|
||||||
|
|
||||||
static int getCmdExeDelay(const char *Cmd) {
|
static int getCmdExeDelay(const char *Cmd) {
|
||||||
CLIParserContext *ctx;
|
CLIParserContext *ctx;
|
||||||
CLIParserInit(&ctx, "prefs get clientdelay",
|
CLIParserInit(&ctx, "prefs get client.delay",
|
||||||
"Get preference of delay time before execution of a command in the client",
|
"Get preference of delay time before execution of a command in the client",
|
||||||
"prefs get clientdelay"
|
"prefs get client.delay"
|
||||||
);
|
);
|
||||||
void *argtable[] = {
|
void *argtable[] = {
|
||||||
arg_param_begin,
|
arg_param_begin,
|
||||||
|
@ -1183,10 +1230,27 @@ static int getCmdExeDelay(const char *Cmd) {
|
||||||
return PM3_SUCCESS;
|
return PM3_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int getClientTimeout(const char *Cmd) {
|
||||||
|
CLIParserContext *ctx;
|
||||||
|
CLIParserInit(&ctx, "prefs get client.timeout",
|
||||||
|
"Get preference of delay time before execution of a command in the client",
|
||||||
|
"prefs get client.timeout"
|
||||||
|
);
|
||||||
|
void *argtable[] = {
|
||||||
|
arg_param_begin,
|
||||||
|
arg_param_end
|
||||||
|
};
|
||||||
|
CLIExecWithReturn(ctx, Cmd, argtable, true);
|
||||||
|
CLIParserFree(ctx);
|
||||||
|
showClientTimeoutState();
|
||||||
|
return PM3_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
static command_t CommandTableGet[] = {
|
static command_t CommandTableGet[] = {
|
||||||
{"barmode", getCmdBarMode, AlwaysAvailable, "Get bar mode preference"},
|
{"barmode", getCmdBarMode, AlwaysAvailable, "Get bar mode preference"},
|
||||||
{"clientdebug", getCmdDebug, AlwaysAvailable, "Get client debug level preference"},
|
{"client.debug", getCmdDebug, AlwaysAvailable, "Get client debug level preference"},
|
||||||
{"clientdelay", getCmdExeDelay, AlwaysAvailable, "Get client execution delay preference"},
|
{"client.delay", getCmdExeDelay, AlwaysAvailable, "Get client execution delay preference"},
|
||||||
|
{"client.timeout", getClientTimeout, AlwaysAvailable, "Get client execution delay preference"},
|
||||||
{"color", getCmdColor, AlwaysAvailable, "Get color support preference"},
|
{"color", getCmdColor, AlwaysAvailable, "Get color support preference"},
|
||||||
{"savepaths", getCmdSavePaths, AlwaysAvailable, "Get file folder "},
|
{"savepaths", getCmdSavePaths, AlwaysAvailable, "Get file folder "},
|
||||||
// {"devicedebug", getCmdDeviceDebug, AlwaysAvailable, "Get device debug level"},
|
// {"devicedebug", getCmdDeviceDebug, AlwaysAvailable, "Get device debug level"},
|
||||||
|
@ -1200,8 +1264,10 @@ static command_t CommandTableGet[] = {
|
||||||
static command_t CommandTableSet[] = {
|
static command_t CommandTableSet[] = {
|
||||||
{"help", setCmdHelp, AlwaysAvailable, "This help"},
|
{"help", setCmdHelp, AlwaysAvailable, "This help"},
|
||||||
{"barmode", setCmdBarMode, AlwaysAvailable, "Set bar mode"},
|
{"barmode", setCmdBarMode, AlwaysAvailable, "Set bar mode"},
|
||||||
{"clientdebug", setCmdDebug, AlwaysAvailable, "Set client debug level"},
|
{"client.debug", setCmdDebug, AlwaysAvailable, "Set client debug level"},
|
||||||
{"clientdelay", setCmdExeDelay, AlwaysAvailable, "Set client execution delay"},
|
{"client.delay", setCmdExeDelay, AlwaysAvailable, "Set client execution delay"},
|
||||||
|
{"client.timeout", setClientTimeout, AlwaysAvailable, "Set client communication timeout"},
|
||||||
|
|
||||||
{"color", setCmdColor, AlwaysAvailable, "Set color support"},
|
{"color", setCmdColor, AlwaysAvailable, "Set color support"},
|
||||||
{"emoji", setCmdEmoji, AlwaysAvailable, "Set emoji display"},
|
{"emoji", setCmdEmoji, AlwaysAvailable, "Set emoji display"},
|
||||||
{"hints", setCmdHint, AlwaysAvailable, "Set hint display"},
|
{"hints", setCmdHint, AlwaysAvailable, "Set hint display"},
|
||||||
|
@ -1265,6 +1331,7 @@ static int CmdPrefShow(const char *Cmd) {
|
||||||
showBarModeState(prefShowNone);
|
showBarModeState(prefShowNone);
|
||||||
showClientExeDelayState();
|
showClientExeDelayState();
|
||||||
showOutputState(prefShowNone);
|
showOutputState(prefShowNone);
|
||||||
|
showClientTimeoutState();
|
||||||
|
|
||||||
PrintAndLogEx(NORMAL, "");
|
PrintAndLogEx(NORMAL, "");
|
||||||
return PM3_SUCCESS;
|
return PM3_SUCCESS;
|
||||||
|
|
|
@ -62,6 +62,7 @@ typedef struct {
|
||||||
uint16_t client_exe_delay;
|
uint16_t client_exe_delay;
|
||||||
char *history_path;
|
char *history_path;
|
||||||
pm3_device_t *current_device;
|
pm3_device_t *current_device;
|
||||||
|
uint32_t timeout;
|
||||||
} session_arg_t;
|
} session_arg_t;
|
||||||
|
|
||||||
extern session_arg_t g_session;
|
extern session_arg_t g_session;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue