From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Ricardo Ribalda <ribalda@chromium.org>
Cc: Hans Verkuil <hverkuil@xs4all.nl>,
Hans de Goede <hdegoede@redhat.com>,
Mauro Carvalho Chehab <mchehab@kernel.org>,
linux-media@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] media: uvcvideo: Filter hw errors while enumerating controls
Date: Thu, 19 Dec 2024 12:43:58 +0200 [thread overview]
Message-ID: <20241219104358.GA2510@pendragon.ideasonboard.com> (raw)
In-Reply-To: <CANiDSCtyRHgxOkEMYTi56AhoWS7xjskU-BMvGxpeJ=XBNJ=okw@mail.gmail.com>
On Thu, Dec 19, 2024 at 09:18:30AM +0100, Ricardo Ribalda wrote:
> On Thu, 19 Dec 2024 at 00:28, Laurent Pinchart wrote:
> > On Wed, Dec 18, 2024 at 03:38:34PM +0100, Ricardo Ribalda wrote:
> > > On Fri, 13 Dec 2024 at 12:21, Ricardo Ribalda 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.
True, but that's likely because there's no driver today other than
uvcvideo that needs to interogate the hardware in a way that can fail to
implement QUERYCTRL. I wish we didn't have to, but UVC is special from
that point of view.
Anyway, as mentioned in a separate answer in this mail thread, we may
not need this if we hide the problematic controls from applications.
> > > 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
next prev parent reply other threads:[~2024-12-19 10:44 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-13 11:21 Ricardo Ribalda
2024-12-18 14:38 ` Ricardo Ribalda
2024-12-18 23:28 ` Laurent Pinchart
2024-12-19 8:18 ` Ricardo Ribalda
2024-12-19 10:43 ` Laurent Pinchart [this message]
2024-12-18 23:27 ` Laurent Pinchart
2024-12-19 8:17 ` Ricardo Ribalda
2024-12-19 14:41 ` Laurent Pinchart
2024-12-19 15:35 ` Ricardo Ribalda
2024-12-19 15:41 ` Laurent Pinchart
2024-12-19 15:53 ` Ricardo Ribalda
2024-12-19 16:05 ` Hans de Goede
2024-12-19 16:18 ` Ricardo Ribalda
2024-12-19 16:29 ` Hans de Goede
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20241219104358.GA2510@pendragon.ideasonboard.com \
--to=laurent.pinchart@ideasonboard.com \
--cc=hdegoede@redhat.com \
--cc=hverkuil@xs4all.nl \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=mchehab@kernel.org \
--cc=ribalda@chromium.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®