Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/usb enable Sony's Six Axis and DualShock 3 USB contr...



details:   https://anonhg.NetBSD.org/src/rev/01c5d27fdc11
branches:  trunk
changeset: 770616:01c5d27fdc11
user:      aymeric <aymeric%NetBSD.org@localhost>
date:      Tue Oct 25 16:12:02 2011 +0000

description:
enable Sony's Six Axis and DualShock 3 USB controllers

diffstat:

 sys/dev/usb/uhidev.c |  24 ++++++++++++++++++++++--
 1 files changed, 22 insertions(+), 2 deletions(-)

diffs (45 lines):

diff -r f2f13763131e -r 01c5d27fdc11 sys/dev/usb/uhidev.c
--- a/sys/dev/usb/uhidev.c      Tue Oct 25 16:10:19 2011 +0000
+++ b/sys/dev/usb/uhidev.c      Tue Oct 25 16:12:02 2011 +0000
@@ -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 @@
                        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;
 



Home | Main Index | Thread Index | Old Index