GPS driver: use FIONREAD on NuttX only

This commit is contained in:
Artem Sabadyr
2016-10-02 11:19:55 +02:00
committed by Lorenz Meier
parent 4c04b7bb53
commit 74b2780874
+5
View File
@@ -402,6 +402,7 @@ int GPS::pollOrRead(uint8_t *buf, size_t buf_length, int timeout)
* If we have all requested data available, read it without waiting.
* If more bytes are available, we'll go back to poll() again.
*/
#ifdef __PX4_NUTTX
int err = 0, bytesAvailable = 0;
err = ioctl(_serial_fd, FIONREAD, (unsigned long)&bytesAvailable);
@@ -409,6 +410,10 @@ int GPS::pollOrRead(uint8_t *buf, size_t buf_length, int timeout)
usleep(GPS_WAIT_BEFORE_READ * 1000);
}
#else
usleep(GPS_WAIT_BEFORE_READ * 1000);
#endif
ret = ::read(_serial_fd, buf, buf_length);
} else {