aboutsummaryrefslogtreecommitdiffstats
path: root/utils
diff options
context:
space:
mode:
authorHans Verkuil <hverkuil-cisco@xs4all.nl>2020-12-01 10:48:02 +0100
committerHans Verkuil <hverkuil-cisco@xs4all.nl>2020-12-01 10:48:02 +0100
commit0aee9991e0c005f8af7b08e20bfee47855451b5c (patch)
treedba56b20d4130be3ca00880222d4d4acc96b968e /utils
parent11da65eee7a271bba3f21d8117cdac428fe3a91e (diff)
v4l2-ctl: break on VIDIOC_DQEVENT error
If VIDIOC_DQEVENT fails, then stop polling. This will happen if e.g. the video device was unregistered and VIDIOC_DQEVENT returns ENODEV. Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Diffstat (limited to 'utils')
-rw-r--r--utils/v4l2-ctl/v4l2-ctl.cpp28
1 files changed, 14 insertions, 14 deletions
diff --git a/utils/v4l2-ctl/v4l2-ctl.cpp b/utils/v4l2-ctl/v4l2-ctl.cpp
index 951b70d8..ae3a3010 100644
--- a/utils/v4l2-ctl/v4l2-ctl.cpp
+++ b/utils/v4l2-ctl/v4l2-ctl.cpp
@@ -1545,13 +1545,13 @@ int main(int argc, char **argv)
res = select(fd + 1, nullptr, nullptr, &fds, nullptr);
if (res <= 0)
break;
- if (!doioctl(fd, VIDIOC_DQEVENT, &ev)) {
- print_event(&ev);
- if (ev.sequence > seq)
- printf("\tMissed %d events\n",
- ev.sequence - seq);
- seq = ev.sequence + 1;
- }
+ if (doioctl(fd, VIDIOC_DQEVENT, &ev))
+ break;
+ print_event(&ev);
+ if (ev.sequence > seq)
+ printf("\tMissed %d events\n",
+ ev.sequence - seq);
+ seq = ev.sequence + 1;
}
}
}
@@ -1584,13 +1584,13 @@ int main(int argc, char **argv)
res = epoll_wait(epollfd, &epoll_ev, 1, -1);
if (res <= 0)
break;
- if (!doioctl(fd, VIDIOC_DQEVENT, &ev)) {
- print_event(&ev);
- if (ev.sequence > seq)
- printf("\tMissed %d events\n",
- ev.sequence - seq);
- seq = ev.sequence + 1;
- }
+ if (doioctl(fd, VIDIOC_DQEVENT, &ev))
+ break;
+ print_event(&ev);
+ if (ev.sequence > seq)
+ printf("\tMissed %d events\n",
+ ev.sequence - seq);
+ seq = ev.sequence + 1;
}
}
close(epollfd);

Privacy Policy