• Pete Hemery's avatar
    media: gspca/sn9c20x: Add ability to control built-in webcam LEDs · 4461a723
    Pete Hemery authored
    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: default avatarPete Hemery <petehemery@hotmail.com>
    Signed-off-by: default avatarHans Verkuil <hverkuil-cisco@xs4all.nl>
    Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+huawei@kernel.org>
    4461a723
sn9c20x.c 69.8 KB