rpmsgdev_server: Support oneway polling
Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
This commit is contained in:
parent
f2ca3753dd
commit
b2221806cb
@ -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;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
|
Loading…
Reference in New Issue
Block a user