[Midnightbsd-cvs] src [10051] trunk/sys/dev/usb/input: sync usb input code

laffer1 at midnightbsd.org laffer1 at midnightbsd.org
Sun May 27 18:43:07 EDT 2018


Revision: 10051
          http://svnweb.midnightbsd.org/src/?rev=10051
Author:   laffer1
Date:     2018-05-27 18:43:06 -0400 (Sun, 27 May 2018)
Log Message:
-----------
sync usb input code

Modified Paths:
--------------
    trunk/sys/dev/usb/input/atp.c
    trunk/sys/dev/usb/input/uep.c
    trunk/sys/dev/usb/input/uhid.c
    trunk/sys/dev/usb/input/ukbd.c
    trunk/sys/dev/usb/input/ums.c
    trunk/sys/dev/usb/input/usb_rdesc.h
    trunk/sys/dev/usb/input/wsp.c

Modified: trunk/sys/dev/usb/input/atp.c
===================================================================
--- trunk/sys/dev/usb/input/atp.c	2018-05-27 22:42:34 UTC (rev 10050)
+++ trunk/sys/dev/usb/input/atp.c	2018-05-27 22:43:06 UTC (rev 10051)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 2014 Rohit Grover
  * All rights reserved.
@@ -57,7 +58,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: stable/9/sys/dev/usb/input/atp.c 263064 2014-03-12 07:18:39Z hselasky $");
+__FBSDID("$FreeBSD: stable/10/sys/dev/usb/input/atp.c 263063 2014-03-12 07:15:41Z hselasky $");
 
 #include <sys/stdint.h>
 #include <sys/stddef.h>

Modified: trunk/sys/dev/usb/input/uep.c
===================================================================
--- trunk/sys/dev/usb/input/uep.c	2018-05-27 22:42:34 UTC (rev 10050)
+++ trunk/sys/dev/usb/input/uep.c	2018-05-27 22:43:06 UTC (rev 10051)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright 2010, Gleb Smirnoff <glebius at FreeBSD.org>
  * All rights reserved.
@@ -23,7 +24,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $FreeBSD: stable/9/sys/dev/usb/input/uep.c 248085 2013-03-09 02:36:32Z marius $
+ * $FreeBSD: stable/10/sys/dev/usb/input/uep.c 233774 2012-04-02 10:50:42Z hselasky $
  */
 
 /*

Modified: trunk/sys/dev/usb/input/uhid.c
===================================================================
--- trunk/sys/dev/usb/input/uhid.c	2018-05-27 22:42:34 UTC (rev 10050)
+++ trunk/sys/dev/usb/input/uhid.c	2018-05-27 22:43:06 UTC (rev 10051)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*	$NetBSD: uhid.c,v 1.46 2001/11/13 06:24:55 lukem Exp $	*/
 
 /* Also already merged from NetBSD:
@@ -5,7 +6,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: stable/9/sys/dev/usb/input/uhid.c 291206 2015-11-23 13:48:28Z hselasky $");
+__FBSDID("$FreeBSD: stable/10/sys/dev/usb/input/uhid.c 291205 2015-11-23 13:47:31Z hselasky $");
 
 /*-
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -865,7 +866,8 @@
 	DEVMETHOD(device_probe, uhid_probe),
 	DEVMETHOD(device_attach, uhid_attach),
 	DEVMETHOD(device_detach, uhid_detach),
-	{0, 0}
+
+	DEVMETHOD_END
 };
 
 static driver_t uhid_driver = {

Modified: trunk/sys/dev/usb/input/ukbd.c
===================================================================
--- trunk/sys/dev/usb/input/ukbd.c	2018-05-27 22:42:34 UTC (rev 10050)
+++ trunk/sys/dev/usb/input/ukbd.c	2018-05-27 22:43:06 UTC (rev 10051)
@@ -1,5 +1,6 @@
+/* $MidnightBSD$ */
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: stable/9/sys/dev/usb/input/ukbd.c 305646 2016-09-09 06:41:16Z hselasky $");
+__FBSDID("$FreeBSD: stable/10/sys/dev/usb/input/ukbd.c 305645 2016-09-09 06:38:13Z hselasky $");
 
 
 /*-
@@ -92,8 +93,9 @@
 #ifdef USB_DEBUG
 static int ukbd_debug = 0;
 static int ukbd_no_leds = 0;
+static int ukbd_pollrate = 0;
 
-static SYSCTL_NODE(_hw_usb, OID_AUTO, ukbd, CTLFLAG_RW, 0, "USB ukbd");
+static SYSCTL_NODE(_hw_usb, OID_AUTO, ukbd, CTLFLAG_RW, 0, "USB keyboard");
 SYSCTL_INT(_hw_usb_ukbd, OID_AUTO, debug, CTLFLAG_RW | CTLFLAG_TUN,
     &ukbd_debug, 0, "Debug level");
 TUNABLE_INT("hw.usb.ukbd.debug", &ukbd_debug);
@@ -100,6 +102,9 @@
 SYSCTL_INT(_hw_usb_ukbd, OID_AUTO, no_leds, CTLFLAG_RW | CTLFLAG_TUN,
     &ukbd_no_leds, 0, "Disables setting of keyboard leds");
 TUNABLE_INT("hw.usb.ukbd.no_leds", &ukbd_no_leds);
+SYSCTL_INT(_hw_usb_ukbd, OID_AUTO, pollrate, CTLFLAG_RW | CTLFLAG_TUN,
+    &ukbd_pollrate, 0, "Force this polling rate, 1-1000Hz");
+TUNABLE_INT("hw.usb.ukbd.pollrate", &ukbd_pollrate);
 #endif
 
 #define	UKBD_EMULATE_ATSCANCODE	       1
@@ -1186,13 +1191,15 @@
 {
 	struct ukbd_softc *sc = device_get_softc(dev);
 	struct usb_attach_arg *uaa = device_get_ivars(dev);
-	int32_t unit = device_get_unit(dev);
+	int unit = device_get_unit(dev);
 	keyboard_t *kbd = &sc->sc_kbd;
 	void *hid_ptr = NULL;
 	usb_error_t err;
 	uint16_t n;
 	uint16_t hid_len;
-
+#ifdef USB_DEBUG
+	int rate;
+#endif
 	UKBD_LOCK_ASSERT();
 
 	kbd_init_struct(kbd, UKBD_DRIVER_NAME, KB_OTHER, unit, 0, 0, 0);
@@ -1310,6 +1317,20 @@
 		genkbd_diag(kbd, bootverbose);
 	}
 
+#ifdef USB_DEBUG
+	/* check for polling rate override */
+	rate = ukbd_pollrate;
+	if (rate > 0) {
+		if (rate > 1000)
+			rate = 1;
+		else
+			rate = 1000 / rate;
+
+		/* set new polling interval in ms */
+		usbd_xfer_set_interval(sc->sc_xfer[UKBD_INTR_DT_0], rate);
+		usbd_xfer_set_interval(sc->sc_xfer[UKBD_INTR_DT_1], rate);
+	}
+#endif
 	/* start the keyboard */
 	usbd_transfer_start(sc->sc_xfer[UKBD_INTR_DT_0]);
 	usbd_transfer_start(sc->sc_xfer[UKBD_INTR_DT_1]);
@@ -2189,7 +2210,8 @@
 	DEVMETHOD(device_attach, ukbd_attach),
 	DEVMETHOD(device_detach, ukbd_detach),
 	DEVMETHOD(device_resume, ukbd_resume),
-	{0, 0}
+
+	DEVMETHOD_END
 };
 
 static driver_t ukbd_driver = {

Modified: trunk/sys/dev/usb/input/ums.c
===================================================================
--- trunk/sys/dev/usb/input/ums.c	2018-05-27 22:42:34 UTC (rev 10050)
+++ trunk/sys/dev/usb/input/ums.c	2018-05-27 22:43:06 UTC (rev 10051)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -29,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: stable/9/sys/dev/usb/input/ums.c 308396 2016-11-07 08:17:23Z hselasky $");
+__FBSDID("$FreeBSD: stable/10/sys/dev/usb/input/ums.c 308395 2016-11-07 08:15:58Z hselasky $");
 
 /*
  * HID spec: http://www.usb.org/developers/devclass_docs/HID1_11.pdf
@@ -1045,7 +1046,8 @@
 	DEVMETHOD(device_probe, ums_probe),
 	DEVMETHOD(device_attach, ums_attach),
 	DEVMETHOD(device_detach, ums_detach),
-	{0, 0}
+
+	DEVMETHOD_END
 };
 
 static driver_t ums_driver = {

Modified: trunk/sys/dev/usb/input/usb_rdesc.h
===================================================================
--- trunk/sys/dev/usb/input/usb_rdesc.h	2018-05-27 22:42:34 UTC (rev 10050)
+++ trunk/sys/dev/usb/input/usb_rdesc.h	2018-05-27 22:43:06 UTC (rev 10051)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 2000 Nick Hibma <n_hibma at FreeBSD.org>
  * All rights reserved.
@@ -26,7 +27,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $FreeBSD: stable/9/sys/dev/usb/input/usb_rdesc.h 196219 2009-08-14 20:03:53Z jhb $
+ * $FreeBSD: stable/10/sys/dev/usb/input/usb_rdesc.h 196219 2009-08-14 20:03:53Z jhb $
  *
  * This file contains replacements for broken HID report descriptors.
  */

Modified: trunk/sys/dev/usb/input/wsp.c
===================================================================
--- trunk/sys/dev/usb/input/wsp.c	2018-05-27 22:42:34 UTC (rev 10050)
+++ trunk/sys/dev/usb/input/wsp.c	2018-05-27 22:43:06 UTC (rev 10051)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 2012 Huang Wen Hui
  * All rights reserved.
@@ -25,7 +26,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: stable/9/sys/dev/usb/input/wsp.c 291066 2015-11-19 10:01:50Z hselasky $");
+__FBSDID("$FreeBSD: stable/10/sys/dev/usb/input/wsp.c 331997 2018-04-04 08:45:41Z hselasky $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -922,7 +923,12 @@
 		sc->sc_status.button = 0;
 
 		if (ibt != 0) {
-			sc->sc_status.button |= MOUSE_BUTTON1DOWN;
+			if ((params->caps & HAS_INTEGRATED_BUTTON) && ntouch == 2)
+				sc->sc_status.button |= MOUSE_BUTTON3DOWN;
+			else if ((params->caps & HAS_INTEGRATED_BUTTON) && ntouch == 3)
+				sc->sc_status.button |= MOUSE_BUTTON2DOWN;
+			else 
+				sc->sc_status.button |= MOUSE_BUTTON1DOWN;
 			sc->ibtn = 1;
 		}
 		sc->intr_count++;



More information about the Midnightbsd-cvs mailing list