Author: hselasky
Date: Thu Oct 14 21:45:41 2010
New Revision: 213872
URL: http://svn.freebsd.org/changeset/base/213872

Log:
  Fix forwarding of Line Register Status changes to TTY layer.
  
  PR: usb/149675
  Approved by:    thompsa (mentor)

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

Modified: head/sys/dev/usb/serial/usb_serial.c
==============================================================================
--- head/sys/dev/usb/serial/usb_serial.c        Thu Oct 14 21:41:08 2010        
(r213871)
+++ head/sys/dev/usb/serial/usb_serial.c        Thu Oct 14 21:45:41 2010        
(r213872)
@@ -942,6 +942,7 @@ ucom_cfg_status_change(struct usb_proc_m
        uint8_t new_msr;
        uint8_t new_lsr;
        uint8_t onoff;
+       uint8_t lsr_delta;
 
        tp = sc->sc_tty;
 
@@ -965,6 +966,7 @@ ucom_cfg_status_change(struct usb_proc_m
                return;
        }
        onoff = ((sc->sc_msr ^ new_msr) & SER_DCD);
+       lsr_delta = (sc->sc_lsr ^ new_lsr);
 
        sc->sc_msr = new_msr;
        sc->sc_lsr = new_lsr;
@@ -977,6 +979,30 @@ ucom_cfg_status_change(struct usb_proc_m
 
                ttydisc_modem(tp, onoff);
        }
+
+       if ((lsr_delta & ULSR_BI) && (sc->sc_lsr & ULSR_BI)) {
+
+               DPRINTF("BREAK detected\n");
+
+               ttydisc_rint(tp, 0, TRE_BREAK);
+               ttydisc_rint_done(tp);
+       }
+
+       if ((lsr_delta & ULSR_FE) && (sc->sc_lsr & ULSR_FE)) {
+
+               DPRINTF("Frame error detected\n");
+
+               ttydisc_rint(tp, 0, TRE_FRAMING);
+               ttydisc_rint_done(tp);
+       }
+
+       if ((lsr_delta & ULSR_PE) && (sc->sc_lsr & ULSR_PE)) {
+
+               DPRINTF("Parity error detected\n");
+
+               ttydisc_rint(tp, 0, TRE_PARITY);
+               ttydisc_rint_done(tp);
+       }
 }
 
 void
_______________________________________________
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to