Skip to content

v0.0.3

Compare
Choose a tag to compare
@vladimirvivien vladimirvivien released this 03 Sep 17:28
· 26 commits to main since this release
ab7db70

VL2 user control support

The main theme for this release is the introduction of the Control API with initial support of the V4L2 user controls. This release adds the followings:

  • Control types, values, and functions
  • Addition of low level Go functions, in the v4l2 package, to query, get, and set control values
  • Update to the Device type to add new methods to work with the control API
func main() {
        device, err := dev.Open(devName)
	if err != nil {
		log.Fatalf("failed to open device: %s", err)
	}
	defer device.Close()

        // set single device control value
        val := 12
        device.SetControlValue(v4l2.CtrlBrightness, v4l2.CtrlValue(val))

        // retrieve Control
        ctrl, _ := device.GetControl(ctrlID)

       fmt.Printf("Control id (%d) name: %s\t[min: %d; max: %d; step: %d; default: %d current_val: %d]\n",
		ctrl.ID, ctrl.Name, ctrl.Minimum, ctrl.Maximum, ctrl.Step, ctrl.Default, ctrl.Value)
}

For more detail, see the example

V4L2 header files added

Another improvement contributed by the community (thanks @ajcasagrande) is the inclusion of V4L2 header files as part of the project. This will provide consistent builds without relying on user's local header files (which can sometimes be outdated).

See the include directory for detail.

Local development

To ease local development for non-Linux environment, this release comes with a script that can launch a Canonical Ubuntu VM managed by Multipass. This provides a VM along with a fake V4L2 driver (V4L2Loopback) to help run and test the project without the need of an environment with a real video camera attached.

See the multipass directory for detail.