From patchwork Tue Jul 26 03:39:56 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ming Lei X-Patchwork-Id: 106775 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from chlorine.canonical.com (chlorine.canonical.com [91.189.94.204]) by ozlabs.org (Postfix) with ESMTP id 96072B6FD1 for ; Tue, 26 Jul 2011 13:40:31 +1000 (EST) Received: from localhost ([127.0.0.1] helo=chlorine.canonical.com) by chlorine.canonical.com with esmtp (Exim 4.71) (envelope-from ) id 1QlYVA-0000Ot-C7; Tue, 26 Jul 2011 03:40:12 +0000 Received: from adelie.canonical.com ([91.189.90.139]) by chlorine.canonical.com with esmtp (Exim 4.71) (envelope-from ) id 1QlYV8-0000Oo-9W for kernel-team@lists.ubuntu.com; Tue, 26 Jul 2011 03:40:10 +0000 Received: from youngberry.canonical.com ([91.189.89.112]) by adelie.canonical.com with esmtp (Exim 4.71 #1 (Debian)) id 1QlYV8-0003hb-5m for ; Tue, 26 Jul 2011 03:40:10 +0000 Received: from [183.37.197.101] (helo=tom-ThinkPad-T410) by youngberry.canonical.com with esmtpsa (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1QlYV7-0007aO-5Q for kernel-team@lists.ubuntu.com; Tue, 26 Jul 2011 03:40:10 +0000 Date: Tue, 26 Jul 2011 11:39:56 +0800 From: Ming Lei To: kernel-team@lists.ubuntu.com Subject: [PATCH][Natty SRU] UBUNTU: SAUCE: uvcvideo: add SetInterface(0) in .reset_resume handler Message-ID: <20110726113956.17e7acf3@tom-ThinkPad-T410> X-Mailer: Claws Mail 3.7.8 (GTK+ 2.24.4; x86_64-pc-linux-gnu) Mime-Version: 1.0 X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.13 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: kernel-team-bounces@lists.ubuntu.com Errors-To: kernel-team-bounces@lists.ubuntu.com From 2f485a24a5732b980f2d1c7097469f07cb848c70 Mon Sep 17 00:00:00 2001 From: Ming Lei Date: Sat, 16 Jul 2011 11:29:45 +0800 Subject: [PATCH][Natty SRU] UBUNTU: SAUCE: uvcvideo: add SetInterface(0) in .reset_resume handler 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. SRU Justification: Impact: - without the patch, the Microdia camera(0c45:6437) can't work after system resume Fix: - After applying the patch, the camera can work well after system resume BugLink: http://bugs.launchpad.net/bugs/733509 upstream discusstion: http://marc.info/?t=131037773100002&r=1&w=2 Signed-off-by: Ming Lei Cc: Jeremy Kerr Acked-by: Andy Whitcroft Acked-by: Leann Ogasawara --- BTW: The patch will enter 3.1-rc later, not sure how Oneiric will merge the patch. --- 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. Looks like 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 "