This commit is contained in:
Philippe Teuwen 2019-04-05 23:29:19 +02:00
commit 7effdfc275

View file

@ -231,7 +231,6 @@ void uart_close(const serial_port sp) {
} }
bool uart_receive(const serial_port sp, uint8_t *pbtRx, size_t pszMaxRxLen, size_t *pszRxLen) { bool uart_receive(const serial_port sp, uint8_t *pbtRx, size_t pszMaxRxLen, size_t *pszRxLen) {
int res;
int byteCount; int byteCount;
fd_set rfds; fd_set rfds;
struct timeval tv; struct timeval tv;
@ -244,7 +243,7 @@ bool uart_receive(const serial_port sp, uint8_t *pbtRx, size_t pszMaxRxLen, size
FD_ZERO(&rfds); FD_ZERO(&rfds);
FD_SET(((serial_port_unix *)sp)->fd, &rfds); FD_SET(((serial_port_unix *)sp)->fd, &rfds);
tv = timeout; tv = timeout;
res = select(((serial_port_unix *)sp)->fd + 1, &rfds, NULL, NULL, &tv); int res = select(((serial_port_unix *)sp)->fd + 1, &rfds, NULL, NULL, &tv);
// Read error // Read error
if (res < 0) { if (res < 0) {
@ -290,7 +289,6 @@ bool uart_receive(const serial_port sp, uint8_t *pbtRx, size_t pszMaxRxLen, size
} }
bool uart_send(const serial_port sp, const uint8_t *pbtTx, const size_t len) { bool uart_send(const serial_port sp, const uint8_t *pbtTx, const size_t len) {
int32_t res;
size_t pos = 0; size_t pos = 0;
fd_set rfds; fd_set rfds;
struct timeval tv; struct timeval tv;
@ -300,7 +298,7 @@ bool uart_send(const serial_port sp, const uint8_t *pbtTx, const size_t len) {
FD_ZERO(&rfds); FD_ZERO(&rfds);
FD_SET(((serial_port_unix *)sp)->fd, &rfds); FD_SET(((serial_port_unix *)sp)->fd, &rfds);
tv = timeout; tv = timeout;
res = select(((serial_port_unix *)sp)->fd + 1, NULL, &rfds, NULL, &tv); int res = select(((serial_port_unix *)sp)->fd + 1, NULL, &rfds, NULL, &tv);
// Write error // Write error
if (res < 0) { if (res < 0) {