linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Hans Petter Selasky <hps@selasky.org>
To: Linux Media Mailing List <linux-media@vger.kernel.org>
Subject: [PATCH] Genesys Logic UVC microscopes used to work with Linux
Date: Sun, 6 Jun 2021 15:32:55 +0200	[thread overview]
Message-ID: <b3747aa3-9984-0456-943a-b16e687c0ec0@selasky.org> (raw)
In-Reply-To: <478e73fc-0e2c-4f1b-11d4-c71067764571@selasky.org>

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;
  }

  reply	other threads:[~2021-06-06 13:34 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 ` Hans Petter Selasky [this message]
2021-06-07 20:17   ` [PATCH] Genesys Logic UVC microscopes used to work with Linux Ricardo Ribalda Delgado
2021-06-07 22:29     ` Laurent Pinchart
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=b3747aa3-9984-0456-943a-b16e687c0ec0@selasky.org \
    --to=hps@selasky.org \
    --cc=linux-media@vger.kernel.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;
as well as URLs for NNTP newsgroup(s).