From patchwork Sat Jul 16 03:51:00 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ming Lei X-Patchwork-Id: 981202 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.4) with ESMTP id p6G3u6Z7024305 for ; Sat, 16 Jul 2011 03:56:06 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752229Ab1GPDvX (ORCPT ); Fri, 15 Jul 2011 23:51:23 -0400 Received: from mail-iy0-f174.google.com ([209.85.210.174]:49823 "EHLO mail-iy0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751587Ab1GPDvW (ORCPT ); Fri, 15 Jul 2011 23:51:22 -0400 Received: by iyb12 with SMTP id 12so1668252iyb.19 for ; Fri, 15 Jul 2011 20:51:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=date:from:to:cc:subject:message-id:in-reply-to:references :organization:x-mailer:mime-version:content-type :content-transfer-encoding; bh=YO8d7/ItORRIW0Ndmwna13k56x9mdv+C7vKP78Aevgs=; b=fu71W/+9POa2sKfimxFY0TUT52wWleV0VzYaIe142PVrqRCHgFLAErVlPqbbKtZEK6 sPaooEdMxgaPylhPiw+b2SOQhE3Us9llTzE2xY3nGptbZJ3J1RpWrbOWrbrrBi9oX0zz betNPjycpXzZ1JjUOb6rBN4dDpVH2aEua11Rs= Received: by 10.42.148.200 with SMTP id s8mr4406906icv.187.1310788281646; Fri, 15 Jul 2011 20:51:21 -0700 (PDT) Received: from tom-ThinkPad-T410 ([183.37.197.170]) by mx.google.com with ESMTPS id ft12sm1267790ibb.53.2011.07.15.20.51.15 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 15 Jul 2011 20:51:21 -0700 (PDT) Date: Sat, 16 Jul 2011 11:51:00 +0800 From: Ming Lei To: Laurent Pinchart , Cc: Alan Stern , Ming Lei , , Jeremy Kerr , Mauro Carvalho Chehab Subject: [PATCH] uvcvideo: add SetInterface(0) in .reset_resume handler Message-ID: <20110716115100.10f6f764@tom-ThinkPad-T410> In-Reply-To: References: Organization: Ming X-Mailer: Claws Mail 3.7.8 (GTK+ 2.24.4; x86_64-pc-linux-gnu) Mime-Version: 1.0 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Sat, 16 Jul 2011 03:56:06 +0000 (UTC) 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 Cc: Alan Stern Signed-off-by: Ming Lei --- 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 "