v4l2-ctl allows you to set options on a web camera. For example, changing the power line frequency to 50 Hz to get rid of flicker with lights in Europe.
Unfortunately, it seems that v4l2-ctl can't determine the device type. Running it with any sort of webcam produces the following:
Unable to detect what device /dev/video0 is, exiting.
Looking at the source code it seems that mi_media_detect_type() in media-info.cpp is using the Linux sysfs and uevent to get information about the device type. This information doesn't exist on FreeBSD (at least not in that form).
If one hardcodes(!) the type to MEDIA_TYPE_VIDEO, the information does show up:
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_temperature_auto 0x0098090c (bool) : default=1 value=1
gain 0x00980913 (int) : min=0 max=255 step=1 default=0 value=136
power_line_frequency 0x00980918 (menu) : min=0 max=2 default=2 value=1
1: 50 Hz
2: 60 Hz
white_balance_temperature 0x0098091a (int) : min=2000 max=6500 step=1 default=4000 value=3385 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
exposure_auto 0x009a0901 (menu) : min=0 max=3 default=3 value=3
1: Manual Mode
3: Aperture Priority Mode
exposure_absolute 0x009a0902 (int) : min=3 max=2047 step=1 default=250 value=299 flags=inactive
exposure_auto_priority 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=5 default=0 value=50 flags=inactive
focus_auto 0x009a090c (bool) : default=1 value=1
zoom_absolute 0x009a090d (int) : min=100 max=500 step=1 default=100 value=100
Naturally, hard coding this value is not a permanent solution, but it does show that things work afterwards. There are still issues in setting values (getsubopt returns differently), but the first step is to get the items to recognize correctly.
If you want to work on this, feel free to make a proper patch on top of:
Currently, the code only compiles and I did not test all the utilities when doing the porting:
Thanks for the info. I can try and take a look. How would I get this information from the driver? It seems that usbconfig can provide some of that information, but if there are some manpages or headers that I could look at, that would help.
I'm not sure. Maybe a command line parameter, or some magic based on the device name is required.
There are many IOCTLs supported by these devices, and maybe just trial and error will work too.
I finally had a little time to look at this and created a pull request here:
This seems to get what I want, but if there are better ways to do things. I am happy to discuss (here or in the pull request).
Created attachment 223802 [details]
Patch submitted upstream
Including the patch here in case others want to use it.
Fixed by commit 3a28080660e54a820fd7eedfae8ec768945d223c