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

Merge pull request #52 from CReimer/hidapi_wait

Make hidapi wait for at least 1ms (Fixes #45)
This commit is contained in:
MatMoul 2017-03-11 23:14:33 +01:00 committed by GitHub
commit af1007636f

View File

@ -627,10 +627,9 @@ bool LedKeyboard::sendDataInternal(byte_buffer_t &data) {
std::cout<<"Error: Can not write to hidraw, try with the libusb version"<<std::endl;
return false;
}
usleep(500);
byte_buffer_t data2;
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;
#elif defined(libusb)
if (data.size() > 20) {