From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com>
Cc: Hans Petter Selasky <hps@selasky.org>,
Linux Media Mailing List <linux-media@vger.kernel.org>
Subject: Re: [PATCH] Genesys Logic UVC microscopes used to work with Linux
Date: Tue, 8 Jun 2021 01:29:12 +0300 [thread overview]
Message-ID: <YL6duHwW4FKwbelU@pendragon.ideasonboard.com> (raw)
In-Reply-To: <CAPybu_3058QGK3uRZn4Q9Pru5ReMjVyD4tj9_+Lt4y0kxskfcA@mail.gmail.com>
On Mon, Jun 07, 2021 at 10:17:35PM +0200, Ricardo Ribalda Delgado wrote:
> Maybe you want to handle this with a quirk? I suspect that some
> devices might work differently with this patches?
Furthermore, for the affected devices, shouldn't the driver cache the
value of the control and apply it only after starting streaming ?
Otherwise a V4L2_S_CTRL() with a new value before streaming will break
the device.
> On Sun, Jun 6, 2021 at 3:36 PM Hans Petter Selasky <hps@selasky.org> wrote:
> >
> > Hi,
> >
> > Some USB video class compliant devices, like Genesys Logic camera chips,
> > used in cheap microscopes, doesn't provide any image if there are UVC
> > SET current value commands for the processing unit, before the camera
> > stream is activated. Fix this by not issuing any UVC SET current value
> > commands, if the value was not changed. This should also work fine with
> > existing UVC compliant webcams and optimized the number of needed
> > processing unit control endpoint requests.
> >
> > Signed-off-by: Hans Petter Selasky <hps@selasky.org>
> >
> > diff --git a/drivers/media/usb/uvc/uvc_ctrl.c
> > b/drivers/media/usb/uvc/uvc_ctrl.c
> > index b3dde98499f4..0d7137eca331 100644
> > --- a/drivers/media/usb/uvc/uvc_ctrl.c
> > +++ b/drivers/media/usb/uvc/uvc_ctrl.c
> > @@ -1697,7 +1697,13 @@ int uvc_ctrl_set(struct uvc_fh *handle,
> > if (ctrl->info.flags & UVC_CTRL_FLAG_ASYNCHRONOUS)
> > ctrl->handle = handle;
> >
> > - ctrl->dirty = 1;
> > + /* Avoid setting the current value. */
> > + if (!ctrl->dirty &&
> > + memcmp(uvc_ctrl_data(ctrl, UVC_CTRL_DATA_BACKUP),
> > + uvc_ctrl_data(ctrl, UVC_CTRL_DATA_CURRENT),
> > + ctrl->info.size) != 0)
> > + ctrl->dirty = 1;
> > +
> > ctrl->modified = 1;
> > return 0;
> > }
--
Regards,
Laurent Pinchart
next prev parent reply other threads:[~2021-06-07 22:29 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-06-05 21:32 Genesys Logic UVC microscopes used to work with Linux, but no longer do Hans Petter Selasky
2021-06-06 13:32 ` [PATCH] Genesys Logic UVC microscopes used to work with Linux Hans Petter Selasky
2021-06-07 20:17 ` Ricardo Ribalda Delgado
2021-06-07 22:29 ` Laurent Pinchart [this message]
2021-06-06 19:41 ` Genesys Logic UVC microscopes used to work with Linux, but no longer do Ricardo Ribalda Delgado
2021-06-07 13:09 ` Hans Petter Selasky
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=YL6duHwW4FKwbelU@pendragon.ideasonboard.com \
--to=laurent.pinchart@ideasonboard.com \
--cc=hps@selasky.org \
--cc=linux-media@vger.kernel.org \
--cc=ricardo.ribalda@gmail.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.