ref: 67420a0bf6dd027538d6c98fc4bba9a05dc34efa
parent: 57f250ad421537aa6bfdd9a82500fa9fd9cb366e
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;