summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Lepore <ian@FreeBSD.org>2016-07-26 23:27:28 +0000
committerIan Lepore <ian@FreeBSD.org>2016-07-26 23:27:28 +0000
commitab3249b59036bf614e3ac0a30c37eab57f94e243 (patch)
treeff17fe94742015434c8d838131992b93564c3554
parentb90ce50491b72d5b1cdb4fc9a81aff7cb5e4962d (diff)
Notes
-rw-r--r--sys/dev/usb/serial/umcs.c21
1 files changed, 16 insertions, 5 deletions
diff --git a/sys/dev/usb/serial/umcs.c b/sys/dev/usb/serial/umcs.c
index 6b55b5a8450b..c5ac0d6c52aa 100644
--- a/sys/dev/usb/serial/umcs.c
+++ b/sys/dev/usb/serial/umcs.c
@@ -743,15 +743,26 @@ umcs7840_cfg_get_status(struct ucom_softc *ucom, uint8_t *lsr, uint8_t *msr)
{
struct umcs7840_softc *sc = ucom->sc_parent;
uint8_t pn = ucom->sc_portno;
- uint8_t hw_lsr = 0; /* local line status register */
uint8_t hw_msr = 0; /* local modem status register */
- /* Read LSR & MSR */
- umcs7840_get_UART_reg_sync(sc, pn, MCS7840_UART_REG_LSR, &hw_lsr);
+ /*
+ * Read status registers. MSR bits need translation from ns16550 to
+ * SER_* values. LSR bits are ns16550 in hardware and ucom.
+ */
+ umcs7840_get_UART_reg_sync(sc, pn, MCS7840_UART_REG_LSR, lsr);
umcs7840_get_UART_reg_sync(sc, pn, MCS7840_UART_REG_MSR, &hw_msr);
- *lsr = hw_lsr;
- *msr = hw_msr;
+ if (hw_msr & MCS7840_UART_MSR_NEGCTS)
+ *msr |= SER_CTS;
+
+ if (hw_msr & MCS7840_UART_MSR_NEGDCD)
+ *msr |= SER_DCD;
+
+ if (hw_msr & MCS7840_UART_MSR_NEGRI)
+ *msr |= SER_RI;
+
+ if (hw_msr & MCS7840_UART_MSR_NEGDSR)
+ *msr |= SER_DSR;
DPRINTF("Port %d status: LSR=%02x MSR=%02x\n", ucom->sc_portno, *lsr, *msr);
}