Hello Jan,
I note topic
http://www.lvr.com/forum/index.php?topic=723.msg2725#msg2725 which has been helpful.
Running with Win 7:
I have HID device code that works properly, and my intent is to eventually merge MSD code to create a composite device. I'm starting with adding just the IAD section to the HID descriptor. This code seems to be correct, and Windows can identify it, though still as an HID input device, but the enumeration then fails and the device is not accessible. My understanding at present is that the host identifies the device as a Composite, then loads the appropriate driver, in this case the generic HID.
Here's the descriptor.
const uint8_t CustomHID_DeviceDescriptor[CUSTOMHID_SIZ_DEVICE_DESC] =
{
0x12, /*bLength */
USB_DEVICE_DESCRIPTOR_TYPE, /*bDescriptorType*/
0x00, /*bcdUSB = 0x0200*/
0x02,
0xEF, /*bDeviceClass: 0x00 for single HID, 0xEF for composite with IAD, below */
0x02, /*bDeviceSubClass:0x00 for single HID, 0x02 for composite with IAD, below*/
0x01, /*bDeviceProtocol: 0x00 for single HID, 0x01 with IAD*/
0x40, /*bMaxPacketSize 40*/
0x83, 0x04, /*idVendor = 0x0483. Adjust this when PiXCL VID is available */
0x50, 0x57, /*idProduct = 0x5750. Adjust this when PiXCL PID is available */
0x10, 0x03, /*bcdDevice rel. 3.10 */
// these indices refer to ONE_DESCRIPTOR String_Descriptor array elements in usb_props.c
1, /*Index of string descriptor describing manufacturer */
2, /*Index of string descriptor describing product*/
3, /*Index of string descriptor describing the device serial number */
0x01 /*bNumConfigurations*/
}
; /* CustomHID_DeviceDescriptor */
/* USB Configuration Descriptor */
const uint8_t CustomHID_ConfigDescriptor[CUSTOMHID_SIZ_CONFIG_DESC] =
{
0x09, /* bLength: Configuration Descriptor size */
USB_CONFIGURATION_DESCRIPTOR_TYPE, /* bDescriptorType: Configuration */
CUSTOMHID_SIZ_CONFIG_DESC, /* wTotalLength: Bytes returned */
0x00,
0x01, /* bNumInterfaces: 1 interface for the HID only*/
0x01, /* bConfigurationValue: Configuration value */
0x00, /* iConfiguration: Index of string descriptor describing
the configuration*/
0xC0, /* bmAttributes: Bus powered */
0x32, /* MaxPower 100 mA: this current is used for detecting Vbus */
/* here is where the USB_INTERFACE_ASSOCIATION_DESCRIPTOR_TYPE is defined */
0x08, // bLength, size of this descriptor, #define required?
USB_INTERFACE_ASSOCIATION_DESCRIPTOR_TYPE, // 0x0B
0x00, // bFirstInterface usually 0x00
0x01, // bInterfaceCount. 1 at present.
0x03, // bFunctionClass, use HID, as below
0x00, // bFunctionSubClass
0x00, // bFunctionProtocol
0x00, // Function string descriptor index. 0x00 = no string descriptor
/************** Custom HID Interface Descriptor ****************/
0x09, /* bLength: Interface Descriptor size */
USB_INTERFACE_DESCRIPTOR_TYPE,/* bDescriptorType: Interface descriptor type */
0x00, /* bInterfaceNumber: Number of Interface */
0x00, /* bAlternateSetting: Alternate setting */
0x02, /* bNumEndpoints */
0x03, /* bInterfaceClass: HID */
0x00, /* bInterfaceSubClass : 1=BOOT, 0=no boot */
0x00, /* nInterfaceProtocol : 0=none, 1=keyboard, 2=mouse */
0, /* iInterface: Index of string descriptor */
/******************** Descriptor of Custom HID HID ********************/
0x09, /* bLength: HID Descriptor size */
HID_DESCRIPTOR_TYPE, /* bDescriptorType: HID */
0x10, 0x01, /* bcdHID: HID Class Spec release number 0x0110 = v1.1*/
0x00, /* bCountryCode: Hardware target country */
0x01, /* bNumDescriptors: Number of HID class descriptors to follow */
0x22, /* bDescriptorType */
CUSTOMHID_SIZ_REPORT_DESC,/* wItemLength: Total length of Report descriptor */
0x00,
. . .
What's unclear to me is whether having an IAD with just one device is valid. If I reset the device class to HID (0x03) from Generic AID (0xEF), and leave the IAD structure in place, the device is not enumerated correctly (as above).
Can you suggest what's wrong in the descriptor code?
regards
SD