mirror of
https://github.com/Proxmark/proxmark3.git
synced 2025-08-22 22:23:38 -07:00
send script_cmd via all the loop of code.
This commit is contained in:
parent
66b853c084
commit
beb047e2a5
5 changed files with 18 additions and 17 deletions
|
@ -15,7 +15,7 @@
|
|||
static ProxGuiQT *gui = NULL;
|
||||
static WorkerThread *main_loop_thread = NULL;
|
||||
|
||||
WorkerThread::WorkerThread(char *script_cmds_file, bool usb_present) : script_cmds_file(script_cmds_file), usb_present(usb_present)
|
||||
WorkerThread::WorkerThread(char *script_cmds_file, char *script_cmd, bool usb_present) : script_cmds_file(script_cmds_file), script_cmd(script_cmd), usb_present(usb_present)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -24,7 +24,7 @@ WorkerThread::~WorkerThread()
|
|||
}
|
||||
|
||||
void WorkerThread::run() {
|
||||
main_loop(script_cmds_file, usb_present);
|
||||
main_loop(script_cmds_file, script_cmd, usb_present);
|
||||
}
|
||||
|
||||
extern "C" void ShowGraphWindow(void)
|
||||
|
@ -60,7 +60,7 @@ extern "C" void MainGraphics(void)
|
|||
gui->MainLoop();
|
||||
}
|
||||
|
||||
extern "C" void InitGraphics(int argc, char **argv, char *script_cmds_file, bool usb_present)
|
||||
extern "C" void InitGraphics(int argc, char **argv, char *script_cmds_file, char *script_cmd, bool usb_present)
|
||||
{
|
||||
#ifdef Q_WS_X11
|
||||
bool useGUI = getenv("DISPLAY") != 0;
|
||||
|
@ -71,7 +71,7 @@ extern "C" void InitGraphics(int argc, char **argv, char *script_cmds_file, bool
|
|||
return;
|
||||
|
||||
gui = new ProxGuiQT(argc, argv);
|
||||
main_loop_thread = new WorkerThread(script_cmds_file, usb_present);
|
||||
main_loop_thread = new WorkerThread(script_cmds_file, script_cmd, usb_present);
|
||||
QObject::connect(main_loop_thread, SIGNAL(finished()), main_loop_thread, SLOT(deleteLater()));
|
||||
QObject::connect(main_loop_thread, SIGNAL(finished()), gui, SLOT(_Exit()));
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@ void ShowGraphWindow(void);
|
|||
void HideGraphWindow(void);
|
||||
void RepaintGraphWindow(void);
|
||||
void MainGraphics(void);
|
||||
void InitGraphics(int argc, char **argv, char *script_cmds_file, bool usb_present);
|
||||
void InitGraphics(int argc, char **argv, char *script_cmds_file, char *script_cmd, bool usb_present);
|
||||
void ExitGraphics(void);
|
||||
|
||||
#define MAX_GRAPH_TRACE_LEN (40000*8)
|
||||
|
|
|
@ -123,11 +123,12 @@ class ProxGuiQT : public QObject
|
|||
class WorkerThread : public QThread {
|
||||
Q_OBJECT;
|
||||
public:
|
||||
WorkerThread(char*, bool);
|
||||
WorkerThread(char*, char*, bool);
|
||||
~WorkerThread();
|
||||
void run();
|
||||
private:
|
||||
char *script_cmds_file = NULL;
|
||||
char *script_cmd = NULL;
|
||||
bool usb_present;
|
||||
};
|
||||
|
||||
|
|
|
@ -95,7 +95,7 @@ static void *uart_receiver(void *targ) {
|
|||
}
|
||||
|
||||
|
||||
void main_loop(char *script_cmds_file, bool usb_present) {
|
||||
void main_loop(char *script_cmds_file, char *script_cmd, bool usb_present) {
|
||||
struct receiver_arg rarg;
|
||||
char *cmd = NULL;
|
||||
pthread_t reader_thread;
|
||||
|
@ -267,14 +267,13 @@ int main(int argc, char* argv[]) {
|
|||
flushAfterWrite = 1;
|
||||
}
|
||||
|
||||
if(strcmp(argv[i],"-w") == 0 || strcmp(argv[i],"-wait") == 0){
|
||||
waitCOMPort = true;
|
||||
printf("Waiting for Proxmark to appear on %s ", argv[1]);
|
||||
}
|
||||
|
||||
if(strcmp(argv[i],"-c") == 0 || strcmp(argv[i],"-command") == 0){
|
||||
executeCommand = true;
|
||||
}
|
||||
|
||||
if(strcmp(argv[i],"-w") == 0 || strcmp(argv[i],"-wait") == 0){
|
||||
waitCOMPort = true;
|
||||
}
|
||||
}
|
||||
|
||||
// If the user passed the filename of the 'script' to execute, get it from last parameter
|
||||
|
@ -293,6 +292,7 @@ int main(int argc, char* argv[]) {
|
|||
if (!waitCOMPort) {
|
||||
sp = uart_open(argv[1]);
|
||||
} else {
|
||||
printf("Waiting for Proxmark to appear on %s ", argv[1]);
|
||||
int openCount = 0;
|
||||
do {
|
||||
sp = uart_open(argv[1]);
|
||||
|
@ -321,23 +321,23 @@ int main(int argc, char* argv[]) {
|
|||
|
||||
#ifdef HAVE_GUI
|
||||
#ifdef _WIN32
|
||||
InitGraphics(argc, argv, script_cmds_file, usb_present);
|
||||
InitGraphics(argc, argv, script_cmds_file, script_cmd, usb_present);
|
||||
MainGraphics();
|
||||
#else
|
||||
char* display = getenv("DISPLAY");
|
||||
|
||||
if (display && strlen(display) > 1)
|
||||
{
|
||||
InitGraphics(argc, argv, script_cmds_file, usb_present);
|
||||
InitGraphics(argc, argv, script_cmds_file, script_cmd, usb_present);
|
||||
MainGraphics();
|
||||
}
|
||||
else
|
||||
{
|
||||
main_loop(script_cmds_file, usb_present);
|
||||
main_loop(script_cmds_file, script_cmd, usb_present);
|
||||
}
|
||||
#endif
|
||||
#else
|
||||
main_loop(script_cmds_file, usb_present);
|
||||
main_loop(script_cmds_file, script_cmd, usb_present);
|
||||
#endif
|
||||
|
||||
// Clean up the port
|
||||
|
|
|
@ -23,7 +23,7 @@ extern "C" {
|
|||
void SendCommand(UsbCommand *c);
|
||||
const char *get_my_executable_path(void);
|
||||
const char *get_my_executable_directory(void);
|
||||
void main_loop(char *script_cmds_file, bool usb_present);
|
||||
void main_loop(char *script_cmds_file, char *script_cmd, bool usb_present);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue