Hello
I’m using a clone of Leonardo board on 32u4 chip in Arduino 1.0 IDE.
The task is to turn Leonardo HID mouse from relative coordinates to absolute coordinates, so it can act as touchscreen controller.
I found HID descriptor in /arduino 1.0/hardware/arduino/cores/arduino/HID.cpp
Originally it looks like this:
// Mouse
0x05, 0x01, // USAGE_PAGE (Generic Desktop) // 54
0x09, 0x02, // USAGE (Mouse)
0xa1, 0x01, // COLLECTION (Application)
0x09, 0x01, // USAGE (Pointer)
0xa1, 0x00, // COLLECTION (Physical)
0x85, 0x01, // REPORT_ID (1)
0x05, 0x09, // USAGE_PAGE (Button)
0x19, 0x01, // USAGE_MINIMUM (Button 1)
0x29, 0x03, // USAGE_MAXIMUM (Button 3)
0x15, 0x00, // LOGICAL_MINIMUM (0)
0x25, 0x01, // LOGICAL_MAXIMUM (1)
0x95, 0x03, // REPORT_COUNT (3)
0x75, 0x01, // REPORT_SIZE (1)
0x81, 0x02, // INPUT (Data,Var,Abs)
0x95, 0x01, // REPORT_COUNT (1)
0x75, 0x05, // REPORT_SIZE (5)
0x81, 0x03, // INPUT (Cnst,Var,Abs)
0x05, 0x01, // USAGE_PAGE (Generic Desktop)
0x09, 0x30, // USAGE (X)
0x09, 0x31, // USAGE (Y)
0x09, 0x38, // USAGE (Wheel)
0x15, 0x81, // LOGICAL_MINIMUM (-127)
0x25, 0x7F, // LOGICAL_MAXIMUM (127)
0x75, 0x08, // REPORT_SIZE (8)
0x95, 0x03, // REPORT_COUNT (3)
0x81, 0x06, // INPUT (Data,Var,Rel)
0xc0, // END_COLLECTION
0xc0, // END_COLLECTION
I change last line like this
0x81, 0x02, // INPUT (Data,Var,ABS)
And I got a HID mouse device with absolute coordinates from -127 to 127 and it works.
After that I change one line like this
0x15, 0x00, // LOGICAL_MINIMUM (0)
After this modification I got a HID mouse device with absolute coordinates from 0 to 127 and it works.
Now I try to change line that describes LOGICAL MAXUMUM for example like this
0x25, 0xff, // LOGICAL_MAXIMUM (255)
After this modification mouse.move is not working. I thing that it’s because of wrong type of data somewhere.
I tried to do several modifications of data types from singned char to byte and from u8 to byte in some places that I found, for example in HID.cpp and USBAPI.h but there was no effect. Perhaps something I do not understand. Can anybody experienced in this tell me where to fix arduino code? I want to get LOGICAL_MAXIMUM higher than 127