From 83d16a23c1837cf834c89e9136493624794c0b86 Mon Sep 17 00:00:00 2001 From: MatMoul Date: Wed, 11 Jan 2017 20:25:37 +0100 Subject: [PATCH] Bug correction in sendDataInternal --- src/classes/Keyboard.cpp | 5 ++++- src/main.cpp | 14 -------------- 2 files changed, 4 insertions(+), 15 deletions(-) diff --git a/src/classes/Keyboard.cpp b/src/classes/Keyboard.cpp index f107cd5..f5fe9b2 100644 --- a/src/classes/Keyboard.cpp +++ b/src/classes/Keyboard.cpp @@ -504,8 +504,11 @@ bool Keyboard::sendDataInternal(unsigned char *data, uint16_t data_size) { int r; if (data_size > 20) r = libusb_control_transfer(dev_handle, 0x21, 0x09, 0x0212, 1, data, data_size, 2000); else r = libusb_control_transfer(dev_handle, 0x21, 0x09, 0x0211, 1, data, data_size, 2000); - usleep(1000); + usleep(1); if (r < 0) return false; + unsigned char buffer[64]; + int len = 0; + r = libusb_interrupt_transfer(dev_handle, 0x82, buffer, sizeof(buffer), &len, 1); return true; } diff --git a/src/main.cpp b/src/main.cpp index 3c2c9f0..4c2c8ee 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -234,8 +234,6 @@ int setFXColor(string color, bool keys, bool logo) { lg_kbd.attach(); lg_kbd.setGroupKeys(Keyboard::KeyGroup::indicators, colors); lg_kbd.commit(); - lg_kbd.detach(); - lg_kbd.attach(); if(keys) lg_kbd.setFXColorKeys(colors); if(logo) lg_kbd.setFXColorLogo(colors); lg_kbd.detach(); @@ -401,8 +399,6 @@ int parseProfile(istream &is) { if (lg_kbd.parseColor(line, colors) == true) { lg_kbd.setGroupKeys(Keyboard::KeyGroup::indicators, colors); lg_kbd.commit(); - lg_kbd.detach(); - lg_kbd.attach(); if(fxkeys) lg_kbd.setFXColorKeys(colors); if(fxlogo) lg_kbd.setFXColorLogo(colors); } else cout<<"Error on line "<