mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Henry Lin <henryl@nvidia.com>
To: Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
	"Mauro Carvalho Chehab" <mchehab@kernel.org>
Cc: <linux-media@vger.kernel.org>, <linux-usb@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>, Henry Lin <henryl@nvidia.com>
Subject: [RFC PATCH 1/1] media: uvcvideo: reset interface on bulk stream stop
Date: Mon, 25 May 2026 18:20:28 +0000	[thread overview]
Message-ID: <20260525182028.2148267-2-henryl@nvidia.com> (raw)
In-Reply-To: <20260525182028.2148267-1-henryl@nvidia.com>

From: Hans Yang <hansy@nvidia.com>

Some bulk-based UVC devices expect the stream sequence number to be
reset when the video stream is stopped. The driver currently issues
CLEAR_FEATURE(ENDPOINT_HALT) for bulk endpoints, but does not reset the
streaming interface alternate setting to 0 in that path.

When streaming is started again, the device may expect packets to
start from sequence number 0 while the host continues from the
previous transaction, leading to transfer errors such as:

  uvcvideo: Non-zero status (-71) in video completion handler.

Reset the streaming interface alternate setting to 0 before clearing
halt, matching the stop path used for isochronous endpoints.

Signed-off-by: Hans Yang <hansy@nvidia.com>
Signed-off-by: Henry Lin <henryl@nvidia.com>
---
 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 2094e059d7d3..20cae606f463 100644
--- a/drivers/media/usb/uvc/uvc_video.c
+++ b/drivers/media/usb/uvc/uvc_video.c
@@ -2319,9 +2319,8 @@ void uvc_video_stop_streaming(struct uvc_streaming *stream)
 {
 	uvc_video_stop_transfer(stream, 1);
 
-	if (stream->intf->num_altsetting > 1) {
-		usb_set_interface(stream->dev->udev, stream->intfnum, 0);
-	} else {
+	usb_set_interface(stream->dev->udev, stream->intfnum, 0);
+	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
-- 
2.43.0

  reply	other threads:[~2026-05-25 18:21 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-25 18:20 [RFC PATCH 0/1] " Henry Lin
2026-05-25 18:20 ` Henry Lin [this message]
2026-05-25 19:40 ` Alan Stern
2026-05-26  9:57   ` Henry Lin
2026-05-25 23:55 ` Michal Pecio
2026-05-26  9:55   ` Henry Lin
2026-05-26 10:16     ` Michal Pecio
2026-05-28  8:36       ` Henry Lin
2026-05-28 16:45         ` Michal Pecio

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260525182028.2148267-2-henryl@nvidia.com \
    --to=henryl@nvidia.com \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=mchehab@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome