⬢ DragonFlyBSD Kernel Audit
DF-5517 / fix.diff
← back to finding ↓ download raw
--- a/sys/bus/u4b/serial/ubser.c
+++ b/sys/bus/u4b/serial/ubser.c
@@ -482,6 +482,23 @@ ubser_cfg_set_break(struct ucom_softc *ucom, uint8_t onoff)
 		if (err) {
 			DPRINTFN(0, "send break failed, error=%s\n",
 			    usbd_errstr(err));
 		}
+	} else {
+		/* DF-5517: send the clear command -- without this leg
+		 * a set break can never be lifted on the device. */
+		req.bmRequestType = UT_READ_VENDOR_INTERFACE;
+		req.bRequest = VENDOR_CLEAR_BREAK;
+		req.wValue[0] = x;
+		req.wValue[1] = 0;
+		req.wIndex[0] = sc->sc_iface_no;
+		req.wIndex[1] = 0;
+		USETW(req.wLength, 0);
+
+		err = ucom_cfg_do_request(sc->sc_udev, ucom,
+		    &req, NULL, 0, 250);
+		if (err) {
+			DPRINTFN(0, "clear break failed, error=%s\n",
+			    usbd_errstr(err));
+		}
 	}
 }