rwskinner
Joined: 08 Dec 2006 Posts: 125 Location: Texas
|
HID Descriptor Help... |
Posted: Fri Jan 15, 2010 1:08 pm |
|
|
Can someone help me on figuring out where I messed this up.
Trying to add endpoints to the HID Descriptor. I modified the following sections:
Code: |
const char USB_CLASS_SPECIFIC_DESC[] = {
0x06, 0x00, 0xFF, // Usage Page = Vendor Defined
0x09, 1, // Usage = IO device
0xa1, 1, // Collection = Application
0x75, 8, // Report size = 8 (bits)
0x85, 1 //Report_ID 1
0x95, 35, // Report count = Sending to PC
0x09, 1, // Usage = Vendor
0x19, 1, // Usage minimum
0x29, 32, // Usage maximum
0x15, 0, // Logical minimum (-128)
0x25, 255, // Logical maximum (127)
0x81, 2, // Input (Data, Var, Abs)
0x09, 1, // Usage = Vendor //Rport ID 1 Still - From PC to Pic
0x95, 2, // Report count = From PC
0x19, 1, // Usage minimum
0x29, 8, // Usage maximum
0x91, 2, // Output (Data, Var, Abs)
0x85, 2 // Report_ID 2
0x95, 2, // Report count = Sending to PC
0x09, 1, // Usage = Vendor
0x19, 1, // Usage minimum
0x29, 2, // Usage maximum
0x15, 0, // Logical minimum (-128)
0x25, 255, // Logical maximum (127)
0x81, 2, // Input (Data, Var, Abs)
0x09, 1, // Usage = Vendor //Rport ID 2 Still - From PC to Pic
0x95, 2, // Report count = From PC
0x19, 1, // Usage minimum
0x29, 8, // Usage maximum
0x91, 2, // Output (Data, Var, Abs)
0xc0 // End Collection
};
#DEFINE USB_TOTAL_CONFIG_LEN 55 //Was 41 //config+interface+class+endpoint+endpoint (2 endpoints)
const char USB_CONFIG_DESC[] = {
//IN ORDER TO COMPLY WITH WINDOWS HOSTS, THE ORDER OF THIS ARRAY MUST BE:
// config(s)
// interface(s)
// class(es)
// endpoint(s)
//config_descriptor for config index 1
USB_DESC_CONFIG_LEN, //length of descriptor size ==1
USB_DESC_CONFIG_TYPE, //constant CONFIGURATION (CONFIGURATION 0x02) ==2
USB_TOTAL_CONFIG_LEN,0, //size of all data returned for this config ==3,4
1, //number of interfaces this device supports ==5
0x01, //identifier for this configuration. (IF we had more than one configurations) ==6
0x00, //index of string descriptor for this configuration ==7
0xC0, //bit 6=1 if self powered, bit 5=1 if supports remote wakeup (we don't), bits 0-4 unused and bit7=1 ==8
0x32, //maximum bus power required (maximum milliamperes/2) (0x32 = 100mA)
//interface descriptor 1
USB_DESC_INTERFACE_LEN, //length of descriptor =10
USB_DESC_INTERFACE_TYPE, //constant INTERFACE (INTERFACE 0x04) =11
0x00, //number defining this interface (IF we had more than one interface) ==12
0x00, //alternate setting ==13
3, //number of endpoints ==14
0x03, //class code, 03 = HID ==15
0x00, //subclass code //boot ==16
0x00, //protocol code ==17
0x00, //index of string descriptor for interface ==18
//class descriptor 1 (HID)
USB_DESC_CLASS_LEN, //length of descriptor ==19
USB_DESC_CLASS_TYPE, //dscriptor type (0x21 == HID) ==20
0x00,0x01, //hid class release number (1.0) (try 1.10) ==21,22
0x00, //localized country code (0 = none) ==23
0x01, //number of hid class descrptors that follow (1) ==24
0x22, //report descriptor type (0x22 == HID) ==25
USB_CLASS_SPECIFIC_DESC_LOOKUP_SIZE[0][0], 0x00, //length of report descriptor ==26,27
//endpoint descriptor 1
USB_DESC_ENDPOINT_LEN, //length of descriptor ==28
USB_DESC_ENDPOINT_TYPE, //constant ENDPOINT (ENDPOINT 0x05) ==29
0x81, //endpoint number and direction (0x81 = EP1 IN) ==30
0x03, //transfer type supported (0x03 is interrupt) ==31
USB_EP1_TX_SIZE,0x00, //maximum packet size supported ==32,33
250, //polling interval, in ms. (cant be smaller than 10) ==34
//endpoint descriptor 1
USB_DESC_ENDPOINT_LEN, //length of descriptor ==35
USB_DESC_ENDPOINT_TYPE, //constant ENDPOINT (ENDPOINT 0x05) ==36
0x01, //endpoint number and direction (0x01 = EP1 OUT) ==37
0x03, //transfer type supported (0x03 is interrupt) ==38
USB_EP1_RX_SIZE,0x00, //maximum packet size supported ==39,40
10 //polling interval, in ms. (cant be smaller than 10) ==41
//endpoint descriptor 2
USB_DESC_ENDPOINT_LEN, //length of descriptor ==42
USB_DESC_ENDPOINT_TYPE, //constant ENDPOINT (ENDPOINT 0x05) ==43
0x82, //endpoint number and direction (0x82 = EP2 IN) ==44
0x03, //transfer type supported (0x03 is interrupt) ==45
USB_EP1_TX_SIZE,0x00, //maximum packet size supported ==46,47
250, //polling interval, in ms. (cant be smaller than 10) ==48
//endpoint descriptor 2
USB_DESC_ENDPOINT_LEN, //length of descriptor ==49
USB_DESC_ENDPOINT_TYPE, //constant ENDPOINT (ENDPOINT 0x05) ==50
0x02, //endpoint number and direction (0x02 = EP2 OUT) ==51
0x03, //transfer type supported (0x03 is interrupt) ==52
USB_EP1_RX_SIZE,0x00, //maximum packet size supported ==53,54
250 //polling interval, in ms. (cant be smaller than 10) ==55
};
|
|
|