summaryrefslogtreecommitdiff
path: root/drivers/usb
diff options
context:
space:
mode:
authorMichael Grzeschik <m.grzeschik@pengutronix.de>2024-02-14 02:37:55 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2024-04-13 14:05:17 +0300
commit893b2562613f8e0b8141e15aa2f3791ebdcbd1e8 (patch)
tree1fff9d1cdc1b5d54d18dc9ebd1f507d4a9958114 /drivers/usb
parent7dbf082988d63b4d09c0fc90f616556eafa5448d (diff)
downloadlinux-893b2562613f8e0b8141e15aa2f3791ebdcbd1e8.tar.xz
usb: gadget: uvc: mark incomplete frames with UVC_STREAM_ERR
[ Upstream commit 2a3b7af120477d0571b815ccb8600cafd5ebf02f ] If an frame was transmitted incomplete to the host, we set the UVC_STREAM_ERR bit in the header for the last request that is going to be queued. This way the host will know that it should drop the frame instead of trying to display the corrupted content. Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de> Link: https://lore.kernel.org/r/20240214-uvc-error-tag-v1-2-37659a3877fe@pengutronix.de Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'drivers/usb')
-rw-r--r--drivers/usb/gadget/function/uvc_video.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/usb/gadget/function/uvc_video.c b/drivers/usb/gadget/function/uvc_video.c
index e81865978299..be48d5ab17c7 100644
--- a/drivers/usb/gadget/function/uvc_video.c
+++ b/drivers/usb/gadget/function/uvc_video.c
@@ -35,6 +35,9 @@ uvc_video_encode_header(struct uvc_video *video, struct uvc_buffer *buf,
data[1] = UVC_STREAM_EOH | video->fid;
+ if (video->queue.flags & UVC_QUEUE_DROP_INCOMPLETE)
+ data[1] |= UVC_STREAM_ERR;
+
if (video->queue.buf_used == 0 && ts.tv_sec) {
/* dwClockFrequency is 48 MHz */
u32 pts = ((u64)ts.tv_sec * USEC_PER_SEC + ts.tv_nsec / NSEC_PER_USEC) * 48;