PERFORCE change 166592 for review

Hans Petter Selasky hselasky at FreeBSD.org
Sun Jul 26 17:45:50 UTC 2009


http://perforce.freebsd.org/chv.cgi?CH=166592

Change 166592 by hselasky at hselasky_laptop001 on 2009/07/26 17:45:02

	
	USB input:
	 - improve last patch

Affected files ...

.. //depot/projects/usb/src/sys/dev/usb/input/ums.c#22 edit

Differences ...

==== //depot/projects/usb/src/sys/dev/usb/input/ums.c#22 (text+ko) ====

@@ -190,6 +190,7 @@
 	struct usb_page_cache *pc;
 	uint8_t *buf = sc->sc_temp;
 	int32_t buttons = 0;
+	int32_t buttons_found = 0;
 	int32_t dw = 0;
 	int32_t dx = 0;
 	int32_t dy = 0;
@@ -268,19 +269,21 @@
 			uint32_t mask;
 			mask = 1UL << UMS_BUT(i);
 			/* check for correct button ID */
-			if (id != info->sc_iid_btn[i]) {
-				/* keep old button value */
-				buttons |= sc->sc_status.button & mask;
+			if (id != info->sc_iid_btn[i])
 				continue;
-			}
 			/* check for button pressed */
 			if (hid_get_data(buf, len, &info->sc_loc_btn[i]))
 				buttons |= mask;
+			/* register button mask */
+			buttons_found |= mask;
 		}
 
 		if (++info != &sc->sc_info[UMS_INFO_MAX])
 			goto repeat;
 
+		/* keep old button value(s) for non-detected buttons */
+		buttons |= sc->sc_status.button & ~buttons_found;
+
 		if (dx || dy || dz || dt || dw ||
 		    (buttons != sc->sc_status.button)) {
 


More information about the p4-projects mailing list