diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index e537304..7a50138 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -46,6 +46,8 @@ * Improve makefile ## [pearsonk](https://github.com/pearsonk) : +* Add g213 protocol (very hard work) +* Add support of g213 * Implement underlying device IO as a shared library ## [wextia](https://github.com/wextia) : diff --git a/src/classes/Keyboard.cpp b/src/classes/Keyboard.cpp index 7d02fff..7dae4fd 100644 --- a/src/classes/Keyboard.cpp +++ b/src/classes/Keyboard.cpp @@ -435,9 +435,7 @@ bool LedKeyboard::setAllKeys(LedKeyboard::Color color) { switch (m_keyboardModel) { case KeyboardModel::g213: - for (uint8_t rIndex=0x01; rIndex <= 0x05; rIndex++) { - if (! setRegion(rIndex,color)) return false; - } + for (uint8_t rIndex=0x01; rIndex <= 0x05; rIndex++) if (! setRegion(rIndex, color)) return false; return true; case KeyboardModel::g410: case KeyboardModel::g610: @@ -531,7 +529,7 @@ bool LedKeyboard::setRegion(uint8_t region, LedKeyboard::Color color) { LedKeyboard::byte_buffer_t data; switch (m_keyboardModel) { case KeyboardModel::g213: - data = {0x11, 0xff, 0x0c, 0x3a, region, 0x01, color.red, color.green, color.blue }; + data = { 0x11, 0xff, 0x0c, 0x3a, region, 0x01, color.red, color.green, color.blue }; data.resize(20,0x00); return sendDataInternal(data); break; @@ -569,7 +567,6 @@ bool LedKeyboard::setNativeEffect(NativeEffect effect, NativeEffectPart part, ui switch (m_keyboardModel) { case KeyboardModel::g213: protocolByte = 0x0c; - if (part == NativeEffectPart::logo) return false; //Does not have logo component break; case KeyboardModel::g410: diff --git a/src/helpers/help.cpp b/src/helpers/help.cpp index dffbd2f..ac3ca0d 100644 --- a/src/helpers/help.cpp +++ b/src/helpers/help.cpp @@ -19,8 +19,7 @@ namespace help { cout<<" -a {color}\t\t\t\tSet all keys color"< 2) { + if (setRegion(kbd, args[1], args[2]) == 1) retval = 1; } else if (args[0] == "mr" && args.size() > 1) { if (setMRKey(kbd, args[1]) == 1) retval = 1; } else if (args[0] == "mn" && args.size() > 1) { diff --git a/udev/g810-led.rules b/udev/g810-led.rules index 68ead9d..a4edd40 100644 --- a/udev/g810-led.rules +++ b/udev/g810-led.rules @@ -1,3 +1,4 @@ +ACTION=="add", SUBSYSTEMS=="usb", ATTRS{idVendor}=="046d", ATTRS{idProduct}=="c336", MODE="666" RUN+="/usr/bin/g213-led -p /etc/g810-led/profile" ACTION=="add", SUBSYSTEMS=="usb", ATTRS{idVendor}=="046d", ATTRS{idProduct}=="c330", MODE="666" RUN+="/usr/bin/g410-led -p /etc/g810-led/profile" ACTION=="add", SUBSYSTEMS=="usb", ATTRS{idVendor}=="046d", ATTRS{idProduct}=="c333", MODE="666" RUN+="/usr/bin/g610-led -p /etc/g810-led/profile" ACTION=="add", SUBSYSTEMS=="usb", ATTRS{idVendor}=="046d", ATTRS{idProduct}=="c338", MODE="666" RUN+="/usr/bin/g610-led -p /etc/g810-led/profile"