]>
git.zerfleddert.de Git - proxmark3-svn/blob - linux/proxmark3.c
8 #include <readline/readline.h>
9 #include <readline/history.h>
12 #include "translate.h"
13 #include "../winsrc/prox.h"
14 #include "proxmark3.h"
17 struct usb_receiver_arg
{
21 struct main_loop_arg
{
25 static void *usb_receiver(void *targ
) {
26 struct usb_receiver_arg
*arg
= (struct usb_receiver_arg
*)targ
;
30 if (ReceiveCommandP(&cmdbuf
) > 0) {
33 for (i
=0; i
<strlen(PROXPROMPT
); i
++)
36 UsbCommandReceived(&cmdbuf
);
45 static void *main_loop(void *targ
)
47 struct main_loop_arg
*arg
= (struct main_loop_arg
*)targ
;
51 struct usb_receiver_arg rarg
;
52 pthread_t reader_thread
;
55 if (arg
->usb_present
== 1) {
56 pthread_create(&reader_thread
, NULL
, &usb_receiver
, &rarg
);
58 cmd
= readline(PROXPROMPT
);
60 if (arg
->usb_present
== 1) {
61 pthread_join(reader_thread
, NULL
);
80 int main(int argc
, char **argv
)
82 struct main_loop_arg marg
;
83 pthread_t main_loop_t
;
86 if (!(devh
= OpenProxmark(1))) {
87 fprintf(stderr
,"PROXMARK3: NOT FOUND!\n");
95 pthread_create(&main_loop_t
, NULL
, &main_loop
, &marg
);
96 InitGraphics(argc
, argv
);
100 pthread_join(main_loop_t
, NULL
);
102 if (marg
.usb_present
== 1) {