Add LF before first pm3 dbg msg when there is a pending prompt

This commit is contained in:
Philippe Teuwen 2020-08-14 00:14:46 +02:00
parent 6d3c1d0223
commit b59becbeb6
4 changed files with 10 additions and 0 deletions

View file

@ -18,6 +18,7 @@
#include "uart/uart.h" #include "uart/uart.h"
#include "ui.h" #include "ui.h"
#include "crc16.h" #include "crc16.h"
#include "util.h" // g_pendingPrompt
#include "util_posix.h" // msclock #include "util_posix.h" // msclock
#include "util_darwin.h" // en/dis-ableNapp(); #include "util_darwin.h" // en/dis-ableNapp();
@ -289,6 +290,10 @@ static void PacketResponseReceived(PacketResponseNG *packet) {
} }
if (flag & FLAG_LOG) { if (flag & FLAG_LOG) {
if (g_pendingPrompt) {
PrintAndLogEx(NORMAL, "");
g_pendingPrompt = false;
}
//PrintAndLogEx(NORMAL, "[" _MAGENTA_("pm3") "] ["_BLUE_("#")"] " "%s", s); //PrintAndLogEx(NORMAL, "[" _MAGENTA_("pm3") "] ["_BLUE_("#")"] " "%s", s);
PrintAndLogEx(NORMAL, "[" _BLUE_("#") "] %s", s); PrintAndLogEx(NORMAL, "[" _BLUE_("#") "] %s", s);
} else { } else {

View file

@ -349,6 +349,7 @@ check_script:
prompt_compose(prompt, sizeof(prompt), prompt_ctx, prompt_dev); prompt_compose(prompt, sizeof(prompt), prompt_ctx, prompt_dev);
char prompt_filtered[PROXPROMPT_MAX_SIZE] = {0}; char prompt_filtered[PROXPROMPT_MAX_SIZE] = {0};
memcpy_filter_ansi(prompt_filtered, prompt, sizeof(prompt_filtered), !session.supports_colors); memcpy_filter_ansi(prompt_filtered, prompt, sizeof(prompt_filtered), !session.supports_colors);
g_pendingPrompt = true;
#ifdef HAVE_READLINE #ifdef HAVE_READLINE
cmd = readline(prompt_filtered); cmd = readline(prompt_filtered);
#else #else
@ -411,6 +412,7 @@ check_script:
} }
#endif #endif
// process cmd // process cmd
g_pendingPrompt = false;
int ret = CommandReceived(cmd); int ret = CommandReceived(cmd);
// exit or quit // exit or quit
if (ret == PM3_EFATAL) if (ret == PM3_EFATAL)

View file

@ -30,6 +30,8 @@
uint8_t g_debugMode = 0; uint8_t g_debugMode = 0;
// global client disable logging variable // global client disable logging variable
uint8_t g_printAndLog = PRINTANDLOG_PRINT | PRINTANDLOG_LOG; uint8_t g_printAndLog = PRINTANDLOG_PRINT | PRINTANDLOG_LOG;
// global client tell if a pending prompt is present
bool g_pendingPrompt = false;
#ifdef _WIN32 #ifdef _WIN32
#include <windows.h> #include <windows.h>

View file

@ -23,6 +23,7 @@
extern uint8_t g_debugMode; extern uint8_t g_debugMode;
extern uint8_t g_printAndLog; extern uint8_t g_printAndLog;
extern bool g_pendingPrompt;
#define PRINTANDLOG_PRINT 1 #define PRINTANDLOG_PRINT 1
#define PRINTANDLOG_LOG 2 #define PRINTANDLOG_LOG 2