kernel_samsung_a53x/drivers/media/usb
Ricardo Ribalda e3fb9d39dc media: uvcvideo: Ignore empty TS packets
[ Upstream commit 5cd7c25f6f0576073b3d03bc4cfb1e8ca63a1195 ]

Some SunplusIT cameras took a borderline interpretation of the UVC 1.5
standard, and fill the PTS and SCR fields with invalid data if the
package does not contain data.

"STC must be captured when the first video data of a video frame is put
on the USB bus."

Some SunplusIT devices send, e.g.,

buffer: 0xa7755c00 len 000012 header:0x8c stc 00000000 sof 0000 pts 00000000
buffer: 0xa7755c00 len 000012 header:0x8c stc 00000000 sof 0000 pts 00000000
buffer: 0xa7755c00 len 000668 header:0x8c stc 73779dba sof 070c pts 7376d37a

While the UVC specification meant that the first two packets shouldn't
have had the SCR bit set in the header.

This borderline/buggy interpretation has been implemented in a variety
of devices, from directly SunplusIT and from other OEMs that rebrand
SunplusIT products. So quirking based on VID:PID will be problematic.

All the affected modules have the following extension unit:
VideoControl Interface Descriptor:
  guidExtensionCode         {82066163-7050-ab49-b8cc-b3855e8d221d}

But the vendor plans to use that GUID in the future and fix the bug,
this means that we should use heuristic to figure out the broken
packets.

This patch takes care of this.

lsusb of one of the affected cameras:

Bus 001 Device 003: ID 1bcf:2a01 Sunplus Innovation Technology Inc.
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               2.01
  bDeviceClass          239 Miscellaneous Device
  bDeviceSubClass         2 ?
  bDeviceProtocol         1 Interface Association
  bMaxPacketSize0        64
  idVendor           0x1bcf Sunplus Innovation Technology Inc.
  idProduct          0x2a01
  bcdDevice            0.02
  iManufacturer           1 SunplusIT Inc
  iProduct                2 HanChen Wise Camera
  iSerial                 3 01.00.00
  bNumConfigurations      1

Tested-by: HungNien Chen <hn.chen@sunplusit.com>
Reviewed-by: Sergey Senozhatsky <senozhatsky@chromium.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
Reviewed-by: Tomasz Figa <tfiga@chromium.org>
Link: https://lore.kernel.org/r/20240323-resend-hwtimestamp-v10-2-b08e590d97c7@chromium.org
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-11-23 23:20:24 +01:00
..
airspy Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
as102 Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
au0828 Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
b2c2 media: flexcop-usb: fix sanity check of bNumEndpoints 2024-11-19 12:27:06 +01:00
cpia2 Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
cx231xx media: cx231xx: fix a memleak in cx231xx_init_isoc 2024-11-18 12:12:40 +01:00
dvb-usb media: dvb-usb: Fix unexpected infinite loop in dvb_usb_read_remote_control() 2024-11-23 23:20:08 +01:00
dvb-usb-v2 media: dvb-usb-v2: af9035: fix missing unlock 2024-11-18 11:43:07 +01:00
em28xx media: em28xx: annotate unchecked call to media_device_register() 2024-11-19 08:44:51 +01:00
go7007 media: go7007: fix a memleak in go7007_load_encoder 2024-11-19 08:44:55 +01:00
gspca media: gspca: cpia1: shift-out-of-bounds in set_flicker 2024-11-18 11:43:14 +01:00
hackrf Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
hdpvr Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
msi2500 Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
pvrusb2 media: pvrusb2: fix uaf in pvr2_context_set_notify 2024-11-19 08:44:55 +01:00
pwc Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
s2255 media: s2255: Use refcount_t instead of atomic_t for num_channels 2024-11-19 14:19:40 +01:00
siano Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
stk1160 media: stk1160: fix bounds checking in stk1160_copy_video() 2024-11-19 12:27:06 +01:00
stkwebcam Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
tm6000 Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
ttusb-budget Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
ttusb-dec Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
usbtv Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
uvc media: uvcvideo: Ignore empty TS packets 2024-11-23 23:20:24 +01:00
zr364xx Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
Kconfig Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
Makefile Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00