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); }