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:
parent
d082a8972f
commit
5c96a51f3a
1 changed files with 2 additions and 2 deletions
|
@ -281,7 +281,7 @@ vendorwrite(Serialport *p, int val, int index)
|
||||||
dsprint(2, "serial: vendorwrite val: 0x%x idx:%d\n", val, index);
|
dsprint(2, "serial: vendorwrite val: 0x%x idx:%d\n", val, index);
|
||||||
res = usbcmd(ser->dev, Rh2d | Rvendor | Rdev, VendorWriteReq,
|
res = usbcmd(ser->dev, Rh2d | Rvendor | Rdev, VendorWriteReq,
|
||||||
val, index, nil, 0);
|
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;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -373,7 +373,7 @@ plsetparam(Serialport *p)
|
||||||
dumpbuf(buf, sizeof buf);
|
dumpbuf(buf, sizeof buf);
|
||||||
res = usbcmd(ser->dev, Rh2d | Rclass | Riface, SetLineReq,
|
res = usbcmd(ser->dev, Rh2d | Rclass | Riface, SetLineReq,
|
||||||
0, 0, buf, sizeof buf);
|
0, 0, buf, sizeof buf);
|
||||||
if(res != 8+ParamReqSz){
|
if(res != ParamReqSz){
|
||||||
fprint(2, "serial: plsetparam failed with res=%d\n", res);
|
fprint(2, "serial: plsetparam failed with res=%d\n", res);
|
||||||
if(res >= 0) werrstr("plsetparam failed with res=%d", res);
|
if(res >= 0) werrstr("plsetparam failed with res=%d", res);
|
||||||
return -1;
|
return -1;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue