Hello,
I was looking throught the HID-CDC example and I don't understand how the X\Y displacement information for the HID mouse are encoded.
For example, to move the mouse to the right the following code is used:
case CDC_RIGHT:
{
/* Mouse right */
uint8_t rep[] = {0x00, 0x20, 0x00, 0x00};
k_sem_take(&usb_sem, K_FOREVER);
hid_int_ep_write(hid0_dev, rep,
sizeof(rep), NULL);
write_data(cdc_dev[0], right, strlen(right));
clear_mouse_report();
break;
}
The value 0x20 is sent, which is equivalent to 00100000 in binary.
The seventh (most significant) bit is set to 0 to signify a positive movement on the X axis (moving to the right), and the rest of the byte is the displacement amount, in this case 32 in decimal.
However, if I upload that code to my custom board and test it out in this webseite, I see that the actual displacement is 27 pixels to the right, not 32.

I think my misunderstanding come from the fact that the displacement is unit-less, so I can't expect the number in the code to match a pixel-based movement on the screen.
In trying to making sense of this I consulted the only HID spec I could find on the USB website, which doesn't tell me anything that I didn't already know:

So my question is, how do I make sense of the numbers in the example code?
Where can I find more information about this?
Thanks