This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Report ID with different size

Hello,

I'm trying to make a report descriptor that contains many report IDs with different size, some with 1 byte and some with 2 bytes.
At first is that possible?

I supposed that it's possible, and changed the wMaxPacketSize to 3 bytes (the max of bytes to send + one byte for the report ID) , but when I send data from the host to my stm32 I only receive the first 2 bytes the report ID and the next byte.
Am I missing something? Is there something else that I have to change in the descriptor file?

Thanks,

Parents Reply Children
  • Umm..

    I put your above descriptors (config set and report descriptor) to Keil MCB1700 USBHID example
    C:\Keil\ARM\Boards\Keil\MCB1700\USBHID

    With these extra #define's, the modified example was compiled.

    #define CUSTOMHID_SIZ_CONFIG_DESC         \ 
               USB_CONFIGUARTION_DESC_SIZE +  \ 
               USB_INTERFACE_DESC_SIZE     +  \ 
               HID_DESC_SIZE               +  \ 
               USB_ENDPOINT_DESC_SIZE      +  \ 
               USB_ENDPOINT_DESC_SIZE
    #define HID_DESCRIPTOR_TYPE             HID_HID_DESCRIPTOR_TYPE
    #define CUSTOMHID_SIZ_REPORT_DESC       sizeof(HID_ReportDescriptor)
    

    And then, the example was burnt into Olimex LPC1766-STK.
    This modified example runs on PC without any trouble.
    SimpleHIDWrite also "Writes" an output report to the interrupt OUT EP without any error, checked on a hardware bus analyzer.

    If your descriptor would have any trouble, it should lies in above #defines.

    Tsuneo

  • Thank you for your replay.
    I found that I have to allocate space for the received data in a function called
    SetEPTxCount(Endpoint,wCount)
    I'm actually using the USB-FS library provided by ST.
    If I change wCount to 3 every think works fine. I actually made a little note for any one want to modify the custom HID code provided by the library.

    //changing the report descriptor

    //To change the report descriptor use the HID tool then save your file as a header file then copy past the generated data in the report descriptor

    //you need to refresh CUSTOMHID_SIZ_REPORT_DESC which is the size of the total report descriptor (usb_desc.h)

    --> this define variable is used both in the configuration descriptor as the "wDescriptorLength " and the report descriptor as its own size

    //you need to refresh the wMaxPacket size in the corresponding endpoint descriptor

    --> this values defines the maximum packet to send or receive

    //go to usb_prop.c and change the wCount parameter in SetEPRxCount(Endpoint, wCount) (for out data) SetEPTxCount(Endpoint,wCount) (for in data)

    -->even the maximum packet is defined by the endpoint descriptor you need to allocate space for it.

    //The report ID is automatically take the first byte

    -->A report ID must not be equal to 0x00