aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDafna Hirschfeld <dafna.hirschfeld@collabora.com>2021-07-16 14:57:02 +0200
committerHans Verkuil <hverkuil-cisco@xs4all.nl>2021-08-04 15:17:32 +0200
commitac5c0dc4c24b5b956c3af58ccd1e524947610450 (patch)
tree0b0cde9e2917687da8893631cdd00e65882923a5
parentc86aab9cc7f1f001502c70a5e342f7816de3a3d6 (diff)
v4l2-ctl: print specific error upon failure
When an operation fails, print an error message that specify the specific operation that failed prefixed with the current function name. This makes debugging less painful. Signed-off-by: Dafna Hirschfeld <dafna.hirschfeld@collabora.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
-rw-r--r--utils/v4l2-ctl/v4l2-ctl-streaming.cpp24
1 files changed, 19 insertions, 5 deletions
diff --git a/utils/v4l2-ctl/v4l2-ctl-streaming.cpp b/utils/v4l2-ctl/v4l2-ctl-streaming.cpp
index 62424e4c..0f28a537 100644
--- a/utils/v4l2-ctl/v4l2-ctl-streaming.cpp
+++ b/utils/v4l2-ctl/v4l2-ctl-streaming.cpp
@@ -1153,8 +1153,10 @@ static int do_setup_out_buffers(cv4l_fd &fd, cv4l_queue &q, FILE *fin, bool qbuf
q.g_type() == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE;
bool is_meta = q.g_type() == V4L2_BUF_TYPE_META_OUTPUT;
- if (q.obtain_bufs(&fd))
+ if (q.obtain_bufs(&fd)) {
+ fprintf(stderr, "%s q.obtain_bufs failed\n", __func__);
return QUEUE_ERROR;
+ }
fd.g_fmt(fmt, q.g_type());
{
@@ -1226,8 +1228,10 @@ static int do_setup_out_buffers(cv4l_fd &fd, cv4l_queue &q, FILE *fin, bool qbuf
for (unsigned i = 0; i < q.g_buffers(); i++) {
cv4l_buffer buf(q);
- if (fd.querybuf(buf, i))
+ if (fd.querybuf(buf, i)) {
+ fprintf(stderr, "%s fd.querybuf failed\n", __func__);
return QUEUE_ERROR;
+ }
buf.update(q, i);
for (unsigned j = 0; j < q.g_num_planes(); j++)
@@ -2720,11 +2724,21 @@ static void streaming_set_cap2out(cv4l_fd &fd, cv4l_fd &out_fd)
fprintf(stderr, "mismatch between number of planes\n");
goto done;
}
+ if (in.obtain_bufs(&fd)) {
+ fprintf(stderr, "%s: in.obtain_bufs failed\n", __func__);
+ goto done;
+ }
- if (in.obtain_bufs(&fd) ||
- in.queue_all(&fd) ||
- do_setup_out_buffers(out_fd, out, file[OUT], false, false) == QUEUE_ERROR)
+ if (in.queue_all(&fd)) {
+ fprintf(stderr, "%s: in.queue_all failed\n", __func__);
goto done;
+ }
+
+
+ if (do_setup_out_buffers(out_fd, out, file[OUT], false, false) == QUEUE_ERROR) {
+ fprintf(stderr, "%s: do_setup_out_buffers failed\n", __func__);
+ goto done;
+ }
fps_ts[CAP].determine_field(fd.g_fd(), in.g_type());
fps_ts[OUT].determine_field(fd.g_fd(), out.g_type());

Privacy Policy