]>
cvs.zerfleddert.de Git - proxmark3-svn/blob - client/proxmark3.c
1 //-----------------------------------------------------------------------------
2 // Copyright (C) 2009 Michael Gernoth <michael at gernoth.net>
3 // Copyright (C) 2010 iZsh <izsh at fail0verflow.com>
5 // This code is licensed to you under the terms of the GNU GPL, version 2 or,
6 // at your option, any later version. See the LICENSE.txt file for the text of
8 //-----------------------------------------------------------------------------
10 //-----------------------------------------------------------------------------
16 #include <readline/readline.h>
17 #include <readline/history.h>
19 #include "proxmark3.h"
23 struct usb_receiver_arg
33 static void *usb_receiver(void *targ
)
35 struct usb_receiver_arg
*arg
= (struct usb_receiver_arg
*)targ
;
39 if (ReceiveCommandPoll(&cmdbuf
)) {
40 for (int i
= 0; i
< strlen(PROXPROMPT
); i
++)
42 UsbCommandReceived(&cmdbuf
);
52 static void *main_loop(void *targ
)
54 struct main_loop_arg
*arg
= (struct main_loop_arg
*)targ
;
55 struct usb_receiver_arg rarg
;
57 pthread_t reader_thread
;
59 if (arg
->usb_present
== 1) {
61 pthread_create(&reader_thread
, NULL
, &usb_receiver
, &rarg
);
65 cmd
= readline(PROXPROMPT
);
78 if (arg
->usb_present
== 1) {
80 pthread_join(reader_thread
, NULL
);
88 int main(int argc
, char **argv
)
90 struct main_loop_arg marg
;
91 pthread_t main_loop_t
;
94 if (!OpenProxmark(1)) {
95 fprintf(stderr
,"PROXMARK3: NOT FOUND!\n");
103 pthread_create(&main_loop_t
, NULL
, &main_loop
, &marg
);
104 InitGraphics(argc
, argv
);
108 pthread_join(main_loop_t
, NULL
);
110 if (marg
.usb_present
== 1) {