mirror of
https://github.com/MatMoul/g810-led.git
synced 2024-12-23 09:16:11 +00:00
Bug correction in sendDataInternal
This commit is contained in:
parent
caed630b14
commit
83d16a23c1
@ -504,8 +504,11 @@ bool Keyboard::sendDataInternal(unsigned char *data, uint16_t data_size) {
|
|||||||
int r;
|
int r;
|
||||||
if (data_size > 20) r = libusb_control_transfer(dev_handle, 0x21, 0x09, 0x0212, 1, data, data_size, 2000);
|
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);
|
else r = libusb_control_transfer(dev_handle, 0x21, 0x09, 0x0211, 1, data, data_size, 2000);
|
||||||
usleep(1000);
|
usleep(1);
|
||||||
if (r < 0) return false;
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
14
src/main.cpp
14
src/main.cpp
@ -234,8 +234,6 @@ int setFXColor(string color, bool keys, bool logo) {
|
|||||||
lg_kbd.attach();
|
lg_kbd.attach();
|
||||||
lg_kbd.setGroupKeys(Keyboard::KeyGroup::indicators, colors);
|
lg_kbd.setGroupKeys(Keyboard::KeyGroup::indicators, colors);
|
||||||
lg_kbd.commit();
|
lg_kbd.commit();
|
||||||
lg_kbd.detach();
|
|
||||||
lg_kbd.attach();
|
|
||||||
if(keys) lg_kbd.setFXColorKeys(colors);
|
if(keys) lg_kbd.setFXColorKeys(colors);
|
||||||
if(logo) lg_kbd.setFXColorLogo(colors);
|
if(logo) lg_kbd.setFXColorLogo(colors);
|
||||||
lg_kbd.detach();
|
lg_kbd.detach();
|
||||||
@ -401,8 +399,6 @@ int parseProfile(istream &is) {
|
|||||||
if (lg_kbd.parseColor(line, colors) == true) {
|
if (lg_kbd.parseColor(line, colors) == true) {
|
||||||
lg_kbd.setGroupKeys(Keyboard::KeyGroup::indicators, colors);
|
lg_kbd.setGroupKeys(Keyboard::KeyGroup::indicators, colors);
|
||||||
lg_kbd.commit();
|
lg_kbd.commit();
|
||||||
lg_kbd.detach();
|
|
||||||
lg_kbd.attach();
|
|
||||||
if(fxkeys) lg_kbd.setFXColorKeys(colors);
|
if(fxkeys) lg_kbd.setFXColorKeys(colors);
|
||||||
if(fxlogo) lg_kbd.setFXColorLogo(colors);
|
if(fxlogo) lg_kbd.setFXColorLogo(colors);
|
||||||
} else cout<<"Error on line "<<lineCount<<" : "<<line<<"\n";
|
} else cout<<"Error on line "<<lineCount<<" : "<<line<<"\n";
|
||||||
@ -418,8 +414,6 @@ int parseProfile(istream &is) {
|
|||||||
ind = line.find(" ");
|
ind = line.find(" ");
|
||||||
line = line.substr(ind + 1, 2);
|
line = line.substr(ind + 1, 2);
|
||||||
if (lg_kbd.parseSpeed(line.substr(0, 2), speedValue) == true) {
|
if (lg_kbd.parseSpeed(line.substr(0, 2), speedValue) == true) {
|
||||||
lg_kbd.detach();
|
|
||||||
lg_kbd.attach();
|
|
||||||
if(fxkeys) lg_kbd.setFXBreathingKeys(colors, speedValue);
|
if(fxkeys) lg_kbd.setFXBreathingKeys(colors, speedValue);
|
||||||
if(fxlogo) lg_kbd.setFXBreathingLogo(colors, speedValue);
|
if(fxlogo) lg_kbd.setFXBreathingLogo(colors, speedValue);
|
||||||
} else cout<<"Error on line "<<lineCount<<" : "<<line<<"\n";
|
} else cout<<"Error on line "<<lineCount<<" : "<<line<<"\n";
|
||||||
@ -427,32 +421,24 @@ int parseProfile(istream &is) {
|
|||||||
} else if (line.substr(0,5) == "cycle") {
|
} else if (line.substr(0,5) == "cycle") {
|
||||||
line = line.substr(6);
|
line = line.substr(6);
|
||||||
if (lg_kbd.parseSpeed(line.substr(0, 2), speedValue) == true) {
|
if (lg_kbd.parseSpeed(line.substr(0, 2), speedValue) == true) {
|
||||||
lg_kbd.detach();
|
|
||||||
lg_kbd.attach();
|
|
||||||
if(fxkeys) lg_kbd.setFXColorCycleKeys(speedValue);
|
if(fxkeys) lg_kbd.setFXColorCycleKeys(speedValue);
|
||||||
if(fxlogo) lg_kbd.setFXColorCycleLogo(speedValue);
|
if(fxlogo) lg_kbd.setFXColorCycleLogo(speedValue);
|
||||||
} else cout<<"Error on line "<<lineCount<<" : "<<line<<"\n";
|
} else cout<<"Error on line "<<lineCount<<" : "<<line<<"\n";
|
||||||
} else if (line.substr(0,5) == "hwave") {
|
} else if (line.substr(0,5) == "hwave") {
|
||||||
line = line.substr(6);
|
line = line.substr(6);
|
||||||
if (lg_kbd.parseSpeed(line.substr(0, 2), speedValue) == true) {
|
if (lg_kbd.parseSpeed(line.substr(0, 2), speedValue) == true) {
|
||||||
lg_kbd.detach();
|
|
||||||
lg_kbd.attach();
|
|
||||||
if(fxkeys) lg_kbd.setFXHWaveKeys(speedValue);
|
if(fxkeys) lg_kbd.setFXHWaveKeys(speedValue);
|
||||||
if(fxkeys && fxlogo) lg_kbd.setFXColorCycleLogo(speedValue);
|
if(fxkeys && fxlogo) lg_kbd.setFXColorCycleLogo(speedValue);
|
||||||
} else cout<<"Error on line "<<lineCount<<" : "<<line<<"\n";
|
} else cout<<"Error on line "<<lineCount<<" : "<<line<<"\n";
|
||||||
} else if (line.substr(0,5) == "vwave") {
|
} else if (line.substr(0,5) == "vwave") {
|
||||||
line = line.substr(6);
|
line = line.substr(6);
|
||||||
if (lg_kbd.parseSpeed(line.substr(0, 2), speedValue) == true) {
|
if (lg_kbd.parseSpeed(line.substr(0, 2), speedValue) == true) {
|
||||||
lg_kbd.detach();
|
|
||||||
lg_kbd.attach();
|
|
||||||
if(fxkeys) lg_kbd.setFXVWaveKeys(speedValue);
|
if(fxkeys) lg_kbd.setFXVWaveKeys(speedValue);
|
||||||
if(fxkeys && fxlogo) lg_kbd.setFXColorCycleLogo(speedValue);
|
if(fxkeys && fxlogo) lg_kbd.setFXColorCycleLogo(speedValue);
|
||||||
} else cout<<"Error on line "<<lineCount<<" : "<<line<<"\n";
|
} else cout<<"Error on line "<<lineCount<<" : "<<line<<"\n";
|
||||||
} else if (line.substr(0,5) == "cwave") {
|
} else if (line.substr(0,5) == "cwave") {
|
||||||
line = line.substr(6);
|
line = line.substr(6);
|
||||||
if (lg_kbd.parseSpeed(line.substr(0, 2), speedValue) == true) {
|
if (lg_kbd.parseSpeed(line.substr(0, 2), speedValue) == true) {
|
||||||
lg_kbd.detach();
|
|
||||||
lg_kbd.attach();
|
|
||||||
if(fxkeys) lg_kbd.setFXCWaveKeys(speedValue);
|
if(fxkeys) lg_kbd.setFXCWaveKeys(speedValue);
|
||||||
if(fxkeys && fxlogo) lg_kbd.setFXColorCycleLogo(speedValue);
|
if(fxkeys && fxlogo) lg_kbd.setFXColorCycleLogo(speedValue);
|
||||||
} else cout<<"Error on line "<<lineCount<<" : "<<line<<"\n";
|
} else cout<<"Error on line "<<lineCount<<" : "<<line<<"\n";
|
||||||
|
Loading…
Reference in New Issue
Block a user