Skip to content

error with v4l2ctl focus settings (Logitech C920) #96

@dmnkhhn

Description

@dmnkhhn

What happened

If I use the examples from the manual to control my Logitech C920 Camera I get this:

pi@voron2:~ $ v4l2-ctl -d /dev/video0 -c focus_auto=0
unknown control 'focus_auto'
pi@voron2:~ $ v4l2-ctl -d /dev/video0 -c focus_absolute=30
VIDIOC_S_EXT_CTRLS: failed: Input/output error
focus_absolute: Input/output error

With this line in my config I get this output in the log:

[03/09/23 12:00:48] crowsnest: V4L2 Control: Device: [cam 1]
[03/09/23 12:00:48] crowsnest: V4L2 Control: Options: focus_auto=0,focus_absolute=30
[03/09/23 12:00:48] crowsnest: V4L2 Control: Failed to set parameter: 'focus_auto=0' ...
[03/09/23 12:00:48] crowsnest: V4L2 Control: Failed to set parameter: 'focus_absolute=30' ...
[03/09/23 12:00:49] crowsnest: Try to start configured Cams / Services...
[03/09/23 12:00:50] crowsnest: INFO: Configuration of Section [cam 1] looks good. Continue...
[03/09/23 12:00:52] crowsnest: ... Done!
[03/09/23 12:00:52] crowsnest: Starting ustreamer with Device /dev/video0 ...
[03/09/23 12:00:53] crowsnest: WARN: Detected 'brokenfocus' device.
[03/09/23 12:00:53] crowsnest: INFO: Trying to set to configured Value.
[03/09/23 12:00:53] crowsnest: ERROR: Error 255 occured on line 114
[03/09/23 12:00:53] crowsnest: ERROR: Stopping crowsnest.
[03/09/23 12:00:53] crowsnest: Goodbye...

Maybe a firmware update changed those parameters?! The (newly?) available controls are:

pi@voron2:~ $ v4l2-ctl -d /dev/video0 --list-ctrls

User Controls

                     brightness 0x00980900 (int)    : min=0 max=255 step=1 default=128 value=128
                       contrast 0x00980901 (int)    : min=0 max=255 step=1 default=128 value=128
                     saturation 0x00980902 (int)    : min=0 max=255 step=1 default=128 value=128
        white_balance_automatic 0x0098090c (bool)   : default=1 value=1
                           gain 0x00980913 (int)    : min=0 max=255 step=1 default=0 value=0
           power_line_frequency 0x00980918 (menu)   : min=0 max=2 default=2 value=2
      white_balance_temperature 0x0098091a (int)    : min=2800 max=7500 step=1 default=5000 value=4472 flags=inactive
                      sharpness 0x0098091b (int)    : min=0 max=255 step=1 default=128 value=128
         backlight_compensation 0x0098091c (int)    : min=0 max=1 step=1 default=0 value=0

Camera Controls

                  auto_exposure 0x009a0901 (menu)   : min=0 max=3 default=3 value=3
         exposure_time_absolute 0x009a0902 (int)    : min=3 max=2047 step=1 default=156 value=156 flags=inactive
     exposure_dynamic_framerate 0x009a0903 (bool)   : default=0 value=1
                   pan_absolute 0x009a0908 (int)    : min=-36000 max=36000 step=3600 default=0 value=0
                  tilt_absolute 0x009a0909 (int)    : min=-36000 max=36000 step=3600 default=0 value=0
                 focus_absolute 0x009a090a (int)    : min=0 max=250 step=1 default=0 value=59
     focus_automatic_continuous 0x009a090c (bool)   : default=1 value=0
                  zoom_absolute 0x009a090d (int)    : min=100 max=500 step=1 default=100 value=100

If I update my configuration and set v4l2ctl: focus_automatic_continuous=0,focus_absolute=30, which works when setting it manually from the command line, the following appears in my log:

[03/09/23 11:50:50] crowsnest: INFO: Configuration of Section [cam 1] looks good. Continue...
[03/09/23 11:50:52] crowsnest: ... Done!
[03/09/23 11:50:52] crowsnest: Starting ustreamer with Device /dev/video0 ...
[03/09/23 11:50:53] crowsnest: WARN: Detected 'brokenfocus' device.
[03/09/23 11:50:53] crowsnest: INFO: Trying to set to configured Value.
[03/09/23 11:50:54] crowsnest: ERROR: Error 255 occured on line 114
[03/09/23 11:50:54] crowsnest: ERROR: Stopping crowsnest.
[03/09/23 11:50:54] crowsnest: Goodbye...

Now crowsnest will start again, but it gets the same error and it goes on repeat and after a short while the Pi is almost overheating.

TL;DR
As soon as I set the focus parameter (new or old) the brokenfocus device warning comes up and crowsnest continuously restarts.

What did you expect to happen

I would expect the v4l2ctl setting to work properly with the updated parameters for my Logitech C920

How to reproduce

  • connect the camera via USB
  • get the available parameters v4l2-ctl -d /dev/video0 --list-ctrls
  • set the focus_automatic_continuous parameter to 0
  • set the focus_absolute parameter to something between 0 and 250
  • check the log

Additionally you could set those parameters from the command line to see if they work at all:
v4l2-ctl -d /dev/video0 -c focus_automatic_continuous=0
v4l2-ctl -d /dev/video0 -c focus_absolute=125

Additional information

crowsnest: Version: v3.0.7-3-g20ed6a8
crowsnest: Host Info: Distribution: Raspbian GNU/Linux 11 (bullseye)
crowsnest: Host Info: Kernel: Linux 6.1.14-v7+ armv7l
crowsnest: Host Info: Model: Raspberry Pi 3 Model B Plus Rev 1.3
crowsnest: Version Control: ustreamer is up to date. (v4.13)
crowsnest: Version Control: rtsp-simple-server is up to date. (v0.20.2)
crowsnest: Version Control: ffmpeg is up to date. (4.3.5-0+deb11u1+rpt3)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions