mirror of
https://github.com/MatMoul/g810-led.git
synced 2024-12-23 09:16:11 +00:00
Code formating
This commit is contained in:
parent
c475fc46fd
commit
7c96ec51bc
@ -146,8 +146,7 @@ bool LedKeyboard::open(uint16_t vendorID, uint16_t productID, string serial) {
|
|||||||
|
|
||||||
while (dev) {
|
while (dev) {
|
||||||
for (int i=0; i<(int)SupportedKeyboards.size(); i++) {
|
for (int i=0; i<(int)SupportedKeyboards.size(); i++) {
|
||||||
if (dev->vendor_id == SupportedKeyboards[i][0]) {
|
if (dev->vendor_id == SupportedKeyboards[i][0] && dev->product_id == SupportedKeyboards[i][1]) {
|
||||||
if (dev->product_id == SupportedKeyboards[i][1]) {
|
|
||||||
if (!serial.empty() && dev->serial_number != NULL && wideSerial.compare(dev->serial_number) != 0) break; //Serial didn't match
|
if (!serial.empty() && dev->serial_number != NULL && wideSerial.compare(dev->serial_number) != 0) break; //Serial didn't match
|
||||||
|
|
||||||
if (dev->serial_number != NULL) {
|
if (dev->serial_number != NULL) {
|
||||||
@ -176,7 +175,6 @@ bool LedKeyboard::open(uint16_t vendorID, uint16_t productID, string serial) {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if (currentDevice.model != KeyboardModel::unknown) break;
|
if (currentDevice.model != KeyboardModel::unknown) break;
|
||||||
dev = dev->next;
|
dev = dev->next;
|
||||||
}
|
}
|
||||||
@ -318,8 +316,7 @@ bool LedKeyboard::open(uint16_t vendorID, uint16_t productID, string serial) {
|
|||||||
return false; //In case neither is defined
|
return false; //In case neither is defined
|
||||||
}
|
}
|
||||||
|
|
||||||
LedKeyboard::DeviceInfo LedKeyboard::getCurrentDevice()
|
LedKeyboard::DeviceInfo LedKeyboard::getCurrentDevice() {
|
||||||
{
|
|
||||||
return currentDevice;
|
return currentDevice;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -332,7 +329,6 @@ bool LedKeyboard::close() {
|
|||||||
m_hidHandle = NULL;
|
m_hidHandle = NULL;
|
||||||
hid_exit();
|
hid_exit();
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
#elif defined(libusb)
|
#elif defined(libusb)
|
||||||
if (m_hidHandle == NULL) return true;
|
if (m_hidHandle == NULL) return true;
|
||||||
if(libusb_release_interface(m_hidHandle, 1) != 0) return false;
|
if(libusb_release_interface(m_hidHandle, 1) != 0) return false;
|
||||||
|
@ -224,4 +224,5 @@ namespace utils {
|
|||||||
uint16 = std::stoul("0x" + val, nullptr, 16);
|
uint16 = std::stoul("0x" + val, nullptr, 16);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
12
src/main.cpp
12
src/main.cpp
@ -15,8 +15,7 @@ int commit(LedKeyboard &kbd) {
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void printDeviceInfo(LedKeyboard::DeviceInfo device)
|
void printDeviceInfo(LedKeyboard::DeviceInfo device) {
|
||||||
{
|
|
||||||
std::cout<<"Device: "<<device.manufacturer<<" - "<<device.product<<std::endl;
|
std::cout<<"Device: "<<device.manufacturer<<" - "<<device.product<<std::endl;
|
||||||
std::cout<<"\tVendor ID: "<<std::hex<<std::setw(4)<<std::setfill('0')<<device.vendorID<<std::endl;
|
std::cout<<"\tVendor ID: "<<std::hex<<std::setw(4)<<std::setfill('0')<<device.vendorID<<std::endl;
|
||||||
std::cout<<"\tProduct ID: "<<std::hex<<std::setw(4)<<std::setfill('0')<<device.productID<<std::endl;
|
std::cout<<"\tProduct ID: "<<std::hex<<std::setw(4)<<std::setfill('0')<<device.productID<<std::endl;
|
||||||
@ -302,14 +301,17 @@ int main(int argc, char **argv) {
|
|||||||
else if (argc > (argIndex + 1) && arg == "-mr") return setMRKey(kbd, argv[argIndex + 1]);
|
else if (argc > (argIndex + 1) && arg == "-mr") return setMRKey(kbd, argv[argIndex + 1]);
|
||||||
else if (argc > (argIndex + 1) && arg == "-mn") return setMNKey(kbd, argv[argIndex + 1]);
|
else if (argc > (argIndex + 1) && arg == "-mn") return setMNKey(kbd, argv[argIndex + 1]);
|
||||||
else if (argc > (argIndex + 1) && arg == "-an") return setAllKeys(kbd, argv[argIndex + 1], false);
|
else if (argc > (argIndex + 1) && arg == "-an") return setAllKeys(kbd, argv[argIndex + 1], false);
|
||||||
else if (argc > (argIndex + 2) && arg == "-gn") return setGroupKeys(kbd, argv[argIndex + 1], argv[argIndex + 2], false);
|
else if (argc > (argIndex + 2) && arg == "-gn")
|
||||||
|
return setGroupKeys(kbd, argv[argIndex + 1], argv[argIndex + 2], false);
|
||||||
else if (argc > (argIndex + 2) && arg == "-kn") return setKey(kbd, argv[argIndex + 1], argv[argIndex + 2], false);
|
else if (argc > (argIndex + 2) && arg == "-kn") return setKey(kbd, argv[argIndex + 1], argv[argIndex + 2], false);
|
||||||
else if (argc > (argIndex + 2) && arg == "-r") return setRegion(kbd, argv[argIndex + 1], argv[argIndex + 2]);
|
else if (argc > (argIndex + 2) && arg == "-r") return setRegion(kbd, argv[argIndex + 1], argv[argIndex + 2]);
|
||||||
else if (argc > (argIndex + 1) && arg == "-gkm") return setGKeysMode(kbd, argv[argIndex + 1]);
|
else if (argc > (argIndex + 1) && arg == "-gkm") return setGKeysMode(kbd, argv[argIndex + 1]);
|
||||||
else if (argc > (argIndex + 1) && arg == "-p") return loadProfile(kbd, argv[argIndex + 1]);
|
else if (argc > (argIndex + 1) && arg == "-p") return loadProfile(kbd, argv[argIndex + 1]);
|
||||||
else if (arg == "-pp") return pipeProfile(kbd);
|
else if (arg == "-pp") return pipeProfile(kbd);
|
||||||
else if (argc > (argIndex + 4) && arg == "-fx") return setFX(kbd, argv[argIndex + 1], argv[argIndex + 2], argv[argIndex + 3], argv[argIndex + 4]);
|
else if (argc > (argIndex + 4) && arg == "-fx")
|
||||||
else if (argc > (argIndex + 3) && arg == "-fx") return setFX(kbd, argv[argIndex + 1], argv[argIndex + 2], argv[argIndex + 3]);
|
return setFX(kbd, argv[argIndex + 1], argv[argIndex + 2], argv[argIndex + 3], argv[argIndex + 4]);
|
||||||
|
else if (argc > (argIndex + 3) && arg == "-fx")
|
||||||
|
return setFX(kbd, argv[argIndex + 1], argv[argIndex + 2], argv[argIndex + 3]);
|
||||||
else if (argc > (argIndex + 1) && arg == "--startup-mode") return setStartupMode(kbd, argv[argIndex + 1]);
|
else if (argc > (argIndex + 1) && arg == "--startup-mode") return setStartupMode(kbd, argv[argIndex + 1]);
|
||||||
else { help::usage(argv[0]); return 1; }
|
else { help::usage(argv[0]); return 1; }
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user