mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-07-13 06:20:36 +08:00
protocol_splitter: return correct FIONSPACE
This is now possible since we don't parse the protocol.
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user