X-Git-Url: http://git.zerfleddert.de/cgi-bin/gitweb.cgi/proxmark3-svn/blobdiff_plain/aa81a8d3f11255c86b1de9e77c65ce700fb3a79e..b961ef035a58d8c5fb12386ddad4c56648fbe153:/client/proxmark3.c diff --git a/client/proxmark3.c b/client/proxmark3.c index 280d07f9..2e8ef418 100644 --- a/client/proxmark3.c +++ b/client/proxmark3.c @@ -44,22 +44,18 @@ static void *usb_receiver(void *targ) { static void *main_loop(void *targ) { struct main_loop_arg *arg = (struct main_loop_arg*)targ; + struct usb_receiver_arg rarg; char *cmd = NULL; + pthread_t reader_thread; + + if (arg->usb_present == 1) { + rarg.run=1; + pthread_create(&reader_thread, NULL, &usb_receiver, &rarg); + } while(1) { - struct usb_receiver_arg rarg; - pthread_t reader_thread; - rarg.run=1; - if (arg->usb_present == 1) { - pthread_create(&reader_thread, NULL, &usb_receiver, &rarg); - } cmd = readline(PROXPROMPT); - rarg.run=0; - if (arg->usb_present == 1) { - pthread_join(reader_thread, NULL); - } - if (cmd) { if (cmd[0] != 0x00) { CommandReceived(cmd); @@ -71,6 +67,11 @@ static void *main_loop(void *targ) break; } } + + if (arg->usb_present == 1) { + rarg.run = 0; + pthread_join(reader_thread, NULL); + } ExitGraphics(); pthread_exit(NULL);