Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1211046 > unrolled thread
| Started by | Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com> |
|---|---|
| First post | 2015-08-21 11:40 +0200 |
| Last post | 2015-08-21 11:40 +0200 |
| Articles | 1 — 1 participant |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
[PATCH 4/8] usb/uvc: Support for V4L2_CTRL_WHICH_DEF_VAL Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com> - 2015-08-21 11:40 +0200
| From | Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com> |
|---|---|
| Date | 2015-08-21 11:40 +0200 |
| Subject | [PATCH 4/8] usb/uvc: Support for V4L2_CTRL_WHICH_DEF_VAL |
| Message-ID | <pZQXL-86r-1@gated-at.bofh.it> |
This driver does not use the control infrastructure.
Add support for the new field which on structure
v4l2_ext_controls
Signed-off-by: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com>
---
drivers/media/usb/uvc/uvc_v4l2.c | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)
diff --git a/drivers/media/usb/uvc/uvc_v4l2.c b/drivers/media/usb/uvc/uvc_v4l2.c
index 2764f43607c1..e6d3a1bcfa2f 100644
--- a/drivers/media/usb/uvc/uvc_v4l2.c
+++ b/drivers/media/usb/uvc/uvc_v4l2.c
@@ -980,6 +980,7 @@ static int uvc_ioctl_g_ext_ctrls(struct file *file, void *fh,
struct uvc_fh *handle = fh;
struct uvc_video_chain *chain = handle->chain;
struct v4l2_ext_control *ctrl = ctrls->controls;
+ struct v4l2_queryctrl qc;
unsigned int i;
int ret;
@@ -988,7 +989,14 @@ static int uvc_ioctl_g_ext_ctrls(struct file *file, void *fh,
return ret;
for (i = 0; i < ctrls->count; ++ctrl, ++i) {
- ret = uvc_ctrl_get(chain, ctrl);
+ if (ctrls->which == V4L2_CTRL_WHICH_DEF_VAL) {
+ qc.id = ctrl->id;
+ ret = uvc_query_v4l2_ctrl(chain, &qc);
+ if (!ret)
+ ctrl->value = qc.default_value;
+ } else
+ ret = uvc_ctrl_get(chain, ctrl);
+
if (ret < 0) {
uvc_ctrl_rollback(handle);
ctrls->error_idx = i;
@@ -1010,6 +1018,10 @@ static int uvc_ioctl_s_try_ext_ctrls(struct uvc_fh *handle,
unsigned int i;
int ret;
+ /* Default value cannot be changed */
+ if (ctrls->which == V4L2_CTRL_WHICH_DEF_VAL)
+ return -EINVAL;
+
ret = uvc_ctrl_begin(chain);
if (ret < 0)
return ret;
--
2.5.0
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Back to top | Article view | linux.kernel
csiph-web