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.
This commit is contained in:
Michael Forney 2022-01-01 22:51:18 +00:00 committed by Ori Bernstein
parent d082a8972f
commit 5c96a51f3a

View file

@ -281,7 +281,7 @@ vendorwrite(Serialport *p, int val, int index)
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 @@ plsetparam(Serialport *p)
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;