Add 1ms sleep after every Corsair peripheral USB message because K70 RGB locks up on Linux otherwise

This commit is contained in:
Adam Honse 2020-05-04 17:02:39 -05:00
parent 2dc443ff1e
commit 01e0808e41

View file

@ -11,6 +11,17 @@
#include <cstring>
#ifdef WIN32
#include <Windows.h>
#else
#include <unistd.h>
static void Sleep(unsigned int milliseconds)
{
usleep(1000 * milliseconds);
}
#endif
static unsigned int keys[] = {0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0C, 0x0D, 0x0E, 0x0F, 0x11, 0x12,
0x14, 0x15, 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F, 0x20, 0x21, 0x24, 0x25, 0x26,
0x27, 0x28, 0x2A, 0x2B, 0x2C, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39,
@ -30,6 +41,8 @@ static void send_usb_msg(hid_device* dev, char * data_pkt)
}
int bytes = hid_send_feature_report(dev, (unsigned char *)usb_pkt, 65);
bytes++;
Sleep(1);
}
CorsairPeripheralController::CorsairPeripheralController(hid_device* dev_handle)