rpmsgdev_server: Support oneway polling

Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
This commit is contained in:
wangjianyu3 2024-07-09 17:12:24 +08:00 committed by Xiang Xiao
parent f2ca3753dd
commit b2221806cb
1 changed files with 11 additions and 2 deletions

View File

@ -377,7 +377,14 @@ static int rpmsgdev_poll_handler(FAR struct rpmsg_endpoint *ept,
{
/* Do not allow double setup */
DEBUGASSERT(dev->cfd == 0);
if (dev->cfd != 0)
{
msg->header.result = file_poll(&dev->file, &dev->fd, false);
if (msg->header.result < 0)
{
return rpmsg_send(ept, msg, len);
}
}
dev->cfd = msg->fds;
dev->fd.events = msg->events;
@ -389,6 +396,8 @@ static int rpmsgdev_poll_handler(FAR struct rpmsg_endpoint *ept,
}
else
{
DEBUGASSERT(dev->cfd != 0);
msg->header.result = file_poll(&dev->file, &dev->fd, false);
if (msg->header.result == OK)
{
@ -396,7 +405,7 @@ static int rpmsgdev_poll_handler(FAR struct rpmsg_endpoint *ept,
}
}
return rpmsg_send(ept, msg, len);
return msg->header.cookie ? rpmsg_send(ept, msg, len) : OK;
}
/****************************************************************************