diff --git a/libnfc/buses/uart_posix.c b/libnfc/buses/uart_posix.c index 0fdd2d6..4e41d8e 100644 --- a/libnfc/buses/uart_posix.c +++ b/libnfc/buses/uart_posix.c @@ -273,7 +273,7 @@ select: timeout_tv.tv_usec = ((timeout % 1000) * 1000); } - res = select (MAX(UART_DATA(sp)->fd, iAbortFd) + 1, &rfds, NULL, NULL, &timeout_tv); + res = select (MAX(UART_DATA(sp)->fd, iAbortFd) + 1, &rfds, NULL, NULL, timeout ? &timeout_tv : NULL); if ((res < 0) && (EINTR == errno)) { // The system call was interupted by a signal and a signal handler was @@ -283,7 +283,7 @@ select: // Read error if (res < 0) { - log_put (LOG_CATEGORY, NFC_PRIORITY_TRACE, "%s", "RX error."); + log_put (LOG_CATEGORY, NFC_PRIORITY_TRACE, "Error: %s", strerror(errno)); return NFC_EIO; } // Read time-out diff --git a/libnfc/chips/pn53x.c b/libnfc/chips/pn53x.c index d30a708..34891b9 100644 --- a/libnfc/chips/pn53x.c +++ b/libnfc/chips/pn53x.c @@ -935,7 +935,7 @@ pn53x_check_communication (struct nfc_device *pnd) if ((res = pn53x_transceive (pnd, abtCmd, sizeof (abtCmd), abtRx, szRx, 500)) < 0) return res; szRx = (size_t) res; - if (((sizeof(abtExpectedRx) == szRx) && (0 == memcmp (abtRx, abtExpectedRx, sizeof(abtExpectedRx)))) == 0) + if ((sizeof(abtExpectedRx) == szRx) && (0 == memcmp (abtRx, abtExpectedRx, sizeof(abtExpectedRx)))) return NFC_SUCCESS; return NFC_EIO; diff --git a/libnfc/drivers/pn532_uart.c b/libnfc/drivers/pn532_uart.c index 87648c8..a99d31f 100644 --- a/libnfc/drivers/pn532_uart.c +++ b/libnfc/drivers/pn532_uart.c @@ -299,7 +299,7 @@ pn532_uart_send (nfc_device *pnd, const uint8_t *pbtData, const size_t szData, i return res; } // According to PN532 application note, C106 appendix: to go out Low Vbat mode and enter in normal mode we need to send a SAMConfiguration command - if ((res = pn53x_SAMConfiguration (pnd, 0x01, 500)) < 0) { + if ((res = pn53x_SAMConfiguration (pnd, 0x01, 1000)) < 0) { return res; } }