Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose all settings through uvc-gadget #3

Open
dgsiegel opened this issue Nov 3, 2020 · 3 comments
Open

Expose all settings through uvc-gadget #3

dgsiegel opened this issue Nov 3, 2020 · 3 comments

Comments

@dgsiegel
Copy link
Collaborator

dgsiegel commented Nov 3, 2020

Currently only the following settings are exposed:

$ v4l2-ctl -d /dev/video2 -L
                     brightness 0x00980900 (int)    : min=0 max=100 step=1 default=50 value=50
                  exposure_auto 0x009a0901 (menu)   : min=0 max=3 default=0 value=0
				1: Manual Mode

@peterbay
Copy link
Owner

Here is the documentation for extended video control - Video controls

@tuyenld
Copy link

tuyenld commented Dec 9, 2020

@peterbay
I followed your instruction, but some settings weren't exposed (i.e. sharpness, power_line_frequency).
My PR: showmewebcam/showmewebcam#65
USB host output:

$ v4l2-ctl -d /dev/video0 --list-ctrls
                     brightness 0x00980900 (int)    : min=0 max=100 step=1 default=50 value=50
                       contrast 0x00980901 (int)    : min=0 max=200 step=1 default=100 value=98
                     saturation 0x00980902 (int)    : min=0 max=200 step=1 default=100 value=105

RPi output:

# cat /sys/kernel/config/usb_gadget/piwebcam/functions/uvc.usb0/control/processing/default/bmControls 
255
6

# v4l2-ctl -d /dev/video0 --list-ctrls

User Controls

                     brightness 0x00980900 (int)    : min=0 max=100 step=1 default=50 value=50 flags=slider
                       contrast 0x00980901 (int)    : min=-100 max=100 step=1 default=0 value=-2 flags=slider
                     saturation 0x00980902 (int)    : min=-100 max=100 step=1 default=0 value=5 flags=slider
                    red_balance 0x0098090e (int)    : min=1 max=7999 step=1 default=1000 value=1000 flags=slider
                   blue_balance 0x0098090f (int)    : min=1 max=7999 step=1 default=1000 value=1000 flags=slider
                horizontal_flip 0x00980914 (bool)   : default=0 value=0
                  vertical_flip 0x00980915 (bool)   : default=0 value=0
           power_line_frequency 0x00980918 (menu)   : min=0 max=3 default=1 value=1
                      sharpness 0x0098091b (int)    : min=-100 max=100 step=1 default=0 value=20 flags=slider
                  color_effects 0x0098091f (menu)   : min=0 max=15 default=0 value=0
                         rotate 0x00980922 (int)    : min=0 max=360 step=90 default=0 value=0 flags=modify-layout
             color_effects_cbcr 0x0098092a (int)    : min=0 max=65535 step=1 default=32896 value=32896

Codec Controls

             video_bitrate_mode 0x009909ce (menu)   : min=0 max=1 default=0 value=0 flags=update
                  video_bitrate 0x009909cf (int)    : min=25000 max=25000000 step=25000 default=10000000 value=25000000
         repeat_sequence_header 0x009909e2 (bool)   : default=0 value=0
            h264_i_frame_period 0x00990a66 (int)    : min=0 max=2147483647 step=1 default=60 value=60
                     h264_level 0x00990a67 (menu)   : min=0 max=11 default=11 value=11
                   h264_profile 0x00990a6b (menu)   : min=0 max=4 default=4 value=4

Camera Controls

                  auto_exposure 0x009a0901 (menu)   : min=0 max=3 default=0 value=0
         exposure_time_absolute 0x009a0902 (int)    : min=1 max=10000 step=1 default=1000 value=1000
     exposure_dynamic_framerate 0x009a0903 (bool)   : default=0 value=0
             auto_exposure_bias 0x009a0913 (intmenu): min=0 max=24 default=12 value=12
      white_balance_auto_preset 0x009a0914 (menu)   : min=0 max=10 default=1 value=1
            image_stabilization 0x009a0916 (bool)   : default=0 value=0
                iso_sensitivity 0x009a0917 (intmenu): min=0 max=4 default=0 value=0
           iso_sensitivity_auto 0x009a0918 (menu)   : min=0 max=1 default=1 value=1
         exposure_metering_mode 0x009a0919 (menu)   : min=0 max=2 default=0 value=0
                     scene_mode 0x009a091a (menu)   : min=0 max=13 default=0 value=0

JPEG Compression Controls

            compression_quality 0x009d0903 (int)    : min=1 max=100 step=1 default=30 value=30
#

Do you have any idea?

@peterbay
Copy link
Owner

peterbay commented Dec 9, 2020

UVC camera controls initialization has several steps.

  1. UVC gadget has defined available controls in f_uvc.c and host computer read these settings after gadget initialization.

  2. uvc-gadget obtains available and enabled controls from v4l2 device and store info about these settings.

V4L2: Supported control Brightness (V4L2_CID_BRIGHTNESS = UVC_PU_BRIGHTNESS_CONTROL)
V4L2:   V4L2: min: 0, max: 100, step: 1, default: 50, value: 62
V4L2:   UVC: min: 0, max: 100, step: 1, default: 50, value: 62
V4L2: Supported control Contrast (V4L2_CID_CONTRAST = UVC_PU_CONTRAST_CONTROL)
V4L2:   V4L2: min: -100, max: 100, step: 1, default: 0, value: 20
V4L2:   UVC: min: 0, max: 200, step: 1, default: 100, value: 120
  1. Host computer asked available controls. If control is disabled or not available, then uvc-gadget returns an error code to a host computer.
UVC: PROCESSING_UNIT - GET_INFO - UVC_PU_BRIGHTNESS_CONTROL
UVC: PROCESSING_UNIT - GET_MIN - UVC_PU_BRIGHTNESS_CONTROL
UVC: PROCESSING_UNIT - GET_MAX - UVC_PU_BRIGHTNESS_CONTROL
UVC: PROCESSING_UNIT - GET_RES - UVC_PU_BRIGHTNESS_CONTROL
UVC: PROCESSING_UNIT - GET_DEF - UVC_PU_BRIGHTNESS_CONTROL
UVC: INPUT_TERMINAL - GET_INFO - UVC_CT_IRIS_ABSOLUTE_CONTROL - DISABLED

You must check output messages from uvc-gadget and log from a host computer. If the host computer asked for all available settings and all are's enabled.

Sample stdout from uvc-gadget

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants