protocol_splitter: return correct FIONSPACE

This is now possible since we don't parse the protocol.
This commit is contained in:
Beat Küng
2021-08-13 14:11:58 +02:00
committed by Daniel Agar
parent 6edb55c874
commit 5d1e78befb
@@ -303,11 +303,19 @@ DevCommon::~DevCommon()
int DevCommon::ioctl(struct file *filp, int cmd, unsigned long arg)
{
// pretend we have enough space left to write, so mavlink will not drop data and throw off
// our parsing state
if (cmd == FIONSPACE) {
*(int *)arg = 1024;
return 0;
int ret = ::ioctl(_fd, FIONSPACE, arg);
if (ret == 0) {
int *buf_free = (int *)arg;
*buf_free -= sizeof(_header);
if (*buf_free < 0) {
*buf_free = 0;
}
}
return ret;
}
return ::ioctl(_fd, cmd, arg);