svn commit: r303351 - head/sys/dev/usb/serial
Ian Lepore
ian at FreeBSD.org
Wed Jul 27 00:03:19 UTC 2016
Author: ian
Date: Wed Jul 27 00:03:18 2016
New Revision: 303351
URL: https://svnweb.freebsd.org/changeset/base/303351
Log:
Translate modem status reg bits from ns16550 to SER_* values used by the
tty layer.
Also annotate a switch case fall-through per style(9).
Modified:
head/sys/dev/usb/serial/ubsa.c
Modified: head/sys/dev/usb/serial/ubsa.c
==============================================================================
--- head/sys/dev/usb/serial/ubsa.c Tue Jul 26 23:42:42 2016 (r303350)
+++ head/sys/dev/usb/serial/ubsa.c Wed Jul 27 00:03:18 2016 (r303351)
@@ -650,11 +650,19 @@ ubsa_intr_callback(struct usb_xfer *xfer
usbd_copy_out(pc, 0, buf, sizeof(buf));
/*
- * incidentally, Belkin adapter status bits match
- * UART 16550 bits
+ * MSR bits need translation from ns16550 to SER_* values.
+ * LSR bits are ns16550 in hardware and ucom.
*/
+ sc->sc_msr = 0;
+ if (buf[3] & UBSA_MSR_CTS)
+ sc->sc_msr |= SER_CTS;
+ if (buf[3] & UBSA_MSR_DCD)
+ sc->sc_msr |= SER_DCD;
+ if (buf[3] & UBSA_MSR_RI)
+ sc->sc_msr |= SER_RI;
+ if (buf[3] & UBSA_MSR_DSR)
+ sc->sc_msr |= SER_DSR;
sc->sc_lsr = buf[2];
- sc->sc_msr = buf[3];
DPRINTF("lsr = 0x%02x, msr = 0x%02x\n",
sc->sc_lsr, sc->sc_msr);
@@ -663,7 +671,7 @@ ubsa_intr_callback(struct usb_xfer *xfer
} else {
DPRINTF("ignoring short packet, %d bytes\n", actlen);
}
-
+ /* FALLTHROUGH */
case USB_ST_SETUP:
tr_setup:
usbd_xfer_set_frame_len(xfer, 0, usbd_xfer_max_len(xfer));
More information about the svn-src-all
mailing list