]> git.zerfleddert.de Git - proxmark3-svn/blobdiff - client/comms.c
osx: disable app-nap during serial comm (#687)
[proxmark3-svn] / client / comms.c
index 86dca3ed425022276c4c976de85ec15bd63b4f79..190b911093d598b6d859542a6b891ec2d69199d4 100644 (file)
@@ -18,6 +18,7 @@
 #include "uart.h"
 #include "ui.h"
 #include "common.h"
+#include "util_darwin.h"
 #include "util_posix.h"
 
 
@@ -198,6 +199,10 @@ __attribute__((force_align_arg_pointer))
        UsbCommand rx;
        UsbCommand *prx = ℞
 
+#if defined(__MACH__) && defined(__APPLE__)
+       disableAppNap("Proxmark3 polling UART");
+#endif
+
        while (conn->run) {
                rxlen = 0;
                bool ACK_received = false;
@@ -236,6 +241,10 @@ __attribute__((force_align_arg_pointer))
                pthread_mutex_unlock(&txBufferMutex);
        }
 
+#if defined(__MACH__) && defined(__APPLE__)
+       enableAppNap();
+#endif
+
        pthread_exit(NULL);
        return NULL;
 }
@@ -364,7 +373,9 @@ void CloseProxmark(void) {
        // Clean up our state
        sp = NULL;
        serial_port_name = NULL;
+#ifdef __BIONIC__
        memset(&USB_communication_thread, 0, sizeof(pthread_t));
+#endif
 }
 
 
Impressum, Datenschutz