svn commit: r308397 - stable/8/sys/dev/usb/input

Hans Petter Selasky hselasky at FreeBSD.org
Mon Nov 7 08:18:52 UTC 2016


Author: hselasky
Date: Mon Nov  7 08:18:51 2016
New Revision: 308397
URL: https://svnweb.freebsd.org/changeset/base/308397

Log:
  MFC r308144 and r308165:
  Fixes for virtual T-axis buttons.
  
  Make sure the virtual T-axis buttons gets cleared for USB mice which has
  less than 6 buttons.
  
  Make sure the virtual T-axis buttons generate button release event(s)
  for continuous tilting.
  
  PR:	213919
  PR:	213957

Modified:
  stable/8/sys/dev/usb/input/ums.c
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/dev/   (props changed)
  stable/8/sys/dev/usb/   (props changed)

Modified: stable/8/sys/dev/usb/input/ums.c
==============================================================================
--- stable/8/sys/dev/usb/input/ums.c	Mon Nov  7 08:17:23 2016	(r308396)
+++ stable/8/sys/dev/usb/input/ums.c	Mon Nov  7 08:18:51 2016	(r308397)
@@ -258,8 +258,11 @@ ums_intr_callback(struct usb_xfer *xfer,
 		}
 
 		if ((info->sc_flags & UMS_FLAG_T_AXIS) &&
-		    (id == info->sc_iid_t))
+		    (id == info->sc_iid_t)) {
 			dt -= hid_get_data(buf, len, &info->sc_loc_t);
+			/* T-axis is translated into button presses */
+			buttons_found |= (1UL << 5) | (1UL << 6);
+		}
 
 		for (i = 0; i < info->sc_buttons; i++) {
 			uint32_t mask;
@@ -287,10 +290,13 @@ ums_intr_callback(struct usb_xfer *xfer,
 			    dx, dy, dz, dt, dw, buttons);
 
 			/* translate T-axis into button presses until further */
-			if (dt > 0)
+			if (dt > 0) {
+				ums_put_queue(sc, 0, 0, 0, 0, buttons);
 				buttons |= 1UL << 5;
-			else if (dt < 0)
+			} else if (dt < 0) {
+				ums_put_queue(sc, 0, 0, 0, 0, buttons);
 				buttons |= 1UL << 6;
+			}
 
 			sc->sc_status.button = buttons;
 			sc->sc_status.dx += dx;


More information about the svn-src-stable-8 mailing list