From 0e63bd902ff91f12d8b14a683080ed85d23c7c77 Mon Sep 17 00:00:00 2001 From: Hans de Goede Date: Mon, 16 Sep 2024 15:12:16 +0200 Subject: [PATCH] spa: v4l2: Fix v4l2 SPA not working on camera with relative controls Some V4L2 controls like focus, pan or tilt can be relative (change the lens / angle relative to previous positions) these return EACCES when calling VIDIOC_G_CTRL on them. Fix the v4l2 SPA not working on cameras with relative controls, such as e.g. the Logitech QuickCam Orbit MP. Signed-off-by: Hans de Goede --- spa/plugins/v4l2/v4l2-utils.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/spa/plugins/v4l2/v4l2-utils.c b/spa/plugins/v4l2/v4l2-utils.c index 41078c98e..e36944f8c 100644 --- a/spa/plugins/v4l2/v4l2-utils.c +++ b/spa/plugins/v4l2/v4l2-utils.c @@ -1324,6 +1324,11 @@ spa_v4l2_update_controls(struct impl *this) spa_zero(control); control.id = c->ctrl_id; if (xioctl(dev->fd, VIDIOC_G_CTRL, &control) < 0) { + /* Write only controls like relative pan/tilt return EACCES */ + if (errno == EACCES) { + c->value = 0; + continue; + } res = -errno; goto done; }