diff --git a/client/comms.c b/client/comms.c index c28aef238..8f143d5e3 100644 --- a/client/comms.c +++ b/client/comms.c @@ -533,14 +533,6 @@ bool IsCommunicationThreadDead(void) { return ret; } -bool ReConnectProxmark(void) { - char *port = serial_port_name; - bool res = OpenProxmark(port, true, 20, false, _speed); - if ( res ) - __atomic_clear(&comm_thread_dead, __ATOMIC_SEQ_CST); - return res; -} - bool OpenProxmark(void *port, bool wait_for_port, int timeout, bool flash_mode, uint32_t speed) { char *portname = (char *)port; @@ -583,6 +575,7 @@ bool OpenProxmark(void *port, bool wait_for_port, int timeout, bool flash_mode, conn.send_via_fpc_usart = false; pthread_create(&communication_thread, NULL, &uart_communication, &conn); + __atomic_clear(&comm_thread_dead, __ATOMIC_SEQ_CST); fflush(stdout); // create a mutex to avoid interlacing print commands from our different threads diff --git a/client/comms.h b/client/comms.h index 7eb3345c5..501ee18e7 100644 --- a/client/comms.h +++ b/client/comms.h @@ -64,7 +64,6 @@ void clearCommandBuffer(void); #define FLASHMODE_SPEED 460800 void GetSavedSerialPortName( char **dest ); bool IsCommunicationThreadDead(void); -bool ReConnectProxmark(void); bool OpenProxmark(void *port, bool wait_for_port, int timeout, bool flash_mode, uint32_t speed); int TestProxmark(void); void CloseProxmark(void); diff --git a/client/proxmark3.c b/client/proxmark3.c index ffbe344e2..0080a6a27 100644 --- a/client/proxmark3.c +++ b/client/proxmark3.c @@ -54,11 +54,9 @@ static void showBanner(void) { int check_comm(void) { // If communications thread goes down. Device disconnected then this should hook up PM3 again. - if ( IsCommunicationThreadDead() ) { - session.pm3_present = ReConnectProxmark(); - if (session.pm3_present && (TestProxmark() != PM3_SUCCESS)) { - session.pm3_present = false; - } + if ( IsCommunicationThreadDead() && session.pm3_present) { + session.pm3_present = false; + PrintAndLogEx(INFO, "Running in " _YELLOW_("OFFLINE") "mode. Use \"hw connect\" to reconnect\n"); } return 0; } @@ -158,7 +156,7 @@ main_loop(char *script_cmds_file, char *script_cmd) { printprompt = true; } else { - //rl_event_hook = check_comm; + rl_event_hook = check_comm; if (session.pm3_present ) cmd = readline(PROXPROMPT); else