9front - general discussion about 9front
 help / color / mirror / Atom feed
* [9front] nusb/serial: fix pl2303 usbcmd error checks
@ 2021-02-16 23:51 Michael Forney
  0 siblings, 0 replies; only message in thread
From: Michael Forney @ 2021-02-16 23:51 UTC (permalink / raw)
  To: 9front


Since 5862:dc783947692e, usbcmd with Rh2d returns the size of the data
stage (excluding the setup packet), so adjust the expected return
values accordingly.

diff 903b37d82b46bee9050d911e81235c4d4d25e4e2 a93cbc303473d336ddd224ac6198bf4499a181b8
--- a/sys/src/cmd/nusb/serial/prolific.c	Mon Feb 15 01:42:11 2021
+++ b/sys/src/cmd/nusb/serial/prolific.c	Tue Feb 16 15:51:37 2021
@@ -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;

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-02-17  0:04 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-16 23:51 [9front] nusb/serial: fix pl2303 usbcmd error checks Michael Forney

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).