media: gspca/sn9c20x: Add ability to control built-in webcam LEDs
authorPete Hemery <petehemery@hotmail.com>
Mon, 2 Aug 2021 12:26:20 +0000 (14:26 +0200)
committerMauro Carvalho Chehab <mchehab+huawei@kernel.org>
Thu, 30 Sep 2021 08:07:39 +0000 (10:07 +0200)
commit4461a723ab7bb84d013b3de6cfc03fa52b0c20c3
tree0e411fa42ad8f67b0dc3437e934ec2ee3b553867
parent4b9e3e8af4b336eefca1f1ee535bc4b6734ed6aa
media: gspca/sn9c20x: Add ability to control built-in webcam LEDs

If you image search "microdia sonix webcam", or SN9C120, you can find
 examples of the type of webcam I have. It has 6 built-in LEDs.
It's ancient (2006 maybe?) but in 2020 it was the only USB webcam I had.
It doesn't perform well, especially in low light.

The Windows XP drivers had the ability to toggle the LEDs, as well as
 "Auto" mode which would read and adjust the exposure and turn them
 on when it got "too dark", along with other nice features, like
 smoothing dead pixels, funky filters, effects and face tracking.

Watching Wireshark usbmon with the Windows driver I was able to discover
 which values are required to toggle the LEDs.

Reading ext-ctrls-flash.rst, V4L2_FLASH_LED_MODE_TORCH seems to describe
 mostly what I want it to do.
Ideally the control would be boolean/checkbox, but the existing
 implementation seems to require a menu.

This patch implements the ability to control the LEDs, attempting to
 minimise changes to external files and other webcams.

Review by anyone more familiar with the code base for unintended
 side effects would be welcome and appreciated. First kernel submission.

Signed-off-by: Pete Hemery <petehemery@hotmail.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
drivers/media/usb/gspca/sn9c20x.c