From 996b41dce7e69b9ac83aa169a2b2946a877b8035 Mon Sep 17 00:00:00 2001 From: iceman1001 Date: Wed, 29 Jan 2020 15:16:50 +0100 Subject: [PATCH] chg: write serial port in window title (plot/slider) --- client/comms.c | 5 +++++ client/comms.h | 3 +++ client/proxgui.h | 7 +++++++ client/proxguiqt.cpp | 13 ++++++++++++- client/ui/overlays.ui | 2 +- 5 files changed, 28 insertions(+), 2 deletions(-) diff --git a/client/comms.c b/client/comms.c index 9b031eb9e..ce8223ba3 100644 --- a/client/comms.c +++ b/client/comms.c @@ -24,6 +24,8 @@ //#define COMMS_DEBUG //#define COMMS_DEBUG_RAW +uint8_t gui_serial_port_name[FILE_PATH_SIZE]; + // Serial port that we are communicating with the PM3 on. static serial_port sp = NULL; @@ -568,6 +570,9 @@ bool OpenProxmark(void *port, bool wait_for_port, int timeout, bool flash_mode, uint16_t len = MIN(strlen(portname), FILE_PATH_SIZE - 1); memset(conn.serial_port_name, 0, FILE_PATH_SIZE); memcpy(conn.serial_port_name, portname, len); + + memset(gui_serial_port_name, 0, FILE_PATH_SIZE); + memcpy(gui_serial_port_name, portname, len); } conn.run = true; conn.block_after_ACK = flash_mode; diff --git a/client/comms.h b/client/comms.h index eaf9a16c0..288e8a326 100644 --- a/client/comms.h +++ b/client/comms.h @@ -44,6 +44,7 @@ typedef enum { FPGA_MEM, } DeviceMemType_t; + typedef struct { bool run; // If TRUE, continue running the uart_communication thread bool block_after_ACK; // if true, block after receiving an ACK package @@ -60,6 +61,8 @@ typedef struct { extern communication_arg_t conn; +extern uint8_t gui_serial_port_name[FILE_PATH_SIZE]; + void *uart_receiver(void *targ); void SendCommandBL(uint64_t cmd, uint64_t arg0, uint64_t arg1, uint64_t arg2, void *data, size_t len); void SendCommandOLD(uint64_t cmd, uint64_t arg0, uint64_t arg1, uint64_t arg2, void *data, size_t len); diff --git a/client/proxgui.h b/client/proxgui.h index c4adbeb01..8e0868b12 100644 --- a/client/proxgui.h +++ b/client/proxgui.h @@ -18,6 +18,7 @@ extern "C" { #include #include #include +//#include "comms.h" void ShowGraphWindow(void); void HideGraphWindow(void); @@ -55,6 +56,12 @@ extern size_t g_DemodStartIdx; extern bool showDemod; extern uint8_t g_debugMode; + +#ifndef FILE_PATH_SIZE +#define FILE_PATH_SIZE 1000 +#endif +extern uint8_t gui_serial_port_name[FILE_PATH_SIZE]; + #ifdef __cplusplus } #endif diff --git a/client/proxguiqt.cpp b/client/proxguiqt.cpp index 6bf99f5a1..a481f31d2 100644 --- a/client/proxguiqt.cpp +++ b/client/proxguiqt.cpp @@ -197,11 +197,22 @@ ProxWidget::ProxWidget(QWidget *parent, ProxGuiQT *master) : QWidget(parent) { QVBoxLayout *layout = new QVBoxLayout; layout->addWidget(plot); setLayout(layout); - show(); // places the window on the screen. + + // plot window title + QString pt = QString("[*]Plot [ %1 ]").arg((char*)gui_serial_port_name); + setWindowTitle(pt); + + // shows plot window on the screen. + show(); // Move controller widget below plot controlWidget->move(x(), y() + frameSize().height()); controlWidget->resize(size().width(), 200); + + // Olverlays / slider window title + QString ct = QString("[*]Slider [ %1 ]").arg((char*)gui_serial_port_name); + controlWidget->setWindowTitle(ct); + controlWidget->show(); } diff --git a/client/ui/overlays.ui b/client/ui/overlays.ui index 7cc9043e7..a262e5b93 100644 --- a/client/ui/overlays.ui +++ b/client/ui/overlays.ui @@ -11,7 +11,7 @@ - Overlays + Sliders