]> cvs.zerfleddert.de Git - proxmark3-svn/commitdiff
Patch by jonor, fixes so uart_receive does not block when data is continuosly receive...
authormartin.holst@gmail.com <martin.holst@gmail.com@ef4ab9da-24cd-11de-8aaa-f3a34680c41f>
Sun, 1 Sep 2013 18:46:55 +0000 (18:46 +0000)
committermartin.holst@gmail.com <martin.holst@gmail.com@ef4ab9da-24cd-11de-8aaa-f3a34680c41f>
Sun, 1 Sep 2013 18:46:55 +0000 (18:46 +0000)
client/uart.c

index 041186c7e9d195b817766dba7e1b80adffe2117c..f7c5e35c3b0d7ad0a04c950c0ab55d328712933b 100644 (file)
@@ -266,7 +266,7 @@ bool uart_receive(const serial_port sp, byte_t* pbtRx, size_t* pszRxLen) {
     if (res < 0) {
       return false;
     }
-    
     // Read time-out
     if (res == 0) {
       if (*pszRxLen == 0) {
@@ -277,21 +277,24 @@ bool uart_receive(const serial_port sp, byte_t* pbtRx, size_t* pszRxLen) {
         return true;
       }
     }
-    
     // Retrieve the count of the incoming bytes
     res = ioctl(((serial_port_unix*)sp)->fd, FIONREAD, &byteCount);
     if (res < 0) return false;
-    
+
     // There is something available, read the data
     res = read(((serial_port_unix*)sp)->fd,pbtRx+(*pszRxLen),byteCount);
-    
+
     // Stop if the OS has some troubles reading the data
     if (res <= 0) return false;
-    
     *pszRxLen += res;
+
+    if(res==byteCount)
+        return true;
     
   } while (byteCount);
-  
+
   return true;
 }
 
Impressum, Datenschutz