ref: 5c96a51f3a0684765afd24930d2df7a899c22d70
parent: d082a8972f9bd3ddb32079eb72b22ece25722970
author: Michael Forney <[email protected]>
date: Sat Jan 1 17:51:18 EST 2022
nusb/serial: fix pl2303 usbcmd error checks Since e0087b2a, usbcmd with Rh2d returns the size of the data stage (excluding the setup packet), so adjust the expected return values accordingly.
--- a/sys/src/cmd/nusb/serial/prolific.c
+++ b/sys/src/cmd/nusb/serial/prolific.c
@@ -281,7 +281,7 @@
dsprint(2, "serial: vendorwrite val: 0x%x idx:%d\n", val, index);
res = usbcmd(ser->dev, Rh2d | Rvendor | Rdev, VendorWriteReq,
val, index, nil, 0);
- if(res != 8) fprint(2, "serial: vendorwrite failed with res=%d\n", res);
+ if(res != 0) fprint(2, "serial: vendorwrite failed with res=%d\n", res);
return res;
}
@@ -373,7 +373,7 @@
dumpbuf(buf, sizeof buf);
res = usbcmd(ser->dev, Rh2d | Rclass | Riface, SetLineReq,
0, 0, buf, sizeof buf);
- if(res != 8+ParamReqSz){
+ if(res != ParamReqSz){
fprint(2, "serial: plsetparam failed with res=%d\n", res);
if(res >= 0) werrstr("plsetparam failed with res=%d", res);
return -1;