git: 9front

Download patch

ref: 1042c89a2062f06f54a3e7195e67616856472164
parent: 082eb9c0c3f1be94e3613c4703728709459f08e0
author: Sigrid Solveig Haflínudóttir <sigrid@ftrv.se>
date: Sun Nov 13 17:11:14 EST 2022

nusb/cam: take max payload transfer size into account when selecting for bandwidth

This fixed frames (usually) filled with green color because
of the wrong alt settings used before.

--- a/sys/src/cmd/nusb/cam/video.c
+++ b/sys/src/cmd/nusb/cam/video.c
@@ -213,7 +213,7 @@
 		if(ep->iface->id != c->iface->id)
 			continue;
 		bw1 = ep->maxpkt * ep->ntds * 8 * 1000 * 8;
-		if(bw1 >= bw) {
+		if(bw1 >= bw && GET4(c->pc.dwMaxPayloadTransferSize) <= ep->maxpkt*ep->ntds) {
 			if(mink == nil || bw1 < minbw){
 				mink = ep;
 				minbw = bw1;
--