Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

usb: gadget: g_webcam: Send color matching descriptor per frame

Currently the color matching descriptor is only sent across the wire
a single time, following the descriptors for each format and frame.
According to the UVC 1.5 Specification 3.9.2.6 ("Color Matching
Descriptors"):

"Only one instance is allowed for a given format and if present,
the Color Matching descriptor shall be placed following the Video
and Still Image Frame descriptors for that format".

Add another reference to the color matching descriptor after the
yuyv frames so that it's correctly transmitted for that format
too.

Fixes: a9914127e834 ("USB gadget: Webcam device")
Cc: stable <stable@kernel.org>
Signed-off-by: Daniel Scally <dan.scally@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Link: https://lore.kernel.org/r/20221216160528.479094-1-dan.scally@ideasonboard.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Daniel Scally and committed by
Greg Kroah-Hartman
e95765e9 85af23df

+3
+3
drivers/usb/gadget/legacy/webcam.c
··· 293 293 (const struct uvc_descriptor_header *) &uvc_format_yuv, 294 294 (const struct uvc_descriptor_header *) &uvc_frame_yuv_360p, 295 295 (const struct uvc_descriptor_header *) &uvc_frame_yuv_720p, 296 + (const struct uvc_descriptor_header *) &uvc_color_matching, 296 297 (const struct uvc_descriptor_header *) &uvc_format_mjpg, 297 298 (const struct uvc_descriptor_header *) &uvc_frame_mjpg_360p, 298 299 (const struct uvc_descriptor_header *) &uvc_frame_mjpg_720p, ··· 306 305 (const struct uvc_descriptor_header *) &uvc_format_yuv, 307 306 (const struct uvc_descriptor_header *) &uvc_frame_yuv_360p, 308 307 (const struct uvc_descriptor_header *) &uvc_frame_yuv_720p, 308 + (const struct uvc_descriptor_header *) &uvc_color_matching, 309 309 (const struct uvc_descriptor_header *) &uvc_format_mjpg, 310 310 (const struct uvc_descriptor_header *) &uvc_frame_mjpg_360p, 311 311 (const struct uvc_descriptor_header *) &uvc_frame_mjpg_720p, ··· 319 317 (const struct uvc_descriptor_header *) &uvc_format_yuv, 320 318 (const struct uvc_descriptor_header *) &uvc_frame_yuv_360p, 321 319 (const struct uvc_descriptor_header *) &uvc_frame_yuv_720p, 320 + (const struct uvc_descriptor_header *) &uvc_color_matching, 322 321 (const struct uvc_descriptor_header *) &uvc_format_mjpg, 323 322 (const struct uvc_descriptor_header *) &uvc_frame_mjpg_360p, 324 323 (const struct uvc_descriptor_header *) &uvc_frame_mjpg_720p,