From d6d976322e074e470059eed6dce7ff53dcb11709 Mon Sep 17 00:00:00 2001 From: MatMoul Date: Fri, 19 May 2017 20:37:49 +0200 Subject: [PATCH] Bug Solution 1 --- src/classes/Keyboard.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/classes/Keyboard.cpp b/src/classes/Keyboard.cpp index c6ff8a5..472e45a 100644 --- a/src/classes/Keyboard.cpp +++ b/src/classes/Keyboard.cpp @@ -781,20 +781,23 @@ bool LedKeyboard::setNativeEffect(NativeEffect effect, NativeEffectPart part, ui bool LedKeyboard::sendDataInternal(byte_buffer_t &data) { - if (! m_isOpen) return false; - if (data.size() > 0) { #if defined(hidapi) + if (! open()) 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"<(data2.data()), data2.size(), 1); + */ return true; #elif defined(libusb) + if (! m_isOpen) return false; if (data.size() > 20) { if(libusb_control_transfer(m_hidHandle, 0x21, 0x09, 0x0212, 1, const_cast(data.data()), data.size(), 2000) < 0)