v4l2: v4l2_compat: Add eventfd signaling to support polling
To support polling, we need to be able to signal when data is available to be read (POLLIN), as well as events (POLLPRI). Add the necessary calls to eventfd to allow signaling POLLIN. We signal POLLIN by writing writing to the eventfd, and clear it by reading from the eventfd, upon VIDIOC_DQBUF. Note that eventfd does not support signaling POLLPRI, so we don't yet support V4L2 events. Signed-off-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
This commit is contained in:
parent
5c5481911a
commit
8df593841d
5 changed files with 32 additions and 1 deletions
|
@ -155,12 +155,17 @@ int V4L2CompatManager::openat(int dirfd, const char *path, int oflag, mode_t mod
|
|||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
int efd = eventfd(0, oflag & (O_CLOEXEC | O_NONBLOCK));
|
||||
int efd = eventfd(0, EFD_SEMAPHORE |
|
||||
((oflag & O_CLOEXEC) ? EFD_CLOEXEC : 0) |
|
||||
((oflag & O_NONBLOCK) ? EFD_NONBLOCK : 0));
|
||||
if (efd < 0) {
|
||||
int err = errno;
|
||||
proxy->close();
|
||||
errno = err;
|
||||
return efd;
|
||||
}
|
||||
|
||||
proxy->bind(efd);
|
||||
devices_.emplace(efd, proxy);
|
||||
|
||||
return efd;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue