9front - general discussion about 9front
 help / color / mirror / Atom feed
From: Michael Forney <mforney@mforney.org>
To: 9front@9front.org
Subject: [9front] nusb/serial: fix pl2303 usbcmd error checks
Date: Tue, 16 Feb 2021 23:51:37 +0000
Message-ID: <2C3ED12F4D58C29EA86D2DE288EBDDFC@arrow.hsd1.ca.comcast.net> (raw)


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;

                 reply	other threads:[~2021-02-17  0:04 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2C3ED12F4D58C29EA86D2DE288EBDDFC@arrow.hsd1.ca.comcast.net \
    --to=mforney@mforney.org \
    --cc=9front@9front.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

9front - general discussion about 9front

This inbox may be cloned and mirrored by anyone:

	git clone --mirror http://inbox.vuxu.org/9front

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V1 9front 9front/ http://inbox.vuxu.org/9front \
		9front@9front.org
	public-inbox-index 9front

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://inbox.vuxu.org/vuxu.archive.9front


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git