- fprintf(stderr,"Waiting for Proxmark to appear on %s", serial_port_name);
- do {
- sleep(1);
- fprintf(stderr, ".");
- } while (!OpenProxmark(serial_port_name));
- fprintf(stderr," Found.\n");
-
- // Lets start up the communications thread
- conn.run = true;
- pthread_create(&reader_thread, NULL, &uart_receiver, &conn);
+ if (!OpenProxmark(serial_port_name, true, 120)) { // wait for 2 minutes
+ fprintf(stderr, "Could not find Proxmark on %s.\n\n", serial_port_name);
+ return -1;
+ } else {
+ fprintf(stderr," Found.\n");
+ }