Re: Add Xbox 360 Controller USB support

2013-10-21 Thread Martin Pieuchot
On 20/10/13(Sun) 12:09, Jeremy Evans wrote:
 On 10/20 03:52, Martin Pieuchot wrote:
  [...]
 
 Thanks for responding.  Here's a new diff that incorporates most of your
 suggestions.  Unfortunately, using the existing quirks infrastructure
 doesn't work correctly, because the quirks API is based on device
 manufacturer and vendor, and matching on that instead of interface
 subclass and protocol appears to not work correctly.  When you plug in
 the controller with my original diff and the first diff below, you get:
 
 uhidev0 at uhub3 port 3 configuration 1 interface 0 \M-)Microsoft 
 Corporation Controller rev 2.00/1.10 addr 2
 uhidev0: iclass 255/93
 uhid0 at uhidev0: input=20, output=0, feature=0
 ugen0 at uhub3 port 3 configuration 1 \M-)Microsoft Corporation Controller 
 rev 2.00/1.10 addr 2
  
 As you can see, the controller shows up as both a uhid and a ugen.
 
 With the second diff below, when you plugin the controller, it
 attaches as follows:
 
 uhidev0 at uhub3 port 3 configuration 1 interface 0 \M-)Microsoft 
 Corporation Controller rev 2.00/1.10 addr 2
 uhidev0: iclass 255/93
 uhid0 at uhidev0: input=20, output=0, feature=0
 uhidev1 at uhub3 port 3 configuration 1 interface 1 \M-)Microsoft 
 Corporation Controller rev 2.00/1.10 addr 2
 uhidev1: iclass 255/93
 uhid1 at uhidev1: input=20, output=0, feature=0
 uhidev2 at uhub3 port 3 configuration 1 interface 2 \M-)Microsoft 
 Corporation Controller rev 2.00/1.10 addr 2
 uhidev2: iclass 255/93
 uhid2 at uhidev2: input=20, output=0, feature=0
 uhidev3 at uhub3 port 3 configuration 1 interface 3 \M-)Microsoft 
 Corporation Controller rev 2.00/1.10 addr 2
 uhidev3: no input interrupt endpoint
 
 In this case uhid0 appears to work, but uhid1 and uhid2 do not:
 
 $ usbhidctl -f 1 -a 
 usbhidctl: USB_GET_REPORT (probably not supported by device): Input/output 
 error
 
 Anyway, let me know what you think about the first diff, or if I'm doing
 something wrong with the second diff that is causing it to attach
 multiple times.

You're not doing anything wrong, it's just that your device has more
than one interface.  In your previous diff you matched only the first
interface and now you match any interface of the device.  Could you
send me the output of lsusb -v for your device?  (lsusb(1) is in the
usbutils package).

M.



Re: Add Xbox 360 Controller USB support

2013-10-20 Thread Martin Pieuchot
Hi Jeremy,

On 18/10/13(Fri) 09:11, Jeremy Evans wrote:
 This was originally submitted by Joe Gidi in November 2010, based on a
 FreeBSD commit by Ed Schouten from back in December 2005.  See
 http://marc.info/?l=openbsd-techm=128924886803756w=2 for previous
 thread.  The only comment was from tedu@, that SMALL_KERNEL should be
 added, which I've done but I'm not sure correctly.
 
 Tested on amd64 using usbhidctl and some SDL-based emulators (mednafen,
 snes9x-gtk, desmume).  The controller works fine except that the
 directional pad is not processed as a hat but as a series of buttons
 (that usbhidctl sees but SDL seems not to recognize).  Also, the bottom
 L/R triggers are axes instead of buttons.
 
 I've built a release with this, and checked that the amd64 floppy
 still fits.

Good stuff, some comments below.

 Index: uhidev.c
 ===
 RCS file: /cvs/src/sys/dev/usb/uhidev.c,v
 retrieving revision 1.46
 diff -u -p -r1.46 uhidev.c
 --- uhidev.c  20 Sep 2013 15:34:50 -  1.46
 +++ uhidev.c  17 Oct 2013 23:32:55 -
 @@ -55,8 +55,11 @@
  
  #include dev/usb/uhidev.h
  
 -/* Report descriptor for broken Wacom Graphire */
 +/* Replacement report descriptors for devices shipped with broken ones */
  #include dev/usb/ugraphire_rdesc.h
 +#ifndef SMALL_KERNEL
 +#include dev/usb/uxb360gp_rdesc.h
 +#endif /* !SMALL_KERNEL */

Can you also include the ugraphire header in the #ifndef block, since we
don't include ums(4) in the ramdisk, this will same even more space!


  #ifdef UHIDEV_DEBUG
  #define DPRINTF(x)   do { if (uhidevdebug) printf x; } while (0)
 @@ -99,8 +102,17 @@ uhidev_match(struct device *parent, void
   if (uaa-iface == NULL)
   return (UMATCH_NONE);
   id = usbd_get_interface_descriptor(uaa-iface);
 - if (id == NULL || id-bInterfaceClass != UICLASS_HID)
 - return (UMATCH_NONE);
 +if (id == NULL)
 +return (UMATCH_NONE);
 +if  (id-bInterfaceClass != UICLASS_HID) {
 +#ifndef SMALL_KERNEL
 +/* The Xbox 360 gamepad doesn't use the HID class. */
 +if (id-bInterfaceClass != UICLASS_VENDOR ||
 +id-bInterfaceSubClass != UISUBCLASS_XBOX360_CONTROLLER 
 ||
 +id-bInterfaceProtocol != UIPROTO_XBOX360_GAMEPAD)
 +#endif /* !SMALL_KERNEL */

I would prefer to add another quirk to usbd_quirks something like
UQ_FORCE_HID, rather than hardcoding the device id here.  

 +return (UMATCH_NONE);
 +}
   if (usbd_get_quirks(uaa-device)-uq_flags  UQ_BAD_HID)
   return (UMATCH_NONE);
   if (uaa-matchlvl)
 @@ -200,7 +212,16 @@ uhidev_attach(struct device *parent, str
   /* Keep descriptor */
   break;
   }
 +#ifndef SMALL_KERNEL
 + } else if (id-bInterfaceClass == UICLASS_VENDOR 
 + id-bInterfaceSubClass == UISUBCLASS_XBOX360_CONTROLLER 
 + id-bInterfaceProtocol == UIPROTO_XBOX360_GAMEPAD) {
 + /* The Xbox 360 gamepad has no report descriptor. */
 + size = sizeof uhid_xb360gp_report_descr;
 + descptr = uhid_xb360gp_report_descr;
 +#endif /* !SMALL_KERNEL */

Can you merge this chunk into the switch just before since it will also
be #ifndef, and also use the uaa argument like for wacom devices?

   }
 +
  
   if (descptr) {
   desc = malloc(size, M_USBDEV, M_NOWAIT);
 Index: usb.h
 ===
 RCS file: /cvs/src/sys/dev/usb/usb.h,v
 retrieving revision 1.44
 diff -u -p -r1.44 usb.h
 --- usb.h 17 Apr 2013 11:53:10 -  1.44
 +++ usb.h 17 Oct 2013 18:11:59 -
 @@ -491,7 +491,8 @@ typedef struct {
  #define  UIPROTO_IRDA0
  
  #define UICLASS_VENDOR   0xff
 -
 +#define  UISUBCLASS_XBOX360_CONTROLLER   0x5d
 +#define  UIPROTO_XBOX360_GAMEPAD 0x01

I am not a big fan of having vendor/device specific defines in usb.h
which should be a generic header that's also included by userland.


  #define USB_HUB_MAX_DEPTH 5
  
 Index: uxb360gp_rdesc.h
 ===
 RCS file: uxb360gp_rdesc.h
 diff -N uxb360gp_rdesc.h
 --- /dev/null 1 Jan 1970 00:00:00 -
 +++ uxb360gp_rdesc.h  17 Oct 2013 18:23:56 -
 @@ -0,0 +1,126 @@
 +/*-
 + * Copyright (c) 2005 Ed Schouten e...@freebsd.org
 + * All rights reserved.
 + *
 + * Redistribution and use in source and binary forms, with or without
 + * modification, are permitted provided that the following conditions
 + * are met:
 + * 1. Redistributions of source code must retain the above copyright
 + *notice, this list of conditions and the following disclaimer.
 + * 2. Redistributions in binary form must reproduce the above copyright
 + *notice, this list of conditions and the following disclaimer in the
 + *documentation and/or other 

Re: Add Xbox 360 Controller USB support

2013-10-20 Thread Tekk

On Fri, 18 Oct 2013 09:11:05 -0700
Jeremy Evans jer...@openbsd.org wrote:
 Tested on amd64 using usbhidctl and some SDL-based emulators
 (mednafen, snes9x-gtk, desmume).  The controller works fine except
 that the directional pad is not processed as a hat but as a series of
 buttons (that usbhidctl sees but SDL seems not to recognize).  Also,
 the bottom L/R triggers are axes instead of buttons.

L/R triggers being axes is the correct behavior, this is for games like
Forza where how hard you hold down the triggers controls how hard you
accelerate/brake.



Re: Add Xbox 360 Controller USB support

2013-10-20 Thread Jeremy Evans
On 10/20 03:52, Martin Pieuchot wrote:
 Hi Jeremy,
 
 On 18/10/13(Fri) 09:11, Jeremy Evans wrote:
  This was originally submitted by Joe Gidi in November 2010, based on a
  FreeBSD commit by Ed Schouten from back in December 2005.  See
  http://marc.info/?l=openbsd-techm=128924886803756w=2 for previous
  thread.  The only comment was from tedu@, that SMALL_KERNEL should be
  added, which I've done but I'm not sure correctly.
  
  Tested on amd64 using usbhidctl and some SDL-based emulators (mednafen,
  snes9x-gtk, desmume).  The controller works fine except that the
  directional pad is not processed as a hat but as a series of buttons
  (that usbhidctl sees but SDL seems not to recognize).  Also, the bottom
  L/R triggers are axes instead of buttons.
  
  I've built a release with this, and checked that the amd64 floppy
  still fits.
 
 Good stuff, some comments below.

Martin,

Thanks for responding.  Here's a new diff that incorporates most of your
suggestions.  Unfortunately, using the existing quirks infrastructure
doesn't work correctly, because the quirks API is based on device
manufacturer and vendor, and matching on that instead of interface
subclass and protocol appears to not work correctly.  When you plug in
the controller with my original diff and the first diff below, you get:

uhidev0 at uhub3 port 3 configuration 1 interface 0 \M-)Microsoft Corporation 
Controller rev 2.00/1.10 addr 2
uhidev0: iclass 255/93
uhid0 at uhidev0: input=20, output=0, feature=0
ugen0 at uhub3 port 3 configuration 1 \M-)Microsoft Corporation Controller 
rev 2.00/1.10 addr 2
 
As you can see, the controller shows up as both a uhid and a ugen.

With the second diff below, when you plugin the controller, it
attaches as follows:

uhidev0 at uhub3 port 3 configuration 1 interface 0 \M-)Microsoft Corporation 
Controller rev 2.00/1.10 addr 2
uhidev0: iclass 255/93
uhid0 at uhidev0: input=20, output=0, feature=0
uhidev1 at uhub3 port 3 configuration 1 interface 1 \M-)Microsoft Corporation 
Controller rev 2.00/1.10 addr 2
uhidev1: iclass 255/93
uhid1 at uhidev1: input=20, output=0, feature=0
uhidev2 at uhub3 port 3 configuration 1 interface 2 \M-)Microsoft Corporation 
Controller rev 2.00/1.10 addr 2
uhidev2: iclass 255/93
uhid2 at uhidev2: input=20, output=0, feature=0
uhidev3 at uhub3 port 3 configuration 1 interface 3 \M-)Microsoft Corporation 
Controller rev 2.00/1.10 addr 2
uhidev3: no input interrupt endpoint

In this case uhid0 appears to work, but uhid1 and uhid2 do not:

$ usbhidctl -f 1 -a 
usbhidctl: USB_GET_REPORT (probably not supported by device): Input/output error

Anyway, let me know what you think about the first diff, or if I'm doing
something wrong with the second diff that is causing it to attach
multiple times.

Thanks,
Jeremy

Working diff:

Index: uhidev.c
===
RCS file: /cvs/src/sys/dev/usb/uhidev.c,v
retrieving revision 1.46
diff -u -p -r1.46 uhidev.c
--- uhidev.c20 Sep 2013 15:34:50 -  1.46
+++ uhidev.c20 Oct 2013 18:23:37 -
@@ -55,8 +55,13 @@
 
 #include dev/usb/uhidev.h
 
-/* Report descriptor for broken Wacom Graphire */
+#ifndef SMALL_KERNEL
+/* Replacement report descriptors for devices shipped with broken ones */
 #include dev/usb/ugraphire_rdesc.h
+#include dev/usb/uxb360gp_rdesc.h
+#defineUISUBCLASS_XBOX360_CONTROLLER   0x5d
+#defineUIPROTO_XBOX360_GAMEPAD 0x01
+#endif /* !SMALL_KERNEL */
 
 #ifdef UHIDEV_DEBUG
 #define DPRINTF(x) do { if (uhidevdebug) printf x; } while (0)
@@ -99,8 +104,17 @@ uhidev_match(struct device *parent, void
if (uaa-iface == NULL)
return (UMATCH_NONE);
id = usbd_get_interface_descriptor(uaa-iface);
-   if (id == NULL || id-bInterfaceClass != UICLASS_HID)
-   return (UMATCH_NONE);
+if (id == NULL)
+return (UMATCH_NONE);
+if  (id-bInterfaceClass != UICLASS_HID) {
+#ifndef SMALL_KERNEL
+/* The Xbox 360 gamepad doesn't use the HID class. */
+if (id-bInterfaceClass != UICLASS_VENDOR ||
+id-bInterfaceSubClass != UISUBCLASS_XBOX360_CONTROLLER ||
+id-bInterfaceProtocol != UIPROTO_XBOX360_GAMEPAD)
+#endif /* !SMALL_KERNEL */
+return (UMATCH_NONE);
+}
if (usbd_get_quirks(uaa-device)-uq_flags  UQ_BAD_HID)
return (UMATCH_NONE);
if (uaa-matchlvl)
@@ -180,6 +194,7 @@ uhidev_attach(struct device *parent, str
 
/* XXX need to extend this */
descptr = NULL;
+#ifndef SMALL_KERNEL
if (uaa-vendor == USB_VENDOR_WACOM) {
static uByte reportbuf[] = {2, 2, 2};
 
@@ -200,7 +215,15 @@ uhidev_attach(struct device *parent, str
/* Keep descriptor */
break;
}
+   } else if (id-bInterfaceClass == UICLASS_VENDOR 
+   id-bInterfaceSubClass == 

Add Xbox 360 Controller USB support

2013-10-18 Thread Jeremy Evans
This was originally submitted by Joe Gidi in November 2010, based on a
FreeBSD commit by Ed Schouten from back in December 2005.  See
http://marc.info/?l=openbsd-techm=128924886803756w=2 for previous
thread.  The only comment was from tedu@, that SMALL_KERNEL should be
added, which I've done but I'm not sure correctly.

Tested on amd64 using usbhidctl and some SDL-based emulators (mednafen,
snes9x-gtk, desmume).  The controller works fine except that the
directional pad is not processed as a hat but as a series of buttons
(that usbhidctl sees but SDL seems not to recognize).  Also, the bottom
L/R triggers are axes instead of buttons.

I've built a release with this, and checked that the amd64 floppy
still fits.

OKs?

Thanks,
Jeremy

Index: uhidev.c
===
RCS file: /cvs/src/sys/dev/usb/uhidev.c,v
retrieving revision 1.46
diff -u -p -r1.46 uhidev.c
--- uhidev.c20 Sep 2013 15:34:50 -  1.46
+++ uhidev.c17 Oct 2013 23:32:55 -
@@ -55,8 +55,11 @@
 
 #include dev/usb/uhidev.h
 
-/* Report descriptor for broken Wacom Graphire */
+/* Replacement report descriptors for devices shipped with broken ones */
 #include dev/usb/ugraphire_rdesc.h
+#ifndef SMALL_KERNEL
+#include dev/usb/uxb360gp_rdesc.h
+#endif /* !SMALL_KERNEL */
 
 #ifdef UHIDEV_DEBUG
 #define DPRINTF(x) do { if (uhidevdebug) printf x; } while (0)
@@ -99,8 +102,17 @@ uhidev_match(struct device *parent, void
if (uaa-iface == NULL)
return (UMATCH_NONE);
id = usbd_get_interface_descriptor(uaa-iface);
-   if (id == NULL || id-bInterfaceClass != UICLASS_HID)
-   return (UMATCH_NONE);
+if (id == NULL)
+return (UMATCH_NONE);
+if  (id-bInterfaceClass != UICLASS_HID) {
+#ifndef SMALL_KERNEL
+/* The Xbox 360 gamepad doesn't use the HID class. */
+if (id-bInterfaceClass != UICLASS_VENDOR ||
+id-bInterfaceSubClass != UISUBCLASS_XBOX360_CONTROLLER ||
+id-bInterfaceProtocol != UIPROTO_XBOX360_GAMEPAD)
+#endif /* !SMALL_KERNEL */
+return (UMATCH_NONE);
+}
if (usbd_get_quirks(uaa-device)-uq_flags  UQ_BAD_HID)
return (UMATCH_NONE);
if (uaa-matchlvl)
@@ -200,7 +212,16 @@ uhidev_attach(struct device *parent, str
/* Keep descriptor */
break;
}
+#ifndef SMALL_KERNEL
+   } else if (id-bInterfaceClass == UICLASS_VENDOR 
+   id-bInterfaceSubClass == UISUBCLASS_XBOX360_CONTROLLER 
+   id-bInterfaceProtocol == UIPROTO_XBOX360_GAMEPAD) {
+   /* The Xbox 360 gamepad has no report descriptor. */
+   size = sizeof uhid_xb360gp_report_descr;
+   descptr = uhid_xb360gp_report_descr;
+#endif /* !SMALL_KERNEL */
}
+
 
if (descptr) {
desc = malloc(size, M_USBDEV, M_NOWAIT);
Index: usb.h
===
RCS file: /cvs/src/sys/dev/usb/usb.h,v
retrieving revision 1.44
diff -u -p -r1.44 usb.h
--- usb.h   17 Apr 2013 11:53:10 -  1.44
+++ usb.h   17 Oct 2013 18:11:59 -
@@ -491,7 +491,8 @@ typedef struct {
 #define  UIPROTO_IRDA  0
 
 #define UICLASS_VENDOR 0xff
-
+#define  UISUBCLASS_XBOX360_CONTROLLER 0x5d
+#define  UIPROTO_XBOX360_GAMEPAD   0x01
 
 #define USB_HUB_MAX_DEPTH 5
 
Index: uxb360gp_rdesc.h
===
RCS file: uxb360gp_rdesc.h
diff -N uxb360gp_rdesc.h
--- /dev/null   1 Jan 1970 00:00:00 -
+++ uxb360gp_rdesc.h17 Oct 2013 18:23:56 -
@@ -0,0 +1,126 @@
+/*-
+ * Copyright (c) 2005 Ed Schouten e...@freebsd.org
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT 

Add Xbox 360 Controller USB support

2010-11-08 Thread Joe Gidi
This is taken pretty much straight from FreeBSD ( see
http://marc.info/?l=freebsd-commits-allm=113600388101707w=2 ). It is 
tested and working on my amd64 box. Some usbhidctl output:

Generic_Desktop:Game_Pad.Generic_Desktop:Pointer.Generic_Desktop:D-pad_Up=0
Generic_Desktop:Game_Pad.Generic_Desktop:Pointer.Generic_Desktop:D-pad_Down=0
Generic_Desktop:Game_Pad.Generic_Desktop:Pointer.Generic_Desktop:D-pad_Left=0
Generic_Desktop:Game_Pad.Generic_Desktop:Pointer.Generic_Desktop:D-pad_Right=0
Generic_Desktop:Game_Pad.Button:Button_8=0
Generic_Desktop:Game_Pad.Button:Button_7=0
Generic_Desktop:Game_Pad.Button:Button_9=0
Generic_Desktop:Game_Pad.Button:Button_10=0
Generic_Desktop:Game_Pad.Button:Button_5=0
Generic_Desktop:Game_Pad.Button:Button_6=0
Generic_Desktop:Game_Pad.Button:Button_11=0
Generic_Desktop:Game_Pad.Button:Button_1=1
Generic_Desktop:Game_Pad.Button:Button_2=0
Generic_Desktop:Game_Pad.Button:Button_3=0
Generic_Desktop:Game_Pad.Button:Button_4=0
Generic_Desktop:Game_Pad.Generic_Desktop:Z=0
Generic_Desktop:Game_Pad.Generic_Desktop:Rz=0
Generic_Desktop:Game_Pad.Generic_Desktop:X=-4169
Generic_Desktop:Game_Pad.Generic_Desktop:Y=-2390
Generic_Desktop:Game_Pad.Generic_Desktop:Rx=-432
Generic_Desktop:Game_Pad.Generic_Desktop:Ry=1363

Any devs interested in reviewing and hopefully committing this?

-- 
Joe Gidi
j...@entropicblur.com

You cannot buy skill. -- Ross Seyfried
--- uhidev.c.orig   Mon Nov  8 01:57:09 2010
+++ uhidev.cMon Nov  8 01:08:30 2010
@@ -55,8 +55,9 @@
 
 #include dev/usb/uhidev.h
 
-/* Report descriptor for broken Wacom Graphire */
+/* Replacement report descriptors for devices shipped with broken ones */
 #include dev/usb/ugraphire_rdesc.h
+#include dev/usb/uxb360gp_rdesc.h
 
 #ifdef UHIDEV_DEBUG
 #define DPRINTF(x) do { if (uhidevdebug) printf x; } while (0)
@@ -99,8 +100,15 @@
if (uaa-iface == NULL)
return (UMATCH_NONE);
id = usbd_get_interface_descriptor(uaa-iface);
-   if (id == NULL || id-bInterfaceClass != UICLASS_HID)
-   return (UMATCH_NONE);
+if (id == NULL)
+return (UMATCH_NONE);
+if  (id-bInterfaceClass != UICLASS_HID) {
+/* The Xbox 360 gamepad doesn't use the HID class. */
+if (id-bInterfaceClass != UICLASS_VENDOR ||
+id-bInterfaceSubClass != UISUBCLASS_XBOX360_CONTROLLER ||
+id-bInterfaceProtocol != UIPROTO_XBOX360_GAMEPAD)
+return (UMATCH_NONE);
+}
if (usbd_get_quirks(uaa-device)-uq_flags  UQ_BAD_HID)
return (UMATCH_NONE);
if (uaa-matchlvl)
@@ -203,7 +211,14 @@
/* Keep descriptor */
break;
}
+   } else if (id-bInterfaceClass == UICLASS_VENDOR 
+   id-bInterfaceSubClass == UISUBCLASS_XBOX360_CONTROLLER 
+   id-bInterfaceProtocol == UIPROTO_XBOX360_GAMEPAD) {
+   /* The Xbox 360 gamepad has no report descriptor. */
+   size = sizeof uhid_xb360gp_report_descr;
+   descptr = uhid_xb360gp_report_descr;
}
+
 
if (descptr) {
desc = malloc(size, M_USBDEV, M_NOWAIT);
--- usb.h.orig  Mon Nov  8 01:58:09 2010
+++ usb.h   Mon Nov  8 00:42:01 2010
@@ -486,7 +486,8 @@
 #define  UIPROTO_IRDA  0
 
 #define UICLASS_VENDOR 0xff
-
+#define  UISUBCLASS_XBOX360_CONTROLLER 0x5d
+#define  UIPROTO_XBOX360_GAMEPAD   0x01
 
 #define USB_HUB_MAX_DEPTH 5
/*-
 * Copyright (c) 2005 Ed Schouten e...@freebsd.org
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the above copyright
 *notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *notice, this list of conditions and the following disclaimer in the
 *documentation and/or other materials provided with the distribution.
 *
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 * SUCH DAMAGE.
 *
 * $FreeBSD: src/sys/dev/usb/uxb360gp_rdesc.h,v 1.3 2008/05/24 18:35:55 ed Exp $
 */

/*
 * The 

Re: Add Xbox 360 Controller USB support

2010-11-08 Thread Ted Unangst
On Mon, Nov 8, 2010 at 3:38 PM, Joe Gidi j...@entropicblur.com wrote:
 This is taken pretty much straight from FreeBSD ( see
 http://marc.info/?l=freebsd-commits-allm=113600388101707w=2 ). It is
 tested and working on my amd64 box. Some usbhidctl output:

At a minimum, should probably be inside ifdef SMALL_KERNEL or
something so as to not expand ramdisks that don't need it.