Author: ian
Date: Tue Jul 26 23:27:28 2016
New Revision: 303347
URL: https://svnweb.freebsd.org/changeset/base/303347

Log:
  Translate modem status reg bits from ns16550 to SER_* values used by the
  tty layer.  Also, the line status reg bits are already ns16550 as expected
  by the ucom layer, so no need for translation or a local var to hold them.

Modified:
  head/sys/dev/usb/serial/umcs.c

Modified: head/sys/dev/usb/serial/umcs.c
==============================================================================
--- head/sys/dev/usb/serial/umcs.c      Tue Jul 26 22:26:49 2016        
(r303346)
+++ head/sys/dev/usb/serial/umcs.c      Tue Jul 26 23:27:28 2016        
(r303347)
@@ -743,15 +743,26 @@ umcs7840_cfg_get_status(struct ucom_soft
 {
        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);
 }
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to