Hi Antoine,

On Thursday 03 January 2008, Antoine Cellerier wrote:
> Hello,
>
> I've stumbled upon a problem when hacking the VLC v4l2 driver:
>
> I want to enumerate all the private controls to make them available in
> the interface. The code used to enumerate the controls uses the same
> logic as Example 1-8 in the spec:
> http://v4l2spec.bytesex.org/spec-single/v4l2.html#AEN732
>
> Unfortunately it doesn't work as expected. My webcam provides the
> following private controls:
> Backlight Compensation -> V4L2_CID_PRIVATE_BASE+0
> Power Line Frequency -> V4L2_CID_PRIVATE_BASE+1
> Sharpness -> V4L2_CID_PRIVATE_BASE+2
> White Balance Temperature Auto -> V4L2_CID_PRIVATE_BASE+12
> White Balance Temperature -> V4L2_CID_PRIVATE_BASE+13
> Unfortunately, ioctl( fd, VIDIOC_QUERYCTRL, &queryctrl ) on
> V4L2_CID_PRIVATE_BASE+3 returns -1, which exits the private controls
> enumartion code.
>
> According to footnote [24] in the spec,
> "V4L2_CTRL_FLAG_DISABLED was intended for two purposes: Drivers can skip
> predefined controls not supported by the hardware (although returning
> EINVAL would do as well), or disable predefined and private controls
> after hardware detection without the trouble of reordering control
> arrays and indices (EINVAL cannot be used to skip private controls
> because it would prematurely end the enumeration)."
>
> If I understand that correctly, the ioctl (at least for private
> controls), should be succesfull for all the private controls supported
> by the uvcvideo drive and set the V4L2_CTRL_FLAG_DISABLED flag if that
> control isn't handled by the hardware. This would fix private control
> enumartion.

Yes and no. Drivers can use V4L2_CTRL_FLAG_DISABLED but are not required to do 
so.

For most drivers this isn't a problem. The driver support only a limited 
number of controls, and setting V4L2_CTRL_FLAG_DISABLED when a particular 
hardware doesn't support a given control is easy.

The UVC driver is different. The UVC spec allows devices to define new 
controls. The total number of controls could be huge, so using 
V4L2_CTRL_FLAG_DISABLED is not practical. For this reason, you should use the 
enumeration method described in 
http://v4l2spec.bytesex.org/spec-single/v4l2.html#AEN794

> Since I don't know the uvcvideo control code really well I haven't
> started patching it yet and would like a confirmation from the gurus
> that I'm reading the spec correctly.

Best regards,

Laurent Pinchart
_______________________________________________
Linux-uvc-devel mailing list
[email protected]
https://lists.berlios.de/mailman/listinfo/linux-uvc-devel

Reply via email to