git: ec97e9ca1fa5 - main - Fully revert f83f5d58394db57576bbed6dc7531997cabeb102 for the sys/dev/usb/serial folder, only keeping the zero length packet API introduced in sys/dev/usb after more reports of USB serial devices not supporting ZLPs.
Hans Petter Selasky
hselasky at FreeBSD.org
Fri Aug 20 16:01:28 UTC 2021
The branch main has been updated by hselasky:
URL: https://cgit.FreeBSD.org/src/commit/?id=ec97e9ca1fa543a4a803e84706564d41cd492065
commit ec97e9ca1fa543a4a803e84706564d41cd492065
Author: Hans Petter Selasky <hselasky at FreeBSD.org>
AuthorDate: 2021-08-20 15:59:29 +0000
Commit: Hans Petter Selasky <hselasky at FreeBSD.org>
CommitDate: 2021-08-20 16:00:42 +0000
Fully revert f83f5d58394db57576bbed6dc7531997cabeb102 for the sys/dev/usb/serial
folder, only keeping the zero length packet API introduced in sys/dev/usb
after more reports of USB serial devices not supporting ZLPs.
Reported by: mav@
MFC after: 1 week
Sponsored by: NVIDIA Networking
---
sys/dev/usb/serial/u3g.c | 6 ++----
sys/dev/usb/serial/uark.c | 10 ++++------
sys/dev/usb/serial/ubsa.c | 10 ++++------
sys/dev/usb/serial/ubser.c | 10 ++++------
sys/dev/usb/serial/uchcom.c | 6 ++----
sys/dev/usb/serial/ufoma.c | 10 ++++------
sys/dev/usb/serial/uftdi.c | 1 +
sys/dev/usb/serial/ugensa.c | 11 +++++------
sys/dev/usb/serial/uipaq.c | 10 ++++------
sys/dev/usb/serial/ulpt.c | 9 +++++----
sys/dev/usb/serial/umcs.c | 10 ++++------
sys/dev/usb/serial/umodem.c | 18 +++++++++---------
sys/dev/usb/serial/umoscom.c | 10 ++++------
sys/dev/usb/serial/uplcom.c | 21 ++++++++++-----------
sys/dev/usb/serial/uslcom.c | 10 ++++------
sys/dev/usb/serial/uvscom.c | 10 ++++------
16 files changed, 70 insertions(+), 92 deletions(-)
diff --git a/sys/dev/usb/serial/u3g.c b/sys/dev/usb/serial/u3g.c
index d7d8fd80b42a..22e4e8f6b2bb 100644
--- a/sys/dev/usb/serial/u3g.c
+++ b/sys/dev/usb/serial/u3g.c
@@ -978,7 +978,8 @@ u3g_attach(device_t dev)
/* set stall by default */
mtx_lock(&sc->sc_mtx);
- usbd_xfer_set_zlp(sc->sc_xfer[nports][U3G_BULK_WR]);
+ usbd_xfer_set_stall(sc->sc_xfer[nports][U3G_BULK_WR]);
+ usbd_xfer_set_stall(sc->sc_xfer[nports][U3G_BULK_RD]);
mtx_unlock(&sc->sc_mtx);
nports++; /* found one port */
@@ -1099,9 +1100,6 @@ u3g_write_callback(struct usb_xfer *xfer, usb_error_t error)
case USB_ST_TRANSFERRED:
case USB_ST_SETUP:
tr_setup:
- if (usbd_xfer_get_and_clr_zlp(xfer))
- break;
-
for (frame = 0; frame != U3G_TXFRAMES; frame++) {
usbd_xfer_set_frame_offset(xfer, frame * U3G_TXSIZE, frame);
diff --git a/sys/dev/usb/serial/uark.c b/sys/dev/usb/serial/uark.c
index 072edf6389cd..904977e1ec14 100644
--- a/sys/dev/usb/serial/uark.c
+++ b/sys/dev/usb/serial/uark.c
@@ -219,7 +219,8 @@ uark_attach(device_t dev)
}
/* clear stall at first run */
mtx_lock(&sc->sc_mtx);
- usbd_xfer_set_zlp(sc->sc_xfer[UARK_BULK_DT_WR]);
+ usbd_xfer_set_stall(sc->sc_xfer[UARK_BULK_DT_WR]);
+ usbd_xfer_set_stall(sc->sc_xfer[UARK_BULK_DT_RD]);
mtx_unlock(&sc->sc_mtx);
error = ucom_attach(&sc->sc_super_ucom, &sc->sc_ucom, 1, sc,
@@ -280,16 +281,13 @@ uark_bulk_write_callback(struct usb_xfer *xfer, usb_error_t error)
case USB_ST_SETUP:
case USB_ST_TRANSFERRED:
tr_setup:
- if (usbd_xfer_get_and_clr_zlp(xfer))
- break;
-
pc = usbd_xfer_get_frame(xfer, 0);
if (ucom_get_data(&sc->sc_ucom, pc, 0,
UARK_BUF_SIZE, &actlen)) {
usbd_xfer_set_frame_len(xfer, 0, actlen);
usbd_transfer_submit(xfer);
}
- break;
+ return;
default: /* Error */
if (error != USB_ERR_CANCELLED) {
@@ -297,7 +295,7 @@ tr_setup:
usbd_xfer_set_stall(xfer);
goto tr_setup;
}
- break;
+ return;
}
}
diff --git a/sys/dev/usb/serial/ubsa.c b/sys/dev/usb/serial/ubsa.c
index 3286df7331b4..10b37984db2f 100644
--- a/sys/dev/usb/serial/ubsa.c
+++ b/sys/dev/usb/serial/ubsa.c
@@ -320,7 +320,8 @@ ubsa_attach(device_t dev)
}
/* clear stall at first run */
mtx_lock(&sc->sc_mtx);
- usbd_xfer_set_zlp(sc->sc_xfer[UBSA_BULK_DT_WR]);
+ usbd_xfer_set_stall(sc->sc_xfer[UBSA_BULK_DT_WR]);
+ usbd_xfer_set_stall(sc->sc_xfer[UBSA_BULK_DT_RD]);
mtx_unlock(&sc->sc_mtx);
error = ucom_attach(&sc->sc_super_ucom, &sc->sc_ucom, 1, sc,
@@ -582,16 +583,13 @@ ubsa_write_callback(struct usb_xfer *xfer, usb_error_t error)
case USB_ST_SETUP:
case USB_ST_TRANSFERRED:
tr_setup:
- if (usbd_xfer_get_and_clr_zlp(xfer))
- break;
-
pc = usbd_xfer_get_frame(xfer, 0);
if (ucom_get_data(&sc->sc_ucom, pc, 0,
UBSA_BSIZE, &actlen)) {
usbd_xfer_set_frame_len(xfer, 0, actlen);
usbd_transfer_submit(xfer);
}
- break;
+ return;
default: /* Error */
if (error != USB_ERR_CANCELLED) {
@@ -599,7 +597,7 @@ tr_setup:
usbd_xfer_set_stall(xfer);
goto tr_setup;
}
- break;
+ return;
}
}
diff --git a/sys/dev/usb/serial/ubser.c b/sys/dev/usb/serial/ubser.c
index 61b9c6c433fb..2a35756b0a7e 100644
--- a/sys/dev/usb/serial/ubser.c
+++ b/sys/dev/usb/serial/ubser.c
@@ -293,7 +293,8 @@ ubser_attach(device_t dev)
ucom_set_pnpinfo_usb(&sc->sc_super_ucom, dev);
mtx_lock(&sc->sc_mtx);
- usbd_xfer_set_zlp(sc->sc_xfer[UBSER_BULK_DT_WR]);
+ usbd_xfer_set_stall(sc->sc_xfer[UBSER_BULK_DT_WR]);
+ usbd_xfer_set_stall(sc->sc_xfer[UBSER_BULK_DT_RD]);
usbd_transfer_start(sc->sc_xfer[UBSER_BULK_DT_RD]);
mtx_unlock(&sc->sc_mtx);
@@ -409,9 +410,6 @@ ubser_write_callback(struct usb_xfer *xfer, usb_error_t error)
case USB_ST_SETUP:
case USB_ST_TRANSFERRED:
tr_setup:
- if (usbd_xfer_get_and_clr_zlp(xfer))
- break;
-
pc = usbd_xfer_get_frame(xfer, 0);
do {
if (ucom_get_data(sc->sc_ucom + sc->sc_curr_tx_unit,
@@ -432,7 +430,7 @@ tr_setup:
} while (sc->sc_curr_tx_unit != first_unit);
- break;
+ return;
default: /* Error */
if (error != USB_ERR_CANCELLED) {
@@ -440,7 +438,7 @@ tr_setup:
usbd_xfer_set_stall(xfer);
goto tr_setup;
}
- break;
+ return;
}
}
diff --git a/sys/dev/usb/serial/uchcom.c b/sys/dev/usb/serial/uchcom.c
index aef1515d3586..6b17141c6ece 100644
--- a/sys/dev/usb/serial/uchcom.c
+++ b/sys/dev/usb/serial/uchcom.c
@@ -350,7 +350,8 @@ uchcom_attach(device_t dev)
/* clear stall at first run */
mtx_lock(&sc->sc_mtx);
- usbd_xfer_set_zlp(sc->sc_xfer[UCHCOM_BULK_DT_WR]);
+ usbd_xfer_set_stall(sc->sc_xfer[UCHCOM_BULK_DT_WR]);
+ usbd_xfer_set_stall(sc->sc_xfer[UCHCOM_BULK_DT_RD]);
mtx_unlock(&sc->sc_mtx);
error = ucom_attach(&sc->sc_super_ucom, &sc->sc_ucom, 1, sc,
@@ -827,9 +828,6 @@ uchcom_write_callback(struct usb_xfer *xfer, usb_error_t error)
case USB_ST_SETUP:
case USB_ST_TRANSFERRED:
tr_setup:
- if (usbd_xfer_get_and_clr_zlp(xfer))
- break;
-
pc = usbd_xfer_get_frame(xfer, 0);
if (ucom_get_data(&sc->sc_ucom, pc, 0,
usbd_xfer_max_len(xfer), &actlen)) {
diff --git a/sys/dev/usb/serial/ufoma.c b/sys/dev/usb/serial/ufoma.c
index ca52752accad..bc3f00a7b473 100644
--- a/sys/dev/usb/serial/ufoma.c
+++ b/sys/dev/usb/serial/ufoma.c
@@ -438,7 +438,8 @@ ufoma_attach(device_t dev)
/* clear stall at first run, if any */
mtx_lock(&sc->sc_mtx);
- usbd_xfer_set_zlp(sc->sc_bulk_xfer[UFOMA_BULK_ENDPT_WRITE]);
+ usbd_xfer_set_stall(sc->sc_bulk_xfer[UFOMA_BULK_ENDPT_WRITE]);
+ usbd_xfer_set_stall(sc->sc_bulk_xfer[UFOMA_BULK_ENDPT_READ]);
mtx_unlock(&sc->sc_mtx);
error = ucom_attach(&sc->sc_super_ucom, &sc->sc_ucom, 1, sc,
@@ -790,16 +791,13 @@ ufoma_bulk_write_callback(struct usb_xfer *xfer, usb_error_t error)
case USB_ST_SETUP:
case USB_ST_TRANSFERRED:
tr_setup:
- if (usbd_xfer_get_and_clr_zlp(xfer))
- break;
-
pc = usbd_xfer_get_frame(xfer, 0);
if (ucom_get_data(&sc->sc_ucom, pc, 0,
UFOMA_BULK_BUF_SIZE, &actlen)) {
usbd_xfer_set_frame_len(xfer, 0, actlen);
usbd_transfer_submit(xfer);
}
- break;
+ return;
default: /* Error */
if (error != USB_ERR_CANCELLED) {
@@ -807,7 +805,7 @@ tr_setup:
usbd_xfer_set_stall(xfer);
goto tr_setup;
}
- break;
+ return;
}
}
diff --git a/sys/dev/usb/serial/uftdi.c b/sys/dev/usb/serial/uftdi.c
index 7fd531b3e381..a630fcbac5b5 100644
--- a/sys/dev/usb/serial/uftdi.c
+++ b/sys/dev/usb/serial/uftdi.c
@@ -1118,6 +1118,7 @@ uftdi_attach(device_t dev)
/* clear stall at first run */
mtx_lock(&sc->sc_mtx);
usbd_xfer_set_stall(sc->sc_xfer[UFTDI_BULK_DT_WR]);
+ usbd_xfer_set_stall(sc->sc_xfer[UFTDI_BULK_DT_RD]);
mtx_unlock(&sc->sc_mtx);
/* set a valid "lcr" value */
diff --git a/sys/dev/usb/serial/ugensa.c b/sys/dev/usb/serial/ugensa.c
index 1d2f1e57ef58..ba694e4805bd 100644
--- a/sys/dev/usb/serial/ugensa.c
+++ b/sys/dev/usb/serial/ugensa.c
@@ -233,8 +233,10 @@ ugensa_attach(device_t dev)
break;
}
+ /* clear stall at first run */
mtx_lock(&sc->sc_mtx);
- usbd_xfer_set_zlp(ssc->sc_xfer[UGENSA_BULK_DT_WR]);
+ usbd_xfer_set_stall(ssc->sc_xfer[UGENSA_BULK_DT_WR]);
+ usbd_xfer_set_stall(ssc->sc_xfer[UGENSA_BULK_DT_RD]);
mtx_unlock(&sc->sc_mtx);
/* initialize port number */
@@ -311,16 +313,13 @@ ugensa_bulk_write_callback(struct usb_xfer *xfer, usb_error_t error)
case USB_ST_SETUP:
case USB_ST_TRANSFERRED:
tr_setup:
- if (usbd_xfer_get_and_clr_zlp(xfer))
- break;
-
pc = usbd_xfer_get_frame(xfer, 0);
if (ucom_get_data(ssc->sc_ucom_ptr, pc, 0,
UGENSA_BUF_SIZE, &actlen)) {
usbd_xfer_set_frame_len(xfer, 0, actlen);
usbd_transfer_submit(xfer);
}
- break;
+ return;
default: /* Error */
if (error != USB_ERR_CANCELLED) {
@@ -328,7 +327,7 @@ tr_setup:
usbd_xfer_set_stall(xfer);
goto tr_setup;
}
- break;
+ return;
}
}
diff --git a/sys/dev/usb/serial/uipaq.c b/sys/dev/usb/serial/uipaq.c
index 0449a5663c71..33f2ae4c0845 100644
--- a/sys/dev/usb/serial/uipaq.c
+++ b/sys/dev/usb/serial/uipaq.c
@@ -1157,7 +1157,8 @@ uipaq_attach(device_t dev)
}
/* clear stall at first run */
mtx_lock(&sc->sc_mtx);
- usbd_xfer_set_zlp(sc->sc_xfer[UIPAQ_BULK_DT_WR]);
+ usbd_xfer_set_stall(sc->sc_xfer[UIPAQ_BULK_DT_WR]);
+ usbd_xfer_set_stall(sc->sc_xfer[UIPAQ_BULK_DT_RD]);
mtx_unlock(&sc->sc_mtx);
error = ucom_attach(&sc->sc_super_ucom, &sc->sc_ucom, 1, sc,
@@ -1319,16 +1320,13 @@ uipaq_write_callback(struct usb_xfer *xfer, usb_error_t error)
case USB_ST_SETUP:
case USB_ST_TRANSFERRED:
tr_setup:
- if (usbd_xfer_get_and_clr_zlp(xfer))
- break;
-
pc = usbd_xfer_get_frame(xfer, 0);
if (ucom_get_data(&sc->sc_ucom, pc, 0,
UIPAQ_BUF_SIZE, &actlen)) {
usbd_xfer_set_frame_len(xfer, 0, actlen);
usbd_transfer_submit(xfer);
}
- break;
+ return;
default: /* Error */
if (error != USB_ERR_CANCELLED) {
@@ -1336,7 +1334,7 @@ tr_setup:
usbd_xfer_set_stall(xfer);
goto tr_setup;
}
- break;
+ return;
}
}
diff --git a/sys/dev/usb/serial/ulpt.c b/sys/dev/usb/serial/ulpt.c
index 56f99519d4cd..c566da924374 100644
--- a/sys/dev/usb/serial/ulpt.c
+++ b/sys/dev/usb/serial/ulpt.c
@@ -218,9 +218,6 @@ ulpt_write_callback(struct usb_xfer *xfer, usb_error_t error)
case USB_ST_TRANSFERRED:
case USB_ST_SETUP:
tr_setup:
- if (usbd_xfer_get_and_clr_zlp(xfer))
- break;
-
pc = usbd_xfer_get_frame(xfer, 0);
max = usbd_xfer_max_len(xfer);
if (usb_fifo_get_data(f, pc, 0, max, &actlen, 0)) {
@@ -439,6 +436,10 @@ unlpt_open(struct usb_fifo *fifo, int fflags)
return (EBUSY);
}
if (fflags & FREAD) {
+ /* clear stall first */
+ mtx_lock(&sc->sc_mtx);
+ usbd_xfer_set_stall(sc->sc_xfer[ULPT_BULK_DT_RD]);
+ mtx_unlock(&sc->sc_mtx);
if (usb_fifo_alloc_buffer(fifo,
usbd_xfer_max_len(sc->sc_xfer[ULPT_BULK_DT_RD]),
ULPT_IFQ_MAXLEN)) {
@@ -450,7 +451,7 @@ unlpt_open(struct usb_fifo *fifo, int fflags)
if (fflags & FWRITE) {
/* clear stall first */
mtx_lock(&sc->sc_mtx);
- usbd_xfer_set_zlp(sc->sc_xfer[ULPT_BULK_DT_WR]);
+ usbd_xfer_set_stall(sc->sc_xfer[ULPT_BULK_DT_WR]);
mtx_unlock(&sc->sc_mtx);
if (usb_fifo_alloc_buffer(fifo,
usbd_xfer_max_len(sc->sc_xfer[ULPT_BULK_DT_WR]),
diff --git a/sys/dev/usb/serial/umcs.c b/sys/dev/usb/serial/umcs.c
index 76ecd1ffa452..e3c8f1a764fb 100644
--- a/sys/dev/usb/serial/umcs.c
+++ b/sys/dev/usb/serial/umcs.c
@@ -382,7 +382,8 @@ umcs7840_attach(device_t dev)
/* clear stall at first run */
mtx_lock(&sc->sc_mtx);
for (subunit = 0; subunit < sc->sc_numports; ++subunit) {
- usbd_xfer_set_zlp(sc->sc_ports[sc->sc_ucom[subunit].sc_portno].sc_xfer[UMCS7840_BULK_WR_EP]);
+ usbd_xfer_set_stall(sc->sc_ports[sc->sc_ucom[subunit].sc_portno].sc_xfer[UMCS7840_BULK_RD_EP]);
+ usbd_xfer_set_stall(sc->sc_ports[sc->sc_ucom[subunit].sc_portno].sc_xfer[UMCS7840_BULK_WR_EP]);
}
mtx_unlock(&sc->sc_mtx);
@@ -915,16 +916,13 @@ umcs7840_write_callbackN(struct usb_xfer *xfer, usb_error_t error, uint8_t subun
case USB_ST_SETUP:
case USB_ST_TRANSFERRED:
tr_setup:
- if (usbd_xfer_get_and_clr_zlp(xfer))
- break;
-
pc = usbd_xfer_get_frame(xfer, 0);
if (ucom_get_data(ucom, pc, 0, usbd_xfer_max_len(xfer), &actlen)) {
DPRINTF("Port %d write, has %d bytes\n", ucom->sc_portno, actlen);
usbd_xfer_set_frame_len(xfer, 0, actlen);
usbd_transfer_submit(xfer);
}
- break;
+ return;
default: /* Error */
if (error != USB_ERR_CANCELLED) {
@@ -932,7 +930,7 @@ tr_setup:
usbd_xfer_set_stall(xfer);
goto tr_setup;
}
- break;
+ return;
}
}
diff --git a/sys/dev/usb/serial/umodem.c b/sys/dev/usb/serial/umodem.c
index b8b7ae2f005c..573d74cdb526 100644
--- a/sys/dev/usb/serial/umodem.c
+++ b/sys/dev/usb/serial/umodem.c
@@ -447,10 +447,13 @@ umodem_attach(device_t dev)
goto detach;
}
- /* send a ZLP at first run */
- mtx_lock(&sc->sc_mtx);
- usbd_xfer_set_zlp(sc->sc_xfer[UMODEM_BULK_WR]);
- mtx_unlock(&sc->sc_mtx);
+ /* clear stall at first run, if USB host mode */
+ if (uaa->usb_mode == USB_MODE_HOST) {
+ mtx_lock(&sc->sc_mtx);
+ usbd_xfer_set_stall(sc->sc_xfer[UMODEM_BULK_WR]);
+ usbd_xfer_set_stall(sc->sc_xfer[UMODEM_BULK_RD]);
+ mtx_unlock(&sc->sc_mtx);
+ }
ucom_set_usb_mode(&sc->sc_super_ucom, uaa->usb_mode);
@@ -860,16 +863,13 @@ umodem_write_callback(struct usb_xfer *xfer, usb_error_t error)
case USB_ST_SETUP:
case USB_ST_TRANSFERRED:
tr_setup:
- if (usbd_xfer_get_and_clr_zlp(xfer))
- break;
-
pc = usbd_xfer_get_frame(xfer, 0);
if (ucom_get_data(&sc->sc_ucom, pc, 0,
UMODEM_BUF_SIZE, &actlen)) {
usbd_xfer_set_frame_len(xfer, 0, actlen);
usbd_transfer_submit(xfer);
}
- break;
+ return;
default: /* Error */
if (error != USB_ERR_CANCELLED) {
@@ -877,7 +877,7 @@ tr_setup:
usbd_xfer_set_stall(xfer);
goto tr_setup;
}
- break;
+ return;
}
}
diff --git a/sys/dev/usb/serial/umoscom.c b/sys/dev/usb/serial/umoscom.c
index 536772a7f697..724ab7f94092 100644
--- a/sys/dev/usb/serial/umoscom.c
+++ b/sys/dev/usb/serial/umoscom.c
@@ -333,7 +333,8 @@ umoscom_attach(device_t dev)
}
/* clear stall at first run */
mtx_lock(&sc->sc_mtx);
- usbd_xfer_set_zlp(sc->sc_xfer[UMOSCOM_BULK_DT_WR]);
+ usbd_xfer_set_stall(sc->sc_xfer[UMOSCOM_BULK_DT_WR]);
+ usbd_xfer_set_stall(sc->sc_xfer[UMOSCOM_BULK_DT_RD]);
mtx_unlock(&sc->sc_mtx);
error = ucom_attach(&sc->sc_super_ucom, &sc->sc_ucom, 1, sc,
@@ -638,16 +639,13 @@ umoscom_write_callback(struct usb_xfer *xfer, usb_error_t error)
tr_setup:
DPRINTF("\n");
- if (usbd_xfer_get_and_clr_zlp(xfer))
- break;
-
pc = usbd_xfer_get_frame(xfer, 0);
if (ucom_get_data(&sc->sc_ucom, pc, 0,
UMOSCOM_BUFSIZE, &actlen)) {
usbd_xfer_set_frame_len(xfer, 0, actlen);
usbd_transfer_submit(xfer);
}
- break;
+ return;
default: /* Error */
if (error != USB_ERR_CANCELLED) {
@@ -656,7 +654,7 @@ tr_setup:
usbd_xfer_set_stall(xfer);
goto tr_setup;
}
- break;
+ return;
}
}
diff --git a/sys/dev/usb/serial/uplcom.c b/sys/dev/usb/serial/uplcom.c
index 6808ddd64a4b..9efac9ff6b7c 100644
--- a/sys/dev/usb/serial/uplcom.c
+++ b/sys/dev/usb/serial/uplcom.c
@@ -507,12 +507,14 @@ uplcom_attach(device_t dev)
goto detach;
}
- mtx_lock(&sc->sc_mtx);
- usbd_xfer_set_zlp(sc->sc_xfer[UPLCOM_BULK_DT_WR]);
- mtx_unlock(&sc->sc_mtx);
-
- if (sc->sc_chiptype == TYPE_PL2303HX ||
- sc->sc_chiptype == TYPE_PL2303HXD) {
+ if (sc->sc_chiptype == TYPE_PL2303) {
+ /* HX variants seem to lock up after a clear stall request. */
+ mtx_lock(&sc->sc_mtx);
+ usbd_xfer_set_stall(sc->sc_xfer[UPLCOM_BULK_DT_WR]);
+ usbd_xfer_set_stall(sc->sc_xfer[UPLCOM_BULK_DT_RD]);
+ mtx_unlock(&sc->sc_mtx);
+ } else if (sc->sc_chiptype == TYPE_PL2303HX ||
+ sc->sc_chiptype == TYPE_PL2303HXD) {
/* reset upstream data pipes */
if (uplcom_pl2303_do(sc->sc_udev, UT_WRITE_VENDOR_DEVICE,
UPLCOM_SET_REQUEST, 8, 0, 0) ||
@@ -1092,9 +1094,6 @@ uplcom_write_callback(struct usb_xfer *xfer, usb_error_t error)
case USB_ST_SETUP:
case USB_ST_TRANSFERRED:
tr_setup:
- if (usbd_xfer_get_and_clr_zlp(xfer))
- break;
-
pc = usbd_xfer_get_frame(xfer, 0);
if (ucom_get_data(&sc->sc_ucom, pc, 0,
UPLCOM_BULK_BUF_SIZE, &actlen)) {
@@ -1103,7 +1102,7 @@ tr_setup:
usbd_xfer_set_frame_len(xfer, 0, actlen);
usbd_transfer_submit(xfer);
}
- break;
+ return;
default: /* Error */
if (error != USB_ERR_CANCELLED) {
@@ -1111,7 +1110,7 @@ tr_setup:
usbd_xfer_set_stall(xfer);
goto tr_setup;
}
- break;
+ return;
}
}
diff --git a/sys/dev/usb/serial/uslcom.c b/sys/dev/usb/serial/uslcom.c
index 8c40a2c2fc3a..fec18d2a5631 100644
--- a/sys/dev/usb/serial/uslcom.c
+++ b/sys/dev/usb/serial/uslcom.c
@@ -443,7 +443,8 @@ uslcom_attach(device_t dev)
}
/* clear stall at first run */
mtx_lock(&sc->sc_mtx);
- usbd_xfer_set_zlp(sc->sc_xfer[USLCOM_BULK_DT_WR]);
+ usbd_xfer_set_stall(sc->sc_xfer[USLCOM_BULK_DT_WR]);
+ usbd_xfer_set_stall(sc->sc_xfer[USLCOM_BULK_DT_RD]);
mtx_unlock(&sc->sc_mtx);
sc->sc_partnum = uslcom_get_partnum(sc);
@@ -818,9 +819,6 @@ uslcom_write_callback(struct usb_xfer *xfer, usb_error_t error)
case USB_ST_SETUP:
case USB_ST_TRANSFERRED:
tr_setup:
- if (usbd_xfer_get_and_clr_zlp(xfer))
- break;
-
pc = usbd_xfer_get_frame(xfer, 0);
if (ucom_get_data(&sc->sc_ucom, pc, 0,
USLCOM_BULK_BUF_SIZE, &actlen)) {
@@ -829,7 +827,7 @@ tr_setup:
usbd_xfer_set_frame_len(xfer, 0, actlen);
usbd_transfer_submit(xfer);
}
- break;
+ return;
default: /* Error */
if (error != USB_ERR_CANCELLED) {
@@ -837,7 +835,7 @@ tr_setup:
usbd_xfer_set_stall(xfer);
goto tr_setup;
}
- break;
+ return;
}
}
diff --git a/sys/dev/usb/serial/uvscom.c b/sys/dev/usb/serial/uvscom.c
index 81fd5334a243..8bb69e4402cf 100644
--- a/sys/dev/usb/serial/uvscom.c
+++ b/sys/dev/usb/serial/uvscom.c
@@ -318,7 +318,8 @@ uvscom_attach(device_t dev)
/* clear stall at first run */
mtx_lock(&sc->sc_mtx);
- usbd_xfer_set_zlp(sc->sc_xfer[UVSCOM_BULK_DT_WR]);
+ usbd_xfer_set_stall(sc->sc_xfer[UVSCOM_BULK_DT_WR]);
+ usbd_xfer_set_stall(sc->sc_xfer[UVSCOM_BULK_DT_RD]);
mtx_unlock(&sc->sc_mtx);
error = ucom_attach(&sc->sc_super_ucom, &sc->sc_ucom, 1, sc,
@@ -390,16 +391,13 @@ uvscom_write_callback(struct usb_xfer *xfer, usb_error_t error)
case USB_ST_SETUP:
case USB_ST_TRANSFERRED:
tr_setup:
- if (usbd_xfer_get_and_clr_zlp(xfer))
- break;
-
pc = usbd_xfer_get_frame(xfer, 0);
if (ucom_get_data(&sc->sc_ucom, pc, 0,
UVSCOM_BULK_BUF_SIZE, &actlen)) {
usbd_xfer_set_frame_len(xfer, 0, actlen);
usbd_transfer_submit(xfer);
}
- break;
+ return;
default: /* Error */
if (error != USB_ERR_CANCELLED) {
@@ -407,7 +405,7 @@ tr_setup:
usbd_xfer_set_stall(xfer);
goto tr_setup;
}
- break;
+ return;
}
}
More information about the dev-commits-src-main
mailing list