You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
With the current rs232 receive function, I experimented some buffer
synchronization problems during the pn532C106 support implementation
process (see: http://code.google.com/p/libnfc/issues/detail?id=15).
With my patch (Linux only), the function reads exactly the number of bytes
currently in the buffer:
bool rs232_receive(const serial_port sp, byte_t* pbtRx, uint32_t* puiRxLen)
{
int iResult;
int byteCount;
fd_set rfds;
// Reset file descriptor
FD_ZERO(&rfds);
FD_SET(((serial_port_unix*)sp)->fd,&rfds);
iResult = select(((serial_port_unix*)sp)->fd+1, &rfds, NULL, NULL, &tv);
// Read error
if (iResult < 0) return false;
// Number of bytes in the input buffer
ioctl(((serial_port_unix*)sp)->fd, FIONREAD, &byteCount);
// Read time-out or empty buffer
if (iResult == 0 || byteCount == 0) return false;
// There is something available, read the data
*puiRxLen = read(((serial_port_unix*)sp)->fd,pbtRx,byteCount);
return (*puiRxLen > 0);
}
Original issue reported on code.google.com by emanuele.bertoldi on 4 Sep 2009 at 10:25
The text was updated successfully, but these errors were encountered:
Original issue reported on code.google.com by
emanuele.bertoldi
on 4 Sep 2009 at 10:25The text was updated successfully, but these errors were encountered: