From 532dbf28a191c87c7c62ecb008656decc3efd4c5 Mon Sep 17 00:00:00 2001 From: Philippe Teuwen Date: Tue, 7 May 2019 20:37:23 +0200 Subject: [PATCH] let OpenPm be responsible of setting session.pm3_present --- client/cmdhw.c | 2 +- client/comms.c | 1 + client/flasher.c | 3 +-- client/proxmark3.c | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/client/cmdhw.c b/client/cmdhw.c index 7a8906cd3..4eda2dc66 100644 --- a/client/cmdhw.c +++ b/client/cmdhw.c @@ -522,7 +522,7 @@ static int CmdConnect(const char *Cmd) { CloseProxmark(); } - session.pm3_present = OpenProxmark(port, false, 20, false, USART_BAUD_RATE); + OpenProxmark(port, false, 20, false, USART_BAUD_RATE); if (session.pm3_present && (TestProxmark() != PM3_SUCCESS)) { PrintAndLogEx(ERR, _RED_("ERROR:") "cannot communicate with the Proxmark\n"); diff --git a/client/comms.c b/client/comms.c index 69c932590..504f40c9e 100644 --- a/client/comms.c +++ b/client/comms.c @@ -571,6 +571,7 @@ bool OpenProxmark(void *port, bool wait_for_port, int timeout, bool flash_mode, pthread_create(&communication_thread, NULL, &uart_communication, &conn); __atomic_clear(&comm_thread_dead, __ATOMIC_SEQ_CST); + session.pm3_present = true; fflush(stdout); diff --git a/client/flasher.c b/client/flasher.c index 80b59d90d..88c154605 100644 --- a/client/flasher.c +++ b/client/flasher.c @@ -77,8 +77,7 @@ int main(int argc, char **argv) { char *serial_port_name = argv[1]; - session.pm3_present = OpenProxmark(serial_port_name, true, 60, true, FLASHMODE_SPEED); - if (session.pm3_present) { + if (OpenProxmark(serial_port_name, true, 60, true, FLASHMODE_SPEED)) { PrintAndLogEx(NORMAL, _GREEN_("Found")); } else { PrintAndLogEx(ERR, "Could not find Proxmark3 on " _RED_("%s") ".\n", serial_port_name); diff --git a/client/proxmark3.c b/client/proxmark3.c index 92cefa60c..9a90c2b8f 100644 --- a/client/proxmark3.c +++ b/client/proxmark3.c @@ -488,7 +488,7 @@ int main(int argc, char *argv[]) { // try to open USB connection to Proxmark if (port != NULL) { - session.pm3_present = OpenProxmark(port, waitCOMPort, 20, false, speed); + OpenProxmark(port, waitCOMPort, 20, false, speed); } if (session.pm3_present && (TestProxmark() != PM3_SUCCESS)) {