Module Name: src
Committed By: aymeric
Date: Tue Oct 25 16:12:02 UTC 2011
Modified Files:
src/sys/dev/usb: uhidev.c
Log Message:
enable Sony's Six Axis and DualShock 3 USB controllers
To generate a diff of this commit:
cvs rdiff -u -r1.51 -r1.52 src/sys/dev/usb/uhidev.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/dev/usb/uhidev.c
diff -u src/sys/dev/usb/uhidev.c:1.51 src/sys/dev/usb/uhidev.c:1.52
--- src/sys/dev/usb/uhidev.c:1.51 Sat Jul 30 12:15:44 2011
+++ src/sys/dev/usb/uhidev.c Tue Oct 25 16:12:02 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: uhidev.c,v 1.51 2011/07/30 12:15:44 jmcneill Exp $ */
+/* $NetBSD: uhidev.c,v 1.52 2011/10/25 16:12:02 aymeric Exp $ */
/*
* Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uhidev.c,v 1.51 2011/07/30 12:15:44 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uhidev.c,v 1.52 2011/10/25 16:12:02 aymeric Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -269,6 +269,26 @@ uhidev_attach(device_t parent, device_t
data[0x57] = 0x00;
}
+ /*
+ * Enable the Six Axis and DualShock 3 controllers.
+ * See http://ps3.jim.sh/sixaxis/usb/
+ */
+ if (uaa->vendor == USB_VENDOR_SONY &&
+ uaa->product == USB_PRODUCT_SONY_PS3CONTROLLER) {
+ usb_device_request_t req;
+ char data[17];
+ int actlen;
+
+ req.bmRequestType = UT_READ_CLASS_INTERFACE;
+ req.bRequest = 1;
+ USETW(req.wValue, 0x3f2);
+ USETW(req.wIndex, 0);
+ USETW(req.wLength, sizeof data);
+
+ usbd_do_request_flags(sc->sc_udev, &req, data,
+ USBD_SHORT_XFER_OK, &actlen, USBD_DEFAULT_TIMEOUT);
+ }
+
sc->sc_repdesc = desc;
sc->sc_repdesc_size = size;