This is an automatic generated email to let you know that the following patch were queued at the http://git.linuxtv.org/cgit.cgi/v4l-utils.git tree:
Subject: qv4l2: use the error code returned by the cv4l helpers Author: Hans Verkuil <[email protected]> Date: Thu Aug 27 09:32:59 2026 +0200 qv4l2 derives from cv4l_fd, whose methods return a positive errno rather than setting errno and returning -1. Several places tested the global errno after such a call: - ctrlEvent() checked 'event_ret && errno == ENODEV' to detect the device going away, so a disconnect was only handled if errno happened to hold ENODEV. - The four dqbuf() users in capVbiFrame(), capSdrFrame(), outFrame() and capFrame() checked errno for EAGAIN. Missing an EAGAIN turns a normal "no buffer ready yet" into a fatal error() and stops capture. - ctrlAction(), updateCtrl() and refresh() passed errno to error() and errorCtrl(), so the dialog could show an unrelated error string. Take the error code from the return value in all of these. Also drop GeneralTab's ioctl_exists() helper: it returned 'ret == 0 || errno != ENOTTY', which tested errno while ret already holds the errno value. It has no callers, so remove it rather than fix it. Signed-off-by: Hans Verkuil <[email protected]> Assisted-by: Claude-Code:claude-opus-5 utils/qv4l2/ctrl-tab.cpp | 22 ++++++++++++++-------- utils/qv4l2/general-tab.h | 5 ----- utils/qv4l2/qv4l2.cpp | 25 ++++++++++++++++--------- 3 files changed, 30 insertions(+), 22 deletions(-) --- http://git.linuxtv.org/cgit.cgi/v4l-utils.git/commit/?id=3a0f9127c0200e11e52f09bc16151a4250b996f8 diff --git a/utils/qv4l2/ctrl-tab.cpp b/utils/qv4l2/ctrl-tab.cpp index 3f22d682b2bf..5fd59e78de52 100644 --- a/utils/qv4l2/ctrl-tab.cpp +++ b/utils/qv4l2/ctrl-tab.cpp @@ -432,12 +432,14 @@ void ApplicationWindow::ctrlAction(int id) ctrls.count = idx; ctrls.which = which; ctrls.controls = c; - if (s_ext_ctrls(ctrls)) { + int err = s_ext_ctrls(ctrls); + + if (err) { if (ctrls.error_idx >= ctrls.count) { - error(errno); + error(err); } else { - errorCtrl(c[ctrls.error_idx].id, errno); + errorCtrl(c[ctrls.error_idx].id, err); } } for (unsigned i = 0; i < ctrls.count; i++) { @@ -560,8 +562,10 @@ void ApplicationWindow::updateCtrl(unsigned id) ctrls.count = 1; ctrls.which = which; ctrls.controls = &c; - if (s_ext_ctrls(ctrls)) { - errorCtrl(id, errno, c.value); + int err = s_ext_ctrls(ctrls); + + if (err) { + errorCtrl(id, err, c.value); } else if (m_ctrlMap[id].flags & V4L2_CTRL_FLAG_UPDATE) refresh(which); @@ -672,12 +676,14 @@ void ApplicationWindow::refresh(unsigned which) ctrls.count = cnt; ctrls.which = which; ctrls.controls = c; - if (g_ext_ctrls(ctrls)) { + int err = g_ext_ctrls(ctrls); + + if (err) { if (ctrls.error_idx >= ctrls.count) { - error(errno); + error(err); } else { - errorCtrl(c[ctrls.error_idx].id, errno); + errorCtrl(c[ctrls.error_idx].id, err); } } else { diff --git a/utils/qv4l2/general-tab.h b/utils/qv4l2/general-tab.h index 0670b82cc0d8..6d46f09c7174 100644 --- a/utils/qv4l2/general-tab.h +++ b/utils/qv4l2/general-tab.h @@ -281,11 +281,6 @@ private: bool has_compose() { return m_fd->has_compose(); } bool cur_io_has_crop() { return m_fd->cur_io_has_crop(); } bool cur_io_has_compose() { return m_fd->cur_io_has_compose(); } - bool ioctl_exists(int ret) - { - return ret == 0 || errno != ENOTTY; - } - cv4l_fd *m_fd; int m_row; diff --git a/utils/qv4l2/qv4l2.cpp b/utils/qv4l2/qv4l2.cpp index c688a2a15b48..2e773fc6acb5 100644 --- a/utils/qv4l2/qv4l2.cpp +++ b/utils/qv4l2/qv4l2.cpp @@ -593,7 +593,7 @@ void ApplicationWindow::ctrlEvent() free(c.string); } - if (event_ret && errno == ENODEV) { + if (event_ret == ENODEV) { closeDevice(); if (m_capture) { m_capture->stop(); @@ -754,6 +754,7 @@ void ApplicationWindow::capVbiFrame() cv4l_buffer buf(m_queue); __u8 *data = NULL; int s = 0; + int err = 0; if (m_singleStep) m_capNotifier->setEnabled(false); @@ -773,8 +774,9 @@ void ApplicationWindow::capVbiFrame() case methodMmap: case methodUser: - if (dqbuf(buf)) { - if (errno == EAGAIN) + err = dqbuf(buf); + if (err) { + if (err == EAGAIN) return; error("dqbuf"); m_capStartAct->setChecked(false); @@ -852,6 +854,7 @@ void ApplicationWindow::capSdrFrame() cv4l_buffer buf(m_queue); __u8 *data = NULL; int s = 0; + int err = 0; if (m_singleStep) m_capNotifier->setEnabled(false); @@ -871,8 +874,9 @@ void ApplicationWindow::capSdrFrame() case methodMmap: case methodUser: - if (dqbuf(buf)) { - if (errno == EAGAIN) + err = dqbuf(buf); + if (err) { + if (err == EAGAIN) return; error("dqbuf"); m_capStartAct->setChecked(false); @@ -954,6 +958,7 @@ void ApplicationWindow::outFrame() { cv4l_buffer buf(m_queue); int s = 0; + int err = 0; switch (m_capMethod) { case methodRead: @@ -972,8 +977,9 @@ void ApplicationWindow::outFrame() case methodMmap: case methodUser: - if (dqbuf(buf)) { - if (errno == EAGAIN) + err = dqbuf(buf); + if (err) { + if (err == EAGAIN) return; error("dqbuf"); m_capStartAct->setChecked(false); @@ -1066,8 +1072,9 @@ void ApplicationWindow::capFrame() case methodMmap: case methodUser: - if (dqbuf(buf)) { - if (errno == EAGAIN) + err = dqbuf(buf); + if (err) { + if (err == EAGAIN) return; error("dqbuf"); m_capStartAct->setChecked(false); _______________________________________________ linuxtv-commits mailing list -- [email protected] To unsubscribe send an email to [email protected]
