• Hans Verkuil's avatar
    media: uvcvideo: Check for INACTIVE in uvc_ctrl_is_accessible() · 9f582f04
    Hans Verkuil authored
    Check for inactive controls in uvc_ctrl_is_accessible().
    
    Use the new value for the master_id controls if present, otherwise
    use the existing value to determine if it is OK to set the control.
    Doing this here avoids attempting to set an inactive control, which
    will return an error from the USB device, which returns an invalid
    errorcode.
    
    This fixes:
      warn: v4l2-test-controls.cpp(483): s_ctrl returned EIO
      warn: v4l2-test-controls.cpp(483): s_ctrl returned EIO
    test VIDIOC_G/S_CTRL: OK
      warn: v4l2-test-controls.cpp(739): s_ext_ctrls returned EIO
      warn: v4l2-test-controls.cpp(739): s_ext_ctrls returned EIO
      warn: v4l2-test-controls.cpp(816): s_ext_ctrls returned EIO
    test VIDIOC_G/S/TRY_EXT_CTRLS: OK
    
    Tested with:
    v4l2-ctl -c auto_exposure=1
    OK
    v4l2-ctl -c exposure_time_absolute=251
    OK
    v4l2-ctl -c auto_exposure=3
    OK
    v4l2-ctl -c exposure_time_absolute=251
    VIDIOC_S_EXT_CTRLS: failed: Input/output error
    exposure_time_absolute: Input/output error
    ERROR
    v4l2-ctl -c auto_exposure=3,exposure_time_absolute=251,auto_exposure=1
    v4l2-ctl -C auto_exposure,exposure_time_absolute  
    auto_exposure: 1
    exposure_time_absolute: 251
    Reviewed-by: default avatarLaurent Pinchart <laurent.pinchart@ideasonboard.com>
    Reviewed-by: default avatarRicardo Ribalda <ribalda@chromium.org>
    Signed-off-by: default avatarHans Verkuil <hverkuil-cisco@xs4all.nl>
    Signed-off-by: default avatarLaurent Pinchart <laurent.pinchart@ideasonboard.com>
    9f582f04
uvcvideo.h 21.4 KB