]>
cvs.zerfleddert.de Git - proxmark3-svn/blob - client/proxmark3.c
b98afd9a5df7d0950a2740b675d20c5e3d703fdc
1 //-----------------------------------------------------------------------------
2 // Copyright (C) 2010 iZsh <izsh at fail0verflow.com>
4 // This code is licensed to you under the terms of the GNU GPL, version 2 or,
5 // at your option, any later version. See the LICENSE.txt file for the text of
7 //-----------------------------------------------------------------------------
9 //-----------------------------------------------------------------------------
15 #include <readline/readline.h>
16 #include <readline/history.h>
18 #include "proxmark3.h"
22 struct usb_receiver_arg
32 static void *usb_receiver(void *targ
)
34 struct usb_receiver_arg
*arg
= (struct usb_receiver_arg
*)targ
;
38 if (ReceiveCommandPoll(&cmdbuf
)) {
39 for (int i
= 0; i
< strlen(PROXPROMPT
); i
++)
41 UsbCommandReceived(&cmdbuf
);
51 static void *main_loop(void *targ
)
53 struct main_loop_arg
*arg
= (struct main_loop_arg
*)targ
;
54 struct usb_receiver_arg rarg
;
56 pthread_t reader_thread
;
58 if (arg
->usb_present
== 1) {
60 pthread_create(&reader_thread
, NULL
, &usb_receiver
, &rarg
);
64 cmd
= readline(PROXPROMPT
);
77 if (arg
->usb_present
== 1) {
79 pthread_join(reader_thread
, NULL
);
87 int main(int argc
, char **argv
)
89 struct main_loop_arg marg
;
90 pthread_t main_loop_t
;
93 if (!OpenProxmark(1)) {
94 fprintf(stderr
,"PROXMARK3: NOT FOUND!\n");
102 pthread_create(&main_loop_t
, NULL
, &main_loop
, &marg
);
103 InitGraphics(argc
, argv
);
107 pthread_join(main_loop_t
, NULL
);
109 if (marg
.usb_present
== 1) {