1
0
mirror of https://github.com/MatMoul/g810-led.git synced 2024-12-23 01:06:11 +00:00

Make hidapi wait for at least 1ms for any answer from the keyboard. Setting this to 0 seems to make hidapi skip the read. And at least the G910 doesn't seem to like this very much.

This commit is contained in:
Christopher Reimer 2017-03-11 22:30:29 +01:00
parent 619e6af72c
commit 72f5f230eb

View File

@ -562,10 +562,9 @@ bool LedKeyboard::sendDataInternal(byte_buffer_t &data) {
std::cout<<"Error: Can not write to hidraw, try with the libusb version"<<std::endl; std::cout<<"Error: Can not write to hidraw, try with the libusb version"<<std::endl;
return false; return false;
} }
usleep(500);
byte_buffer_t data2; byte_buffer_t data2;
data2.resize(21, 0x00); data2.resize(21, 0x00);
hid_read_timeout(m_hidHandle, const_cast<unsigned char*>(data2.data()), data2.size(), 0); hid_read_timeout(m_hidHandle, const_cast<unsigned char*>(data2.data()), data2.size(), 1);
return true; return true;
#elif defined(libusb) #elif defined(libusb)
if (data.size() > 20) { if (data.size() > 20) {