mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-03 17:28:54 +08:00
GPS driver: use FIONREAD on NuttX only
This commit is contained in:
committed by
Lorenz Meier
parent
4c04b7bb53
commit
74b2780874
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user