]> git.kernelconcepts.de Git - karo-tx-linux.git/commit
[media] media/v4l2-ctrls: fix setting autocluster to manual with VIDIOC_S_CTRL
authorAntonio Ospite <ao2@ao2.it>
Wed, 14 Oct 2015 13:57:32 +0000 (10:57 -0300)
committerMauro Carvalho Chehab <mchehab@osg.samsung.com>
Tue, 20 Oct 2015 17:58:29 +0000 (15:58 -0200)
commit759b26a1d916400a1a20948eb964dea6ad0bd9e9
tree438e78da0258039672f4fb6ec75215104d24e482
parentb2df45531619508a722cdafac2bde3ca2f8ae9e5
[media] media/v4l2-ctrls: fix setting autocluster to manual with VIDIOC_S_CTRL

Since commit 5d0360a4f027576e5419d4a7c711c9ca0f1be8ca it's not possible
anymore to set auto clusters from auto to manual using VIDIOC_S_CTRL.

For example, setting autogain to manual with gspca/ov534 driver and this
sequence of commands does not work:

  v4l2-ctl --set-ctrl=gain_automatic=1
  v4l2-ctl --list-ctrls | grep gain_automatic
  # The following does not work
  v4l2-ctl --set-ctrl=gain_automatic=0
  v4l2-ctl --list-ctrls | grep gain_automatic

Changing the value using VIDIOC_S_EXT_CTRLS (like qv4l2 does) works
fine.

The apparent cause by looking at the changes in 5d0360a and comparing
with the code path for VIDIOC_S_EXT_CTRLS seems to be that the code in
v4l2-ctrls.c::set_ctrl() is not calling user_to_new() anymore after
calling update_from_auto_cluster(master).

However the root cause of the problem is that calling
update_from_auto_cluster(master) overrides also the _master_ control
state calling cur_to_new() while it was supposed to only update the
volatile controls.

Calling user_to_new() after update_from_auto_cluster(master) was just
masking the original bug by restoring the correct new value of the
master control before making the changes permanent.

Fix the original bug by making update_from_auto_cluster() not override
the new master control value.

Signed-off-by: Antonio Ospite <ao2@ao2.it>
Cc: <stable@vger.kernel.org> # for v3.17 and up
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
drivers/media/v4l2-core/v4l2-ctrls.c