audiohacked / OpenCorsairLink

Linux and Mac OS support for the CorsairLink Devices
GNU General Public License v2.0
706 stars 125 forks source link

Fix .write_endpoint values for HIDs without an OUT endpoint #215

Closed jonasmalacofilho closed 4 years ago

jonasmalacofilho commented 4 years ago

Proposed changes

In these cases the writes correctly go through the control/default/zero endpoint. However, the .write_endpoint field for these devices was incorrectly computed and the resulting endpoint address was invalid (e.g. bit 5, set by LIBUSB_REQUEST_TYPE_CLASS, is reserved in endpoint addresses).

In fact, neither LIBUSB_REQUEST_TYPE_CLASS nor LIBUSB_RECIPIENT_INTERFACE had a place in this definition: these flags should only be used to build bmRequestType parameters for control transfers.

The issue was only harmless because .write_endpoint is not used in corsairlink_coolit_write. This patch avoids future confusion about this.¹

¹ Related: #214

Types of changes

Checklist