HID descriptor | Cypress

HID descriptor

Summary: 1 Reply, Latest post by Vytautas2 on 02 Mar 2012 09:59 AM PST
Verified Answers: 0
Last post
Log in to post new comments.
Vytautas2's picture
User
36 posts

Hi,

I try to implement composite device that has two interfaces. Second interface should work as HID. See config descriptor below. The problem is that if I add HID descriptor, then during connection firmware is asked for device, config, string descriptors (visible in debug output), but everything ends up with unknown device (VID_0000, PID_0000). If I leave 1th interface class as 0x03, remove HID descriptor, but leave endpoints, then Windows detect composite and HID, but displays that HID cannot be started.

Where I should add HID descriptor (to config descriptor or separately) ? How to return HID and report descriptor ? I do not see where firmware is asked for it althoug I have debug output from callbacks CyU3PUsbRegisterSetupCallback(AppUsbSetupCB,CyFalse) and CyU3PUsbRegisterEventCallback(AppUsbEventCB).

Setup requests are processed manually and descriptors are returned manually (without using CyU3PUsbSetDesc) like in sample cyfxbulklpautoenum.
Thanks.
---
// High Speed Configuration Descriptor
const uint8_t CyFxUSBHSConfigDscr[] =
{
// Configuration Descriptor Type
0x09,                           // Descriptor Size
CY_U3P_USB_CONFIG_DESCR,        // Configuration Descriptor Type
0x40,0x00,                      // Length of this descriptor and all sub descriptors
0x02,                           // Number of interfaces
0x01,                           // Configuration number
0x00,                           // COnfiguration string index
0x80,                           // Config characteristics - Bus powered
0x64,                           // Max power consumption of device (in 2mA unit)
 
// 0th Interface Descriptor
0x09,                           // Descriptor size
CY_U3P_USB_INTRFC_DESCR,        // Interface Descriptor type
0x00,                           // Interface number
0x00,                           // Alternate setting number
0x02,                           // Number of end points
0xFF,                           // Interface class
0x00,                           // Interface sub class
0x00,                           // Interface protocol code
0x00,                           // Interface descriptor string index
 
// 0th interface EP1 interrupt IN
0x07,                           // Descriptor size
CY_U3P_USB_ENDPNT_DESCR,        // Endpoint descriptor type
CY_FX_EP1_INT,            // Endpoint address and description
CY_U3P_USB_EP_INTR,             // Interrupt endpoint type
0x00,0x04,                      // Max packet size = 1024 bytes
0x01,                           // Servicing interval for data transfers
 
// 0th interface EP2 isochronous IN
0x07,                           // Descriptor size
CY_U3P_USB_ENDPNT_DESCR,        // Endpoint Descriptor Type
CY_FX_EP2_ISO,            // Endpoint address and description
CY_U3P_USB_EP_ISO,              // Iso End point Type
    0x00,0x04,                      // Max packet size = 1024 bytes
0x01,                            // Servicing interval for data transfers
 
// 1th Interface Descriptor
0x09,                           // Descriptor size
CY_U3P_USB_INTRFC_DESCR,        // Interface Descriptor type
0x01,                           // Interface number
0x00,                           // Alternate setting number
0x02,                           // Number of end points
0x03,                           // Interface class
0x00,                           // Interface sub class
0x00,                           // Interface protocol code
0x00,                           // Interface descriptor string index
 
    // HID Descriptor
0x09, // bLength
CY_U3P_USB_HID_DESCR, // bDescriptorType
0x01, 0x00, // bcdHID
0x00, // bCountryCode
0x01, // bNumDescriptors
CY_U3P_USB_REPORT_DESCR, // bDescriptorType
0x41, 0x00, // wDescriptorLength
 
// 1th interface EP1 interrupt IN
0x07,                           // Descriptor size
CY_U3P_USB_ENDPNT_DESCR,        // Endpoint descriptor type
CY_FX_INT1EP1_INT,        // Endpoint address and description
CY_U3P_USB_EP_INTR,             // Interrupt endpoint type
    0x40,0x00,                      // Max packet size = 64 bytes
0x10,                           // Servicing interval for data transfers
 
// 1th interface EP2 interrupt OUT
0x07,                           // Descriptor size
CY_U3P_USB_ENDPNT_DESCR,        // Endpoint descriptor type
CY_FX_INT1EP2_INT,        // Endpoint address and description
CY_U3P_USB_EP_INTR,             // Interrupt endpoint type
    0x40,0x00,                      // Max packet size = 64 bytes
0x01                            // Servicing interval for data transfers
};
 
Vytautas2's picture
User
36 posts

It turned out that in the case of composite device must install Cypress driver for another non-HID device in order to start receiving HID-related setup events in firmware and then pass report descriptor and report. If installation of non-HID device driver is cancelled, then also HID device does not work.

If device is not composite, but HID alone, then firmware starts to receive HID-related events after automatical installation of Microsoff HID drivers.

 

Log in to post new comments.