svn commit: r268583 - head/sys/dev/usb/input

Hans Petter Selasky hselasky at FreeBSD.org
Sun Jul 13 09:35:00 UTC 2014


Author: hselasky
Date: Sun Jul 13 09:34:59 2014
New Revision: 268583
URL: http://svnweb.freebsd.org/changeset/base/268583

Log:
  Turn off blinking device leds at attach.
  
  MFC after:	3 days
  PR:		183735

Modified:
  head/sys/dev/usb/input/uhid.c

Modified: head/sys/dev/usb/input/uhid.c
==============================================================================
--- head/sys/dev/usb/input/uhid.c	Sun Jul 13 07:39:28 2014	(r268582)
+++ head/sys/dev/usb/input/uhid.c	Sun Jul 13 09:34:59 2014	(r268583)
@@ -759,9 +759,20 @@ uhid_attach(device_t dev)
 			sc->sc_flags |= UHID_FLAG_STATIC_DESC;
 		}
 	} else if ((uaa->info.bInterfaceClass == UICLASS_VENDOR) &&
-		    (uaa->info.bInterfaceSubClass == UISUBCLASS_XBOX360_CONTROLLER) &&
+	    (uaa->info.bInterfaceSubClass == UISUBCLASS_XBOX360_CONTROLLER) &&
 	    (uaa->info.bInterfaceProtocol == UIPROTO_XBOX360_GAMEPAD)) {
-
+		static const uint8_t reportbuf[3] = {1, 3, 0};
+		/*
+		 * Turn off the four LEDs on the gamepad which
+		 * are blinking by default:
+		 */
+		error = usbd_req_set_report(uaa->device, NULL,
+		    __DECONST(void *, reportbuf), sizeof(reportbuf),
+		    uaa->info.bIfaceIndex, UHID_OUTPUT_REPORT, 0);
+		if (error) {
+			DPRINTF("set output report failed, error=%s (ignored)\n",
+			    usbd_errstr(error));
+		}
 		/* the Xbox 360 gamepad has no report descriptor */
 		sc->sc_repdesc_size = sizeof(uhid_xb360gp_report_descr);
 		sc->sc_repdesc_ptr = (void *)&uhid_xb360gp_report_descr;


More information about the svn-src-head mailing list