From mboxrd@z Thu Jan 1 00:00:00 1970 Return-path: Received: from perceval.ideasonboard.com ([95.142.166.194]:58808 "EHLO perceval.ideasonboard.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752991Ab1GaWH7 (ORCPT ); Sun, 31 Jul 2011 18:07:59 -0400 From: Laurent Pinchart To: Ming Lei Subject: Re: [PATCH] uvcvideo: add SetInterface(0) in .reset_resume handler Date: Sun, 31 Jul 2011 17:38:57 +0200 Cc: linux-media@vger.kernel.org, Alan Stern , Ming Lei , linux-usb@vger.kernel.org, Jeremy Kerr , Mauro Carvalho Chehab References: <20110716115100.10f6f764@tom-ThinkPad-T410> In-Reply-To: <20110716115100.10f6f764@tom-ThinkPad-T410> MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <201107311738.58462.laurent.pinchart@ideasonboard.com> Sender: linux-media-owner@vger.kernel.org List-ID: Hi Ming, Thanks for the patch. I've queued it for v3.2 with a small modification (the usb_set_interface() call has been moved to uvc_video.c). On Saturday 16 July 2011 05:51:00 Ming Lei wrote: > 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 " -- Regards, Laurent Pinchart