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


Since e0087b2a, usbcmd with Rh2d returns the size of the data stage
(excluding the setup packet), so adjust the expected return values
accordingly.
---
diff 9c5ac15e11ffa2c5e57796c3a32baa769cce9aac 6b850d84118c8ee7e66b12daab17ef48fe65176e
--- a/sys/src/cmd/nusb/serial/prolific.c	Wed Feb 10 01:00:05 2021
+++ b/sys/src/cmd/nusb/serial/prolific.c	Sat Jan  1 14:51:18 2022
@@ -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:[~2022-01-02  0:12 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-01 22:51 [9front] [PATCH] 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).