Re: [PATCH] media: uvcvideo: Filter hw errors while enumerating controls

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

 



On Thu, 19 Dec 2024 at 00:28, Laurent Pinchart
<laurent.pinchart@xxxxxxxxxxxxxxxx> wrote:
>
> On Wed, Dec 18, 2024 at 03:38:34PM +0100, Ricardo Ribalda wrote:
> > On Fri, 13 Dec 2024 at 12:21, Ricardo Ribalda <ribalda@xxxxxxxxxxxx> wrote:
> > >
> > > To implement VIDIOC_QUERYCTRL, we need to read from the hardware all the
> > > values that were not cached previously. If that read fails, we used to
> > > report back the error to the user.
> > >
> > > Unfortunately this does not play nice with userspace. When they are
> > > enumerating the contols, the only expect an error when there are no
> > > "next" control.
> > >
> > > This is probably a corner case, and could be handled in userspace, but
> > > both v4l2-ctl and yavta fail to enumerate all the controls if we return
> > > then -EIO during VIDIOC_QUERYCTRL. I suspect that there are tons of
> > > userspace apps handling this wrongly as well.
> >
> > Actually it CANNOT be handled in userspace.
> >
> > If we return anything different than 0, the structure is not copied to
> > userspace:
>
> That could be fixed, we do copy data back to userspace in case of
> failure for some ioctls. I don't think that would be needed though, I
> believe we can either mark controls as broken in the uvcvideo driver
> through quirks, or in a dynamic fashion.

I'd rather not introduce more differences between uvc and the rest of
the drivers.

the ctrl framework only seems to return -EINVAL or 0.


>
> > https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/media/v4l2-core/v4l2-ioctl.c#n2929
> > https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/media/v4l2-core/v4l2-ioctl.c#n3490
>
> --
> Regards,
>
> Laurent Pinchart



-- 
Ricardo Ribalda




[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