Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 27 Jul 2016 00:03:18 +0000 (UTC)
From:      Ian Lepore <ian@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r303351 - head/sys/dev/usb/serial
Message-ID:  <201607270003.u6R03I4o029996@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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));



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201607270003.u6R03I4o029996>