Hi Michael,
On Wed, Apr 12, 2023 at 01:57:36PM +0200, Michael Riesch wrote:
> Hi Sakari,
>
> On 4/12/23 13:50, Sakari Ailus wrote:
> > Hi Michael,
> >
> > On Wed, Apr 12, 2023 at 10:00:26AM +0200, Michael Riesch wrote:
> >> - Different controls: If moving = (V4L2_CID_FOCUS_ABSOLUTE == current),
> >> then what happens if the application performs a
> >> V4L2_CID_FOCUS_RELATIVE with -3? current should reach 39,
> >> V4L2_CID_FOCUS_ABSOLUTE is still at 42, the lens is still moving from
> >> the application's point of view.
> >
> > Would there be a reason to implement both of these controls in a single
> > driver? AFAIU, the relative one should be used if there absolute value
> > isn't known to the driver.
>
> Probably not, but on the other hand there is nothing the prevents a
> driver developer from doing so, right? Point is that should there be a
> driver which does implement both controls, we are in trouble AFAIU.
I think the documentation should be improved in this regard.
Also cc Hans.
--
Regards,
Sakari Ailus
Hi Sakari,
On 4/12/23 14:05, Sakari Ailus wrote:
> Hi Michael,
>
> On Wed, Apr 12, 2023 at 01:57:36PM +0200, Michael Riesch wrote:
>> Hi Sakari,
>>
>> On 4/12/23 13:50, Sakari Ailus wrote:
>>> Hi Michael,
>>>
>>> On Wed, Apr 12, 2023 at 10:00:26AM +0200, Michael Riesch wrote:
>>>> - Different controls: If moving = (V4L2_CID_FOCUS_ABSOLUTE == current),
>>>> then what happens if the application performs a
>>>> V4L2_CID_FOCUS_RELATIVE with -3? current should reach 39,
>>>> V4L2_CID_FOCUS_ABSOLUTE is still at 42, the lens is still moving from
>>>> the application's point of view.
>>>
>>> Would there be a reason to implement both of these controls in a single
>>> driver? AFAIU, the relative one should be used if there absolute value
>>> isn't known to the driver.
>>
>> Probably not, but on the other hand there is nothing the prevents a
>> driver developer from doing so, right? Point is that should there be a
>> driver which does implement both controls, we are in trouble AFAIU.
>
> I think the documentation should be improved in this regard.
The documentation of which control exactly? And what items should be added?
Thanks for the pointers!
Best regards,
Michael
>
> Also cc Hans.
>
Hi Michael,
On Wed, Apr 12, 2023 at 03:43:26PM +0200, Michael Riesch wrote:
> Hi Sakari,
>
> On 4/12/23 14:05, Sakari Ailus wrote:
> > Hi Michael,
> >
> > On Wed, Apr 12, 2023 at 01:57:36PM +0200, Michael Riesch wrote:
> >> Hi Sakari,
> >>
> >> On 4/12/23 13:50, Sakari Ailus wrote:
> >>> Hi Michael,
> >>>
> >>> On Wed, Apr 12, 2023 at 10:00:26AM +0200, Michael Riesch wrote:
> >>>> - Different controls: If moving = (V4L2_CID_FOCUS_ABSOLUTE == current),
> >>>> then what happens if the application performs a
> >>>> V4L2_CID_FOCUS_RELATIVE with -3? current should reach 39,
> >>>> V4L2_CID_FOCUS_ABSOLUTE is still at 42, the lens is still moving from
> >>>> the application's point of view.
> >>>
> >>> Would there be a reason to implement both of these controls in a single
> >>> driver? AFAIU, the relative one should be used if there absolute value
> >>> isn't known to the driver.
> >>
> >> Probably not, but on the other hand there is nothing the prevents a
> >> driver developer from doing so, right? Point is that should there be a
> >> driver which does implement both controls, we are in trouble AFAIU.
> >
> > I think the documentation should be improved in this regard.
>
> The documentation of which control exactly? And what items should be added?
Both V4L2_CID_FOCUS_ABSOLUTE and V4L2_CID_FOCUS_RELATIVE. For the former,
the sentence "Positive values set the focus closer to the camera, negative
values towards infinity." doesn't make much sense in the context. For the
latter, what I mentioned earlier, i.e. this should be only implemented if
the absolute value isn't known. It's not a driver's job to do simple
arithmetics for the user space.
In fact, it appears that no driver is using V4L2_CID_FOCUS_RELATIVE at the
moment. So we could as well deprecate it (or remove from documentation
altogether).
--
Kind regards,
Sakari Ailus
Hi Sakari
On Wed, 12 Apr 2023 at 15:39, Sakari Ailus <[email protected]> wrote:
>
> Hi Michael,
>
> On Wed, Apr 12, 2023 at 03:43:26PM +0200, Michael Riesch wrote:
> > Hi Sakari,
> >
> > On 4/12/23 14:05, Sakari Ailus wrote:
> > > Hi Michael,
> > >
> > > On Wed, Apr 12, 2023 at 01:57:36PM +0200, Michael Riesch wrote:
> > >> Hi Sakari,
> > >>
> > >> On 4/12/23 13:50, Sakari Ailus wrote:
> > >>> Hi Michael,
> > >>>
> > >>> On Wed, Apr 12, 2023 at 10:00:26AM +0200, Michael Riesch wrote:
> > >>>> - Different controls: If moving = (V4L2_CID_FOCUS_ABSOLUTE == current),
> > >>>> then what happens if the application performs a
> > >>>> V4L2_CID_FOCUS_RELATIVE with -3? current should reach 39,
> > >>>> V4L2_CID_FOCUS_ABSOLUTE is still at 42, the lens is still moving from
> > >>>> the application's point of view.
> > >>>
> > >>> Would there be a reason to implement both of these controls in a single
> > >>> driver? AFAIU, the relative one should be used if there absolute value
> > >>> isn't known to the driver.
> > >>
> > >> Probably not, but on the other hand there is nothing the prevents a
> > >> driver developer from doing so, right? Point is that should there be a
> > >> driver which does implement both controls, we are in trouble AFAIU.
> > >
> > > I think the documentation should be improved in this regard.
> >
> > The documentation of which control exactly? And what items should be added?
>
> Both V4L2_CID_FOCUS_ABSOLUTE and V4L2_CID_FOCUS_RELATIVE. For the former,
> the sentence "Positive values set the focus closer to the camera, negative
> values towards infinity." doesn't make much sense in the context. For the
> latter, what I mentioned earlier, i.e. this should be only implemented if
> the absolute value isn't known. It's not a driver's job to do simple
> arithmetics for the user space.
>
> In fact, it appears that no driver is using V4L2_CID_FOCUS_RELATIVE at the
> moment. So we could as well deprecate it (or remove from documentation
> altogether).
Atomisp and ov5693 are using it, but only to manipulate the value
behind V4L2_CID_FOCUS_ABSOLUTE. I don't know why elixir.bootlin.com
isn't picking up those references.
https://github.com/torvalds/linux/blob/master/drivers/staging/media/atomisp/pci/atomisp_ioctl.c#L1766
https://github.com/torvalds/linux/blob/master/drivers/staging/media/atomisp/i2c/ov5693/atomisp-ov5693.c#L966
Dave