composite devices in config
Posted: Wed May 04, 2011 3:26 am
Ok after some digging around I found in order to use a mass-storgae with a gamepad I need to do a composite of the two devices in my config.
Currently I use an in and out int. for my game pad ( force feed back and gamepad data). I'm trying to modify my config to support the mass-storage. My guess is my length of data returned being wrong. Before adding the other device its :
18 + 7 * USB_CFG_HAVE_INTRIN_ENDPOINT + 7 /** USB_CFG_HAVE_INTRIN_ENDPOINT3 + 7*/ + 9, 0,
I did change my number of interfaces and gave the MS a new index of 1, but I get enumeration errors. I tried many way to set the length but I'm not getting any where. Did I miss something?
Also , I just made a guess here but would both devices use the same endpoints, or do I need to have two sets? Both devices needs an in and an out.
Currently I use an in and out int. for my game pad ( force feed back and gamepad data). I'm trying to modify my config to support the mass-storage. My guess is my length of data returned being wrong. Before adding the other device its :
18 + 7 * USB_CFG_HAVE_INTRIN_ENDPOINT + 7 /** USB_CFG_HAVE_INTRIN_ENDPOINT3 + 7*/ + 9, 0,
I did change my number of interfaces and gave the MS a new index of 1, but I get enumeration errors. I tried many way to set the length but I'm not getting any where. Did I miss something?
Also , I just made a guess here but would both devices use the same endpoints, or do I need to have two sets? Both devices needs an in and an out.
Code: Select all
/**************************************************************************
//USB configuration descriptor//
**************************************************************************/
9, // sizeof(usbDescriptorConfiguration): length of descriptor in bytes
USBDESCR_CONFIG, // descriptor type
// I have tried 8+ I have tried 16+ I have tried doubling the interrupts and even tried 1 through 32 each time getting enumeration errors.
//7 * 1/* two more inturupts MS*/ +7 + 9 /* MS device */ +
//tried 1-32 no luck
//18 + (7 * 2) +
//18 + (7 * 2) + 7 +
//9 +
18 + 7 * USB_CFG_HAVE_INTRIN_ENDPOINT + 7 /** USB_CFG_HAVE_INTRIN_ENDPOINT3 + 7*/ + 9, 0, // total length of data returned (including inlined descriptors)
2, //number of interfaces in this configuration
1, // index of this configuration
0, // configuration name string index
USB_CFG_IS_SELF_POWERED,// attributes
USB_CFG_MAX_BUS_POWER/2,// max USB current in 2mA units
/**************************************************************************
about the device ( HID gamepad and mouse )
**************************************************************************/
9, // sizeof(usbDescrInterface): length of descriptor in bytes
USBDESCR_INTERFACE, //descriptor type
0, // index of this interface
0, // alternate setting for this interface
1 + USB_CFG_HAVE_INTRIN_ENDPOINT,
/* + USB_CFG_HAVE_INTRIN_ENDPOINT3, */
USB_CFG_INTERFACE_CLASS,
USB_CFG_INTERFACE_SUBCLASS,
USB_CFG_INTERFACE_PROTOCOL,
0, // string index for interface
/**************************************************************************
//about the device ( mass storage )
**************************************************************************/
0x09, // sizeof(usbDescrInterface): length of descriptor in bytes
0x04, // descriptor type
0x01, // index of this interface
0x00, // alternate setting for this interface
2, // bNumEndpoints
0x08, // bInterfaceClass: MASS STORAGE Class
0x06, // bInterfaceSubClass : SCSI transparent
0x50, // nInterfaceProtocol
4, // string index for interface
/**************************************************************************
about the report descriptor
**************************************************************************/
9, // sizeof(usbDescrHID): length of descriptor in bytes
USBDESCR_HID, // descriptor type: HID
0x10, 0x01, // BCD representation of HID version
0x00, // target country code
0x01, // number of HID Report (or other HID class) Descriptor infos to follow
0x22, // descriptor type: report
USB_CFG_HID_REPORT_DESCRIPTOR_LENGTH, 0, // total length of report descriptor
/**************************************************************************
interupts
**************************************************************************/
#if USB_CFG_HAVE_INTRIN_ENDPOINT //endpoint descriptor for endpoint 1
//in put
7, //sizeof(usbDescrEndpoint)
USBDESCR_ENDPOINT,// descriptor type = endpoint
0x81, // bulk IN endpoint number 1
0x03, // attrib: Interrupt endpoint
8, 0, // maximum packet size
0x04, // in ms
//output.
7, // sizeof(usbDescrEndpoint)
5, // descriptor type = endpoint
0x02, // out endpoint number 2
0x03, // attrib: Interrupt endpoint
8, 0, // maximum packet size
USB_CFG_INTR_POLL_INTERVAL, // in ms
#endif