Nuttx added FIONSPACE and fixed FIONWRITE: had retuned the space and should have returned enqueued count

This commit is contained in:
David Sidrane 2016-12-12 15:03:38 -10:00 committed by Lorenz Meier
parent 81d00e730a
commit 3ed0bfe0d8
2 changed files with 2 additions and 6 deletions

View File

@ -893,9 +893,9 @@ Mavlink::get_free_tx_buf()
return 1500;
} else {
// No FIONWRITE on Linux
// No FIONSPACE on Linux todo:use SIOCOUTQ and queue size to emulate FIONSPACE
#if !defined(__PX4_LINUX) && !defined(__PX4_DARWIN)
(void) ioctl(_uart_fd, FIONWRITE, (unsigned long)&buf_free);
(void) ioctl(_uart_fd, FIONSPACE, (unsigned long)&buf_free);
#else
//Linux cp210x does not support TIOCOUTQ
buf_free = 256;

View File

@ -136,12 +136,8 @@ SyslinkBridge::ioctl(struct file *filp, int cmd, unsigned long arg)
// All termios commands should be silently ignored as they are handled
switch (cmd) {
#ifdef FIONSPACE
case FIONSPACE:
#else
case FIONWRITE:
#endif
*((int *) arg) = _link->_writebuffer.space() * CRTP_MAX_DATA_SIZE;
return 0;