]>
git.zerfleddert.de Git - proxmark3-svn/blob - client/proxmark3.c
17534558bbd9c17ee9a8390c568252ab84ac315e
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
);
68 while(cmd
[strlen(cmd
) - 1] == ' ')
69 cmd
[strlen(cmd
) - 1]= 0x00;
80 if (arg
->usb_present
== 1) {
82 pthread_join(reader_thread
, NULL
);
90 int main(int argc
, char **argv
)
92 struct main_loop_arg marg
;
93 pthread_t main_loop_t
;
96 if (!OpenProxmark(1)) {
97 fprintf(stderr
,"PROXMARK3: NOT FOUND!\n");
101 marg
.usb_present
= 1;
105 pthread_create(&main_loop_t
, NULL
, &main_loop
, &marg
);
106 InitGraphics(argc
, argv
);
110 pthread_join(main_loop_t
, NULL
);
112 if (marg
.usb_present
== 1) {