]> git.zerfleddert.de Git - proxmark3-svn/blobdiff - uart/uart_posix.c
Fix for USB uart slowness since PR #720 (#787)
[proxmark3-svn] / uart / uart_posix.c
index e3113e86165276de6ce9aa408bc87573b0bf8d4f..214cb56a26b910d24c08f6f42a43c12fae54c471 100644 (file)
 #include <arpa/inet.h>
 #include <netdb.h>
 
+// Fix missing definition on OS X.
+// Taken from https://github.com/unbit/uwsgi/commit/b608eb1772641d525bfde268fe9d6d8d0d5efde7
+#ifndef SOL_TCP
+#define SOL_TCP IPPROTO_TCP
+#endif
+
 typedef struct termios term_info;
 typedef struct {
   int fd;           // Serial port file descriptor
@@ -63,9 +69,9 @@ typedef struct {
 } serial_port_unix;
 
 // Set time-out on 30 miliseconds
-const struct timeval timeout = {
+struct timeval timeout = {
   .tv_sec  =     0, // 0 second
-  .tv_usec = 300000  // 300000 micro seconds
+  .tv_usec = 30000  // 30000 micro seconds
 };
 
 serial_port uart_open(const char* pcPortName)
@@ -82,6 +88,10 @@ serial_port uart_open(const char* pcPortName)
     }
     char *colon = strrchr(addrstr, ':');
     char *portstr;
+
+    // Set time-out to 300 miliseconds only for TCP port
+    timeout.tv_usec = 300000;
+
     if (colon) {
       portstr = colon + 1;
       *colon = '\0';
Impressum, Datenschutz