Skip to content
Browse files

Fixing Mac serial issue when ReadFile returns EAGAIN

  • Loading branch information...
1 parent ed757b0 commit 76db9dffcfc1ace689200d8e8579ab317c52862e @andrewfb andrewfb committed Dec 5, 2012
Showing with 2 additions and 1 deletion.
  1. +2 −1 src/cinder/Serial.cpp
View
3 src/cinder/Serial.cpp
@@ -258,7 +258,8 @@ void Serial::readBytes( void *data, size_t numBytes )
if( ! ::ReadFile( mObj->mDeviceHandle, data, numBytes - totalBytesRead, &bytesRead, 0 ) )
throw SerialExcReadFailure();
#endif
- totalBytesRead += bytesRead;
+ if( bytesRead != -1 )
+ totalBytesRead += bytesRead;
// yield thread time to the system
thread::yield();

0 comments on commit 76db9df

Please sign in to comment.
Something went wrong with that request. Please try again.