Re: [PATCH] media: Add missing "Auto" option to the power line frequency control

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello,

On Tue, Apr 02, 2019 at 01:13:16PM +0300, Sakari Ailus wrote:
> On Sun, Mar 17, 2019 at 01:01:25PM -0400, dorodnic@xxxxxxxxx wrote:
> > From: Sergey Dorodnicov <sergey.dorodnicov@xxxxxxxxx>
> > 
> > Section 4.2.2.3.6 of the USB Device Class Definition for Video Devices,
> > specifies "Auto" as a valid value for the power line frequency control.
> > This makes uvcvideo module consistent with control definition inside
> > /drivers/media/v4l2-core/v4l2-ctrls.c:
> > camera_power_line_frequency[] = {
> > 	"Disabled",
> > 	"50 Hz",
> > 	"60 Hz",
> > 	"Auto",
> > 
> > Signed-off-by: Sergey Dorodnicov <sergey.dorodnicov@xxxxxxxxx>
> > Signed-off-by: Evgeni Raikhel <evgeni.raikhel@xxxxxxxxx>
> > ---
> >  drivers/media/usb/uvc/uvc_ctrl.c | 1 +
> >  1 file changed, 1 insertion(+)
> > 
> > diff --git a/drivers/media/usb/uvc/uvc_ctrl.c b/drivers/media/usb/uvc/uvc_ctrl.c
> > index 14cff91..a85910a 100644
> > --- a/drivers/media/usb/uvc/uvc_ctrl.c
> > +++ b/drivers/media/usb/uvc/uvc_ctrl.c
> > @@ -358,6 +358,7 @@ static const struct uvc_menu_info power_line_frequency_controls[] = {
> >  	{ 0, "Disabled" },
> >  	{ 1, "50 Hz" },
> >  	{ 2, "60 Hz" },
> > +	{ 3, "Auto" },
> 
> The auto option appears to have been added by UVC 1.5, so the menu entry
> may only be available for such devices.

That's correct. The power_line_frequency_controls array can always
contain the auto entry, but its availability should be conditioned on
the UVC protocol version. The PU_POWER_LINE_FREQUENCY_CONTROL control
unfortunately doesn't support GET_MAX, so we can't get the information
in a generic way by querying the control.

One option to keep the code generic would be to add protocol version
information to the uvc_control_mapping structure, to condition control
information on the protocol version. It could take the form of a [min,
max] version range for instance. Entries that don't set the min and max
versions would be applicable to all versions.

> 
> >  };
> >  
> >  static const struct uvc_menu_info exposure_auto_controls[] = {

-- 
Regards,

Laurent Pinchart



[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]

  Powered by Linux