usb descriptor bogus?

Rene Ladan r.c.ladan at gmail.com
Sun Oct 8 21:24:55 UTC 2006


Hi,

I came up with an output descriptor for the Xbox 360 controller, but the
output from usbhidctl(1) is not completely as expected.  The attached
file rdesc.txt contains the actual results, with lines starting with #
containing the expected results.

The output was generated using usbhidctl(1) and libusbhid from OpenBSD
with -rv as argument.

I also attached the descriptor itself (in .h and .hid format), the .hid
file was validated using Descriptor Tool 2.4.  This is a small windows
program obtainable from http://www.usb.org/developers/hidpage/dt2_4.zip

Any ideas what is wrong with the descriptor (or maybe libusbhid) ?

Regards,
Rene
-- 
GPG fingerprint = E738 5471 D185 7013 0EE0  4FC8 3C1D 6F83 12E1 84F6
(subkeys.pgp.net)

"It won't fit on the line."
		-- me, 2001

-------------- next part --------------
A non-text attachment was scrubbed...
Name: xbox360gp.hid
Type: application/octet-stream
Size: 1384 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-usb/attachments/20061008/7855d9c0/xbox360gp.obj
-------------- next part --------------
/*-
 * Copyright (c) 2005 Ed Schouten <ed at fxq.nl>, Rene Ladan <r.c.ladan at gmail.com>
 * 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.2 2005/12/31 04:38:50 mux Exp $
 */

/* FIXME? output descriptors for led/rumblers, see xbox 1 gamepad descriptor for example */
static const uByte uhid_xb360gp_report_descr[] = {
    0x05, 0x01,		/* USAGE PAGE (Generic Desktop)		*/
    0x09, 0x05,		/* USAGE (Gamepad)			*/
    0xa1, 0x01,		/* COLLECTION (Application)		*/
    /* Input section */
    /* Unused */
    0x75, 0x08,		/*  REPORT SIZE (8)			*/
    0x95, 0x01,		/*  REPORT COUNT (1)			*/
    /* next 2 lines found by DT 2.4 */
    0x15, 0x00,		/*  LOGICAL MINIMUM (0)			*/
    0x25, 0x14,		/*  LOGIXAL MAXIMUM (20)		*/
    0x81, 0x01,		/*  INPUT (Constant)			*/
    /* Byte count */
    0x75, 0x08,		/*  REPORT SIZE (8)			*/
    0x95, 0x01,		/*  REPORT COUNT (1)			*/
    0x05, 0x01,		/*  USAGE PAGE (Generic Desktop)	*/
    0x09, 0x3b,		/*  USAGE (Byte Count)			*/
    0x81, 0x01,		/*  INPUT (Constant)			*/
    /* D-Pad */
    0x05, 0x01,		/*  USAGE PAGE (Generic Desktop)	*/
    0x09, 0x01,		/*  USAGE (Pointer)			*/
    0xa1, 0x00,		/*  COLLECTION (Physical)		*/
    0x75, 0x01,		/*   REPORT SIZE (1)			*/
    0x15, 0x00,		/*   LOGICAL MINIMUM (0)		*/
    0x25, 0x01,		/*   LOGICAL MAXIMUM (1)		*/
    0x35, 0x00,		/*   PHYSICAL MINIMUM (0)		*/
    0x45, 0x01,		/*   PHYSICAL MAXIMUM (1)		*/
    0x95, 0x04,		/*   REPORT COUNT (4)			*/
    0x05, 0x01,		/*   USAGE PAGE (Generic Desktop)	*/
    0x09, 0x90,		/*   USAGE (D-Pad Up)			*/
    0x09, 0x91,		/*   USAGE (D-Pad Down)			*/
    0x09, 0x93,		/*   USAGE (D-Pad Left)			*/
    0x09, 0x92,		/*   USAGE (D-Pad Right)		*/
    0x81, 0x02,		/*   INPUT (Data, Variable, Absolute)	*/
    0xc0,		/*  END COLLECTION			*/
    /* Buttons 5-11 */
    0x75, 0x01,		/*  REPORT SIZE (1)			*/
    0x15, 0x00,		/*  LOGICAL MINIMUM (0)			*/
    0x25, 0x01,		/*  LOGICAL MAXIMUM (1)			*/
    0x35, 0x00,		/*  PHYSICAL MINIMUM (0)		*/
    0x45, 0x01,		/*  PHYSICAL MAXIMUM (1)		*/
    0x95, 0x07,		/*  REPORT COUNT (7)			*/
    0x05, 0x09,		/*  USAGE PAGE (Button)			*/
    0x09, 0x08,		/*  USAGE (Button 8)			*/
    0x09, 0x07,		/*  USAGE (Button 7)			*/
    0x09, 0x09,		/*  USAGE (Button 9)			*/
    0x09, 0x0a,		/*  USAGE (Button 10)			*/
    0x09, 0x05,		/*  USAGE (Button 5)			*/
    0x09, 0x06,		/*  USAGE (Button 6)			*/
    0x09, 0x0b,		/*  USAGE (Button 11)			*/
    0x81, 0x02,		/*  INPUT (Data, Variable, Absolute)	*/
    /* Unused */
    0x75, 0x01,		/*  REPORT SIZE (1)			*/
    0x95, 0x01,		/*  REPORT COUNT (1)			*/
    0x81, 0x01,		/*  INPUT (Constant)			*/
    /* Buttons 1-4 */
    0x75, 0x01,		/*  REPORT SIZE (1)			*/
    0x15, 0x00,		/*  LOGICAL MINIMUM (0)			*/
    0x25, 0x01,		/*  LOGICAL MAXIMUM (1)			*/
    0x35, 0x00,		/*  PHYSICAL MINIMUM (0)		*/
    0x45, 0x01,		/*  PHYSICAL MAXIMUM (1)		*/
    0x95, 0x04,		/*  REPORT COUNT (4)			*/
    0x05, 0x09,		/*  USAGE PAGE (Button)			*/
    0x19, 0x01,		/*  USAGE MINIMUM (Button 1)		*/
    0x29, 0x04,		/*  USAGE MAXIMUM (Button 4)		*/
    0x81, 0x02,		/*  INPUT (Data, Variable, Absolute)	*/
    /* Triggers */
    0x75, 0x08,		/*  REPORT SIZE (8)			*/
    0x15, 0x00,		/*  LOGICAL MINIMUM (0)			*/
    0x25, 0xff,		/*  LOGICAL MAXIMUM (255)		*/
    0x35, 0x00,		/*  PHYSICAL MINIMUM (0)		*/
    0x45, 0xff,		/*  PHYSICAL MAXIMUM (255)		*/
    0x95, 0x02,		/*  REPORT COUNT (2)			*/
    0x05, 0x01,		/*  USAGE PAGE (Generic Desktop)	*/
    0x09, 0x32,		/*  USAGE (Z)				*/
    0x09, 0x35,		/*  USAGE (Rz)				*/
    0x81, 0x02,		/*  INPUT (Data, Variable, Absolute)	*/
    /* Sticks */
    0x75, 0x10,		/*  REPORT SIZE (16)			*/
    0x16, 0x00, 0x80,	/*  LOGICAL MINIMUM (-32768)		*/
    0x26, 0xff, 0x7f,	/*  LOGICAL MAXIMUM (32767)		*/
    0x36, 0x00, 0x80,	/*  PHYSICAL MINIMUM (-32768)		*/
    0x46, 0xff, 0x7f,	/*  PHYSICAL MAXIMUM (32767)		*/
    0x95, 0x04,		/*  REPORT COUNT (4)			*/
    0x05, 0x01,		/*  USAGE PAGE (Generic Desktop)	*/
    0x09, 0x30,		/*  USAGE (X)				*/
    0x09, 0x31,		/*  USAGE (Y)				*/
    0x09, 0x33,		/*  USAGE (Rx)				*/
    0x09, 0x34,		/*  USAGE (Ry)				*/
    0x81, 0x02,		/*  INPUT (Data, Variable, Absolute)	*/
    /* Unused */
    0x75, 0x30,		/*  REPORT SIZE (48)			*/
    0x95, 0x01,		/*  REPORT COUNT (1)			*/
    0x81, 0x01,		/*  INPUT (Constant)			*/
    /* End Input section */
    0xc0,		/* END COLLECTION			*/
    /* Output section (rumblers) */
    0x05, 0x01,		/* USAGE PAGE (Generic Desktop)	*/
    0x09, 0x05,		/* USAGE (Gamepad)			*/
    0xa1, 0x01,		/* COLLECTION (Application)		*/
    /* Unused */
    0x75, 0x08,		/*  REPORT SIZE (8)			*/
    0x95, 0x01,		/*  REPORT COUNT (1)			*/
    0x91, 0x01,		/*  OUTPUT (Constant)			*/
    /* Byte count */
    0x75, 0x08,		/*  REPORT SIZE (8)			*/
    0x95, 0x01,		/*  REPORT COUNT (1)			*/
    0x05, 0x01,		/*  USAGE PAGE (Generic Desktop)	*/
    0x09, 0x3b,		/*  USAGE (Byte Count)			*/
    /* next 2 lines found by DT 2.4 */
    0x15, 0x00,		/*  LOGICAL MINIMUM (0)			*/
    0x25, 0x08,		/*  LOGICAL MAXIMUM (8)			*/
    0x91, 0x01,		/*  OUTPUT (Constant)			*/
    /* Unused */
    0x75, 0x08,		/*  REPORT SIZE (8)			*/
    0x95, 0x01,		/*  REPORT COUNT (1)			*/
    0x91, 0x01,		/*  OUTPUT (Constant)			*/
    /* Big, little rumbler */
    0x75, 0x08,		/*  REPORT SIZE (8)			*/
    0x15, 0x00,		/*  LOGICAL MINIMUM (0)			*/
    0x25, 0xff,		/*  LOGICAL MAXIMUM (255)		*/
    0x35, 0x00,		/*  PHYSICAL MIMINUM (0)		*/
    0x45, 0xff,		/*  PHYSICAL MAXIMUM (255)		*/
    0x95, 0x02,		/*  REPORT COUNT (2)			*/
    0x06, 0x00, 0xff,	/*  USAGE PAGE (Microsoft)		*/
    0x09, 0x01,		/*  USAGE (big rumbler)			*/
    0x09, 0x02,		/*  USAGE (little rumbler)		*/
    0x91, 0x02,		/*  OUTPUT (Data, Variable, Absolute)	*/
    /* Unused */
    0x75, 0x18,		/*  REPORT SIZE (24)			*/
    0x95, 0x01,		/*  REPORT COUNT (1)			*/
    0x91, 0x01,		/*  OUTPUT (Constant)			*/
    /* End Output section (rumblers) */
    0xc0,		/* END COLLECTION			*/
    /* Output section (LEDs) */
    0x05, 0x01,		/* USAGE PAGE (Generic Desktop)	*/
    0x09, 0x05,		/* USAGE (Gamepad)			*/
    0xa1, 0x01,		/* COLLECTION (Application)		*/
    /* Unused */
    0x75, 0x08,		/*  REPORT SIZE (8)			*/
    0x95, 0x01,		/*  REPORT COUNT (1)			*/
    0x91, 0x01,		/*  OUTPUT (Constant)			*/
    /* Byte count */
    0x75, 0x08,		/*  REPORT SIZE (8)			*/
    0x95, 0x01,		/*  REPORT COUNT (1)			*/
    0x05, 0x01,		/*  USAGE PAGE (Generic Desktop)	*/
    0x09, 0x3b,		/*  USAGE (Byte Count)			*/
    0x91, 0x01,		/*  OUTPUT (Constant)			*/
    /* LEDs */
    0x75, 0x08,		/*  REPORT SIZE (8)			*/
    0x15, 0x00,		/*  LOGICAL MINIMUM (0)			*/
    0x25, 0xff,		/*  LOGICAL MAXIMUM (255)		*/
    0x35, 0x00,		/*  PHYSICAL MIMINUM (0)		*/
    0x45, 0xff,		/*  PHYSICAL MAXIMUM (255)		*/
    0x95, 0x01,		/*  REPORT COUNT (1)			*/
    0x05, 0x08,		/*  USAGE PAGE (LED)			*/
    0x09, 0x4b,		/*  USAGE (Generic Indicator)		*/
                        /* maybe 0x42 (flash on time)? that is	*/
			/* a dynamic value instead of an on/off	*/
			/* control				*/
    0x91, 0x02,		/*  OUTPUT (Data, Variable, Absolute)	*/
    /* End Output section (LEDs) */
    /* End of Descriptor */
    0xc0,		/* END COLLECTION			*/
};
-------------- next part --------------
Report descriptor:
Input   size=8 count=1 Const page=0x0000 usage=0x0000, logical range 0..20
Input   size=8 count=1 Const page=Generic_Desktop usage=Byte_Count, logical range 0..20
Collection page=Generic_Desktop usage=Game_Pad
Collection page=Generic_Desktop usage=Pointer
Input   size=1 count=1 page=Generic_Desktop usage=D-pad_Up, logical range 0..1, physical range 0..1
Input   size=1 count=1 page=Generic_Desktop usage=D-pad_Down, logical range 0..1, physical range 0..1
Input   size=1 count=1 page=Generic_Desktop usage=D-pad_Left, logical range 0..1, physical range 0..1
Input   size=1 count=1 page=Generic_Desktop usage=D-pad_Right, logical range 0..1, physical range 0..1
End collection
Input   size=1 count=1 page=Button usage=Button_8, logical range 0..1, physical range 0..1
Input   size=1 count=1 page=Button usage=Button_7, logical range 0..1, physical range 0..1
Input   size=1 count=1 page=Button usage=Button_9, logical range 0..1, physical range 0..1
Input   size=1 count=1 page=Button usage=Button_10, logical range 0..1, physical range 0..1
Input   size=1 count=1 page=Button usage=Button_5, logical range 0..1, physical range 0..1
Input   size=1 count=1 page=Button usage=Button_6, logical range 0..1, physical range 0..1
Input   size=1 count=1 page=Button usage=Button_11, logical range 0..1, physical range 0..1
Input   size=1 count=1 Const page=0x0000 usage=0x0000, logical range 0..1, physical range 0..1
Input   size=1 count=1 page=Button usage=Button_1, logical range 0..1, physical range 0..1
Input   size=1 count=1 page=Button usage=Button_2, logical range 0..1, physical range 0..1
Input   size=1 count=1 page=Button usage=Button_3, logical range 0..1, physical range 0..1
Input   size=1 count=1 page=Button usage=Button_4, logical range 0..1, physical range 0..1
Input   size=8 count=1 page=Generic_Desktop usage=Z, logical range 0..255, physical range 0..255
Input   size=8 count=1 page=Generic_Desktop usage=Rz, logical range 0..255, physical range 0..255
# (rene) sign error in physical range?
Input   size=16 count=1 page=Generic_Desktop usage=X, logical range -32768..32767, physical range 32768..32767
Input   size=16 count=1 page=Generic_Desktop usage=Y, logical range -32768..32767, physical range 32768..32767
Input   size=16 count=1 page=Generic_Desktop usage=Rx, logical range -32768..32767, physical range 32768..32767
Input   size=16 count=1 page=Generic_Desktop usage=Ry, logical range -32768..32767, physical range 32768..32767
Input   size=48 count=1 Const page=0x0000 usage=0x0000, logical range -32768..32767, physical range 32768..32767
End collection
Output  size=8 count=1 Const page=0x0000 usage=0x0000, logical range -32768..32767, physical range 32768..32767
Output  size=8 count=1 Const page=Generic_Desktop usage=Byte_Count, logical range 0..8, physical range 32768..32767
Output  size=8 count=1 Const page=0x0000 usage=0x0000, logical range 0..8, physical range 32768..32767
Collection page=Generic_Desktop usage=Game_Pad
# (rene) expected   page=Microsoft usage=Xbox_Controller_Rumbler_2
Output  size=8 count=1 page=Generic_Desktop usage=Byte_Count, logical range 0..255, physical range 0..255
# (rene) expected usage=Xbox_Controller_Rumbler_2
Output  size=8 count=1 page=Microsoft usage=Xbox_Controller_Rumbler_1, logical range 0..255, physical range 0..255
Output  size=24 count=1 Const page=0x0000 usage=0x0000, logical range 0..255, physical range 0..255
End collection
Output  size=8 count=1 Const page=0x0000 usage=0x0000, logical range 0..255, physical range 0..255
# (rene) expected  page=LEDs usage=Generic_Indicator
Output  size=8 count=1 Const page=Generic_Desktop usage=Byte_Count, logical range 0..255, physical range 0..255
Collection page=Generic_Desktop usage=Game_Pad
Output  size=8 count=1 page=Generic_Desktop usage=Byte_Count, logical range 0..255, physical range 0..255
End collection
Total   input size 20 bytes
Total  output size 11 bytes
Total feature size 0 bytes


More information about the freebsd-usb mailing list