From d438ec2e3a8d2533d5dbd4cc4bf467762f8821d0 Mon Sep 17 00:00:00 2001 From: Dan Eble Date: Mon, 30 Sep 2019 11:16:37 -0400 Subject: [PATCH] Stop prepending a zero byte to the input of hid_write() hid_write() expects a report ID in the first byte. The 0x11 and 0x12 values sent as the first byte of commands are consistent with report IDs published in the keyboard's USB descriptors. This change was motivated by commands not working reliably using hidapi on macOS with a G Pro keyboard. --- src/classes/Keyboard.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/classes/Keyboard.cpp b/src/classes/Keyboard.cpp index ee92306..5cb3b05 100644 --- a/src/classes/Keyboard.cpp +++ b/src/classes/Keyboard.cpp @@ -798,7 +798,6 @@ bool LedKeyboard::sendDataInternal(byte_buffer_t &data) { if (data.size() > 0) { #if defined(hidapi) if (! open(currentDevice.vendorID, currentDevice.productID, currentDevice.serialNumber)) return false; - data.insert(data.begin(), 0x00); if (hid_write(m_hidHandle, const_cast(data.data()), data.size()) < 0) { std::cout<<"Error: Can not write to hidraw, try with the libusb version"<