From patchwork Fri Sep 15 06:27:51 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans Yang X-Patchwork-Id: 44135 X-Patchwork-Delegate: laurent.pinchart@ideasonboard.com Received: from vger.kernel.org ([209.132.180.67]) by www.linuxtv.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dsk7l-0004q3-MG; Fri, 15 Sep 2017 06:29:13 +0000 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751187AbdIOG26 (ORCPT + 1 other); Fri, 15 Sep 2017 02:28:58 -0400 Received: from hqemgate16.nvidia.com ([216.228.121.65]:9716 "EHLO hqemgate16.nvidia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750787AbdIOG25 (ORCPT ); Fri, 15 Sep 2017 02:28:57 -0400 Received: from hqpgpgate102.nvidia.com (Not Verified[216.228.121.13]) by hqemgate16.nvidia.com id ; Thu, 14 Sep 2017 23:28:41 -0700 Received: from HQMAIL104.nvidia.com ([172.20.161.6]) by hqpgpgate102.nvidia.com (PGP Universal service); Thu, 14 Sep 2017 23:28:46 -0700 X-PGP-Universal: processed; by hqpgpgate102.nvidia.com on Thu, 14 Sep 2017 23:28:46 -0700 Received: from HQMAIL101.nvidia.com (172.20.187.10) by HQMAIL104.nvidia.com (172.18.146.11) with Microsoft SMTP Server (TLS) id 15.0.1293.2; Fri, 15 Sep 2017 06:28:10 +0000 Received: from hqnvemgw02.nvidia.com (172.16.227.111) by HQMAIL101.nvidia.com (172.20.187.10) with Microsoft SMTP Server id 15.0.1293.2 via Frontend Transport; Fri, 15 Sep 2017 06:28:10 +0000 Received: from hansynb.nvidia.com (Not Verified[10.19.108.121]) by hqnvemgw02.nvidia.com with Trustwave SEG (v7, 5, 5, 8150) id ; Thu, 14 Sep 2017 23:28:10 -0700 From: Hans Yang To: CC: , , , Hans Yang Subject: [PATCH resend] [media] uvcvideo: zero seq number when disabling stream Date: Fri, 15 Sep 2017 14:27:51 +0800 Message-ID: <1505456871-12680-1-git-send-email-hansy@nvidia.com> X-Mailer: git-send-email 2.1.4 MIME-Version: 1.0 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org For bulk-based devices, when disabling the video stream, in addition to issue CLEAR_FEATURE(HALT), it is better to set alternate setting 0 as well or the sequnce number in host side will probably not reset to zero. Then in next time video stream start, the device will expect host starts packet from 0 sequence number but host actually continue the sequence number from last transaction and this causes transaction errors. This commit fixes this by adding set alternate setting 0 back as what isoch-based devices do. Below error message will also be eliminated for some devices: uvcvideo: Non-zero status (-71) in video completion handler. Signed-off-by: Hans Yang --- drivers/media/usb/uvc/uvc_video.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/media/usb/uvc/uvc_video.c b/drivers/media/usb/uvc/uvc_video.c index fb86d6af398d..ad80c2a6da6a 100644 --- a/drivers/media/usb/uvc/uvc_video.c +++ b/drivers/media/usb/uvc/uvc_video.c @@ -1862,10 +1862,9 @@ int uvc_video_enable(struct uvc_streaming *stream, int enable) if (!enable) { uvc_uninit_video(stream, 1); - if (stream->intf->num_altsetting > 1) { - usb_set_interface(stream->dev->udev, + usb_set_interface(stream->dev->udev, stream->intfnum, 0); - } else { + if (stream->intf->num_altsetting == 1) { /* UVC doesn't specify how to inform a bulk-based device * when the video stream is stopped. Windows sends a * CLEAR_FEATURE(HALT) request to the video streaming