View Single Post
  #4 (permalink)  
Old 30th October, 2008, 09:26 AM
Aedan Aedan is offline
Chief Systems Administrator
 
Join Date: September 2001
Location: Europe
Posts: 13,075

For example, if I use this the following example (I forget where I found it sadly), then all is sweet.

Code:
 //Six button gamepad (length 47)
   {0x05,0x01,  // Usage Page (Generic Desktop) 	
	0x09,0x05,	// Usage (Gamepad)					
    0xa1,0x01,  // 2 Collection (Application)  
	0x09, 0x01, // USAGE (Pointer)
	0xa1, 0x00, // COLLECTION (Physical)
	0x09, 0x30, // USAGE (X)
	0x09, 0x31, // USAGE (Y)
	0x15, 0x00, // LOGICAL_MINIMUM (0)
	0x26, 0xFF, // LOGICAL_MAXIMUM (255)
	0x00, 0x75, 0x08,// REPORT_SIZE (8)	
	0x95, 0x02, // REPORT_COUNT (2)
	0x81, 0x02, // INPUT (Data,Var,Abs)
	0xc0,       // END_COLLECTION
	0x05, 0x09, // USAGE_PAGE (Button)
	0x19, 0x01, // USAGE_MINIMUM (Button 1)
	0x29, 0x06, // USAGE_MAXIMUM (Button 6)
	0x15, 0x00, // LOGICAL_MINIMUM (0)
	0x25, 0x01, // LOGICAL_MAXIMUM (1)
	0x75, 0x01, // REPORT_SIZE (1)
	0x95, 0x06, // REPORT_COUNT (6)
	0x81, 0x02, // INPUT (Data,Var,Abs)
	0x95, 0x02, // REPORT_COUNT (2)
	0x81, 0x03, // INPUT (Constant,Var,Abs)
	0xc0 }     // END_COLLECTION
If I attempt to tweek it (for example, 7 buttons rather than 6) then things break. For example, adjusting the usage page for buttons like this:

Code:
	0x19, 0x01, // USAGE_MINIMUM (Button 1)
	0x29, 0x07, // USAGE_MAXIMUM (Button 7)
	0x15, 0x00, // LOGICAL_MINIMUM (0)
	0x25, 0x01, // LOGICAL_MAXIMUM (1)
	0x75, 0x01, // REPORT_SIZE (1)
	0x95, 0x07, // REPORT_COUNT (7)
results in a device that windows claims it can't enumerate properly.

Am I just a bit thick, or am I missing something fundamental?
__________________

Last edited by Áedán; 30th October, 2008 at 09:27 AM. Reason: speeling
Reply With Quote