Hi Sabina. Thank you for your answer. But I can't agree with the next 2 statements.
1) Both set and get idle requests are configured that all the idlerate applies to all report IDs.
Yes, and this is not how it should be by USB hid specification.
2) As you may see in the description for both of these requests either the higher or lower byte is 0 which means all report IDs.
This is not correct.
The specification tells that only if the lower byte of wValue is zero, then the idle rate applies to all input
reports generated by the device. When the lower byte of wValue is nonzero, then the idle rate only applies to the Report ID specified by the value of the lower byte.
Seem like SDK code assumes that lower byte always is 0, but it's not always true.
In order to fix this, in both cases of set/get idle last argument should be changed
error = hidHandle->configStruct->classCallback(
(class_handle_t)hidHandle, kUSB_DeviceHidEventSetIdle, &hidHandle->idleRate);
with
error = hidHandle->configStruct->classCallback(
(class_handle_t)hidHandle, kUSB_DeviceHidEventSetIdle, &controlRequest->setup->wValue);
This will allow set and get idle rate for particular Report Id or to all of them as expected by USB hid spec.
I can make modifications of the SDK source code but it's not convenient and requires copy/pasting for every SDK update.
Here's the code from 2.2.0 SDK.
case USB_DEVICE_HID_REQUEST_GET_IDLE:
/* Get idle request */
error = hidHandle->configStruct->classCallback(
(class_handle_t)hidHandle, kUSB_DeviceHidEventGetIdle, &hidHandle->idleRate);
controlRequest->buffer = &hidHandle->idleRate;
break;
case USB_DEVICE_HID_REQUEST_SET_IDLE:
/* Set idle request */
{
hidHandle->idleRate = (controlRequest->setup->wValue & 0xFF00U) >> 0x08U;
error = hidHandle->configStruct->classCallback(
(class_handle_t)hidHandle, kUSB_DeviceHidEventSetIdle, &controlRequest->setup->wValue);
}
break;
I expect to see wValue in both callbacks, and from there decide how to apply it.
Here is a USB CV example of how the host may behave and set/get different idle rates for different Report Ids.
