Hi, in my class I use ten C-TECH CAM-07HD cameras, detected as ID 0402:8841 ALi Corp. Newmine Camera. The camera works OK with resolutions <= 320x240@60fps. Bigger MJPEG resolutions were laggy, with lots of errors in kern.log: usb 1-2: USB isochronous frame lost (-75) xhci_hcd 0000:15:00.0: WARN: buffer overrun event for slot 9 ep 4 on endpoint Bigger YUY2 resolutions did not get any data. Quirks doesn't help. Behavior is the same on (Ubuntu) kernels 6.5.0, 6.2.0, 5.4.0, both on 2.0 and 3.0 USB ports. So I start USB scanning and finally find the reason: - camera sends four isochronous interface descriptors for wMaxPacketSize 1024 bytes and linux uvcvideo module always chooses bAlternateSetting 4. - Windows 10 always chooses bAlternateSetting 1 for the camera and bigger resolutions are working OK there. (I attached listing from lspci -v -d 0402:8841 ) This original line of code from drivers/media/usb/uvc/uvc_video.c if (psize >= bandwidth && psize <= best_psize) { chooses last alt setting in case the same wMaxPacketSize values. If I force using settings 1, 2 or 3 instead in uvc_video.c, my REALLY BAD camera starts working OK like a charm, without log errors. So I offer you to change the line above in some future uvc_video.c to: if (psize >= bandwidth && psize < best_psize) { //first preferency which I probe completely solved this problem and as Windows does the same will not harm other types of cameras. sincerely Karel Janda
Attachment:
ctech.lst
Description: Binary data