aboutsummaryrefslogtreecommitdiffstats
path: root/utils
diff options
context:
space:
mode:
authorHans Verkuil <hans.verkuil@cisco.com>2014-07-28 16:15:25 +0200
committerHans Verkuil <hans.verkuil@cisco.com>2014-07-28 16:15:25 +0200
commitfaaf33fd3b40c81d818c695219fddad31293c05d (patch)
tree097a2367c78cd65c742a44b4c2698ad4f9db67ab /utils
parenta028340ce9e0230732f9c301373014ca90144642 (diff)
(c)v4l-helpers: fix broken tests for existence of ioctls.
Instead of checking for success, check for a result != ENOTTY. Unfortunately this will fail for kernels older than 3.1 when the default return code for a non-existing ioctl was EINVAL. All I can say is: upgrade your kernel, there is a reason EINVAL was a bad idea... Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Diffstat (limited to 'utils')
-rw-r--r--utils/qv4l2/general-tab.cpp2
-rw-r--r--utils/v4l2-compliance/cv4l-helpers.h9
-rw-r--r--utils/v4l2-compliance/v4l-helpers.h8
3 files changed, 7 insertions, 12 deletions
diff --git a/utils/qv4l2/general-tab.cpp b/utils/qv4l2/general-tab.cpp
index df926b7f..8a2c90ed 100644
--- a/utils/qv4l2/general-tab.cpp
+++ b/utils/qv4l2/general-tab.cpp
@@ -328,7 +328,7 @@ void GeneralTab::inputSection(v4l2_input vin)
m_stdRow->addWidget(m_tvStandard, 0, 1, Qt::AlignLeft);
connect(m_tvStandard, SIGNAL(activated(int)), SLOT(standardChanged(int)));
refreshStandards();
- if (ioctl_exists(cv4l_ioctl(VIDIOC_QUERYSTD, &tmp))) {
+ if (query_std(tmp) != ENOTTY) {
m_qryStandard = new QToolButton(parentWidget());
m_qryStandard->setIcon(QIcon(":/enterbutt.png"));
m_stdRow->addWidget(new QLabel("Query Standard", parentWidget()), 0, 2, Qt::AlignLeft);
diff --git a/utils/v4l2-compliance/cv4l-helpers.h b/utils/v4l2-compliance/cv4l-helpers.h
index d050686e..49ab7f74 100644
--- a/utils/v4l2-compliance/cv4l-helpers.h
+++ b/utils/v4l2-compliance/cv4l-helpers.h
@@ -194,11 +194,6 @@ public:
return cv4l_ioctl(VIDIOC_ENUMAUDOUT, &audout);
}
- bool ioctl_exists(int ret)
- {
- return ret == 0 || errno != ENOTTY;
- }
-
bool has_crop()
{
v4l2_selection sel;
@@ -206,7 +201,7 @@ public:
memset(&sel, 0, sizeof(sel));
sel.type = g_selection_type();
sel.target = V4L2_SEL_TGT_CROP;
- return ioctl_exists(g_selection(sel));
+ return g_selection(sel) != ENOTTY;
}
bool has_compose()
@@ -216,7 +211,7 @@ public:
memset(&sel, 0, sizeof(sel));
sel.type = g_selection_type();
sel.target = V4L2_SEL_TGT_COMPOSE;
- return ioctl_exists(g_selection(sel));
+ return g_selection(sel) != ENOTTY;
}
bool cur_io_has_crop()
diff --git a/utils/v4l2-compliance/v4l-helpers.h b/utils/v4l2-compliance/v4l-helpers.h
index e9f41766..7e8413bb 100644
--- a/utils/v4l2-compliance/v4l-helpers.h
+++ b/utils/v4l2-compliance/v4l-helpers.h
@@ -410,13 +410,13 @@ static inline int v4l_open(struct v4l_fd *f, const char *devname, bool non_block
f->caps = v4l_capability_g_caps(&f->cap);
f->type = v4l_determine_type(f);
- f->have_query_ext_ctrl = v4l_ioctl(f, VIDIOC_QUERY_EXT_CTRL, &qec) == 0;
- f->have_ext_ctrls = v4l_ioctl(f, VIDIOC_TRY_EXT_CTRLS, &ec) == 0;
- f->have_next_ctrl = v4l_ioctl(f, VIDIOC_QUERYCTRL, &qc) == 0;
+ f->have_query_ext_ctrl = v4l_ioctl(f, VIDIOC_QUERY_EXT_CTRL, &qec) != ENOTTY;
+ f->have_ext_ctrls = v4l_ioctl(f, VIDIOC_TRY_EXT_CTRLS, &ec) != ENOTTY;
+ f->have_next_ctrl = v4l_ioctl(f, VIDIOC_QUERYCTRL, &qc) != ENOTTY;
sel.type = v4l_g_selection_type(f);
sel.target = sel.type == V4L2_BUF_TYPE_VIDEO_CAPTURE ?
V4L2_SEL_TGT_CROP : V4L2_SEL_TGT_COMPOSE;
- f->have_selection = v4l_ioctl(f, VIDIOC_G_SELECTION, &sel) == 0;
+ f->have_selection = v4l_ioctl(f, VIDIOC_G_SELECTION, &sel) != ENOTTY;
return f->fd;
}

Privacy Policy