Manual webcam controls

I’m using infinite focus, no white balance correction and auto exposure correction on my webcams. To set these settings, I’m using v4l2ctrl. It can export the current settings using v4l2ctrl -d /dev/video -s file, and after editing it can load it to the specified device: v4l2ctrl -d /dev/video -l file

I’m using this file for my Microsoft LifeCam Cinema webcams:

1
2
3
4
5
9963788:White Balance Temperature, Auto:0
10094858:               Focus (absolute):0
10094860:                    Focus, Auto:0
10094861:                 Zoom, Absolute:0
10094849:                 Exposure, Auto:3

It gets loaded everytime the webcam is attached to the USB port with udev. The udev rules for my webcams are:

1
2
3
4
# webcam kelet
KERNELS=="1-8", SUBSYSTEMS=="usb", DRIVERS=="usb", ATTRS{idVendor}=="045e", ATTRS{idProduct}=="075d", NAME="video0", RUN+="/usr/bin/v4l2ctrl -d /dev/video0 -l /usr/local/webcam/kelet/v4l2ctrlsettings"
# webcam nyugat
KERNELS=="1-2.4.4", SUBSYSTEMS=="usb", DRIVERS=="usb", ATTRS{idVendor}=="045e", ATTRS{idProduct}=="075d", NAME="video1", RUN+="/usr/bin/v4l2ctrl -d /dev/video1 -l /usr/local/webcam/nyugat/v4l2ctrlsettings"

I found out these udev patterns using udevadm info -a -p $(udevadm info -q path -n /dev/video).