Addresses Issue #2 & adds lightbar + rumble support for wireless DS4 controllers.
I had realized that while my old v1 controller worked perfectly with JoyShockLIbrary, my v2 controller and Brook XB1 adapter did not work. Some analysis into the issue revealed that the v2 was not entering 0x11 mode, necessary for Gyro support to work.
After looking further at DS4Windows and the hid_sony Linux kernel driver, I came to the following realizations:
The V2s are stricter about initialization and will not enter 0x11 mode until a Gyro Calibration GET FEATURE is requested (FEATURE GET 0x05), which is different from USB's 0x02. v1s either enter 0x11 mode immediately or will accept a 0x02 to enter.
hidapi function calls were being used improperly or for the wrong functions (hid_read/write is for HID Output Reports, hid_get/set_feature_report is used for HID Feature Reports, respectively.)
Additionally, I also fixed up lightbar and rumble support by analyzing the 0x11 and CRC32 routines for the controller.
Output Report 0x11 requires a CRC32 checksum to be sent to the controller.
The CRC32 REQUIRES the entire HID packet to be included in the checksum, but hidapi does not require the first byte as the function call (hid_read/write, hid_get/set_feature_report) sets the first byte in accordance to the function being called.
The CRC32 checksum being appended to the buffer was being copied to the buffer in the wrong order.
After making these changes and doing some testing, JSL now fully supports the DS4 as well as the non-v1 controllers over bluetooth.
Thanks so much! I'm pretty sure both my controllers are also v2, but regardless, the fact that this fixes things on your controllers that weren't working is a good sign. Much appreciated :)
Addresses Issue #2 & adds lightbar + rumble support for wireless DS4 controllers.
I had realized that while my old v1 controller worked perfectly with JoyShockLIbrary, my v2 controller and Brook XB1 adapter did not work. Some analysis into the issue revealed that the v2 was not entering 0x11 mode, necessary for Gyro support to work.
After looking further at DS4Windows and the hid_sony Linux kernel driver, I came to the following realizations:
Additionally, I also fixed up lightbar and rumble support by analyzing the 0x11 and CRC32 routines for the controller.
After making these changes and doing some testing, JSL now fully supports the DS4 as well as the non-v1 controllers over bluetooth.