YukMingLaw / ArduinoJoystickWithFFBLibrary

An Arduino Joystick Library With Force Feedback Feature
GNU Lesser General Public License v3.0
208 stars 55 forks source link

HID report ID parameter cannot be changed (from default 0x01) #59

Open francesco919 opened 5 months ago

francesco919 commented 5 months ago

Hello, when trying to use a different HID report ID (default = 0x01), no report is received at host side. this is due to an hardcoded value used during the HID report descriptor construction, ignoring the value passed by the user in the Joystick.init(uint8_t hidReportId, ...)

from joystick.cpp: // REPORT_ID (Default: 1) tempHidReportDescriptor[hidReportDescriptorSize++] = 0x85; tempHidReportDescriptor[hidReportDescriptorSize++] = 0x01;

changing this to : tempHidReportDescriptor[hidReportDescriptorSize++] = _hidReportId; fixes the issue.

to be noted that in the library from Hieronimus the issue is not present being the code as the one showed as fix. Note : Hieronimus uses 0x03 as default instead of 0x01 (joystick.h). Any reason behind the change?

define JOYSTICK_DEFAULT_REPORT_ID 0x03

BR Francesco