AnsweredAssumed Answered

How to handle different report IDs  in USB ROM Stack?

Question asked by S S on Mar 25, 2019
Latest reply on Mar 27, 2019 by jeremyzhou

Hi,

We have the following code  in the  GerReport Handler.

uint8_t ReportID = pSetup->wValue.WB.L;

                switch (pSetup->wValue.WB.H) {

                case HID_REPORT_INPUT:

                 //now think if different report ID

                  switch (ReportID)

                  {

                    case 0: //when we don't define

                      *pBuffer = input_report;

                      *plength = 8;

                      break;

                  case 1: //when we defined report ID as 1

                    *pBuffer = input_report;

                      *plength = 8;

                      break;

                  }

                                break;

 

                case HID_REPORT_OUTPUT:

                //bns 3/19 shoudl never be here !

                                return ERR_USBD_STALL;                                             // Not Supported

                break;

 

                case HID_REPORT_FEATURE:

                switch (ReportID)

                {

                case 0:  //when we don't define

                                   

                  *pBuffer = feature_report;

                  *plength = 1;

                  break;

                case 3: // when we define report ID as 1

                  *pBuffer = feature_report;

                  *plength = 64;

                  break;

                 

                }

               

                break;

                }

                return LPC_OK;

 

We can establish HID communication with the host and LPC4357 when we don't define report ID  in our report descriptor. (by default report ID 0)  . However, when we specify a report ID in our descriptor, the host is not able to get either feature or Input report. We do hit the breakpoint. At the host side, the application code store specifies report ID for the output report. Fr example, if the output length is 64, we assign 65 bytes, and in the first byte we store the report ID. At the device side, we assumed that the USB Stack is handling it.  However, when we change the report ID, the host mentions  - incompatible report ID.  What is that we need to do to handle different report IDs

Thanks

Outcomes