As commented in uvc_video_init,

        /* Alternate setting 0 should be the default, yet the XBox Live Vision
         * Cam (and possibly other devices) crash or otherwise misbehave if
         * they don't receive a SET_INTERFACE request before any other video
         * control request.
         */

so it does make sense to add the SetInterface(0) in .reset_resume
handler so that this kind of devices can work well if they are reseted
during resume from system or runtime suspend.

We have found, without the patch, Microdia camera(0c45:6437) can't send
stream data any longer after it is reseted during resume from
system suspend.

Cc: Jeremy Kerr <jeremy.k...@canonical.com>
Cc: Alan Stern <st...@rowland.harvard.edu>
Signed-off-by: Ming Lei <ming....@canonical.com>
---
 drivers/media/video/uvc/uvc_driver.c |   14 +++++++++++++-
 1 files changed, 13 insertions(+), 1 deletions(-)

diff --git a/drivers/media/video/uvc/uvc_driver.c 
b/drivers/media/video/uvc/uvc_driver.c
index b6eae48..41c6d1a 100644
--- a/drivers/media/video/uvc/uvc_driver.c
+++ b/drivers/media/video/uvc/uvc_driver.c
@@ -1959,8 +1959,20 @@ static int __uvc_resume(struct usb_interface *intf, int 
reset)
        }
 
        list_for_each_entry(stream, &dev->streams, list) {
-               if (stream->intf == intf)
+               if (stream->intf == intf) {
+                       /*
+                        * After usb bus reset, some devices may
+                        * misbehave if SetInterface(0) is not done, for
+                        * example, Microdia camera(0c45:6437) will stop
+                        * sending streaming data. I think XBox Live
+                        * Vision Cam needs it too, as commented in
+                        * uvc_video_init.
+                        */
+                       if (reset)
+                               usb_set_interface(stream->dev->udev,
+                                       stream->intfnum, 0);
                        return uvc_video_resume(stream);
+               }
        }
 
        uvc_trace(UVC_TRACE_SUSPEND, "Resume: video streaming USB interface "
-- 
1.7.4.1




-- 
Ming Lei
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to