From 1642d2dc02901bf612a571c171f566bbc64707f9 Mon Sep 17 00:00:00 2001 From: Paulo Flabiano Smorigo Date: Sat, 4 Jan 2020 22:10:00 -0300 Subject: [PATCH] Add support for g512 Signed-off-by: Paulo Flabiano Smorigo --- src/classes/Keyboard.cpp | 5 +++++ src/classes/Keyboard.h | 4 +++- src/helpers/help.cpp | 1 + src/helpers/help.h | 1 + udev/g810-led.rules | 2 ++ 5 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/classes/Keyboard.cpp b/src/classes/Keyboard.cpp index f8a3972..8b1adc3 100644 --- a/src/classes/Keyboard.cpp +++ b/src/classes/Keyboard.cpp @@ -374,6 +374,7 @@ bool LedKeyboard::commit() { case KeyboardModel::g413: return true; // Keyboard is non-transactional case KeyboardModel::g410: + case KeyboardModel::g512: case KeyboardModel::g513: case KeyboardModel::g610: case KeyboardModel::g810: @@ -449,6 +450,7 @@ bool LedKeyboard::setKeys(KeyValueArray keyValues) { break; case LedKeyboard::KeyAddressGroup::keys: switch (currentDevice.model) { + case LedKeyboard::KeyboardModel::g512: case LedKeyboard::KeyboardModel::g513: case LedKeyboard::KeyboardModel::g610: case LedKeyboard::KeyboardModel::g810: @@ -588,6 +590,7 @@ bool LedKeyboard::setAllKeys(LedKeyboard::Color color) { NativeEffectStorage::none); return true; case KeyboardModel::g410: + case KeyboardModel::g512: case KeyboardModel::g513: case KeyboardModel::g610: case KeyboardModel::g810: @@ -752,6 +755,7 @@ bool LedKeyboard::setNativeEffect(NativeEffect effect, NativeEffectPart part, if (part == NativeEffectPart::logo) return true; //Does not have logo component break; case KeyboardModel::g410: + case KeyboardModel::g512: case KeyboardModel::g513: case KeyboardModel::g610: // Unconfirmed case KeyboardModel::g810: @@ -835,6 +839,7 @@ LedKeyboard::byte_buffer_t LedKeyboard::getKeyGroupAddress(LedKeyboard::KeyAddre case KeyboardModel::g413: return {}; // Device doesn't support per-key setting case KeyboardModel::g410: + case KeyboardModel::g512: case KeyboardModel::g513: case KeyboardModel::gpro: switch (keyAddressGroup) { diff --git a/src/classes/Keyboard.h b/src/classes/Keyboard.h index 5119b9d..9ab95f6 100644 --- a/src/classes/Keyboard.h +++ b/src/classes/Keyboard.h @@ -48,6 +48,7 @@ class LedKeyboard { { 0x46d, 0xc336, (uint16_t)KeyboardModel::g213 }, { 0x46d, 0xc330, (uint16_t)KeyboardModel::g410 }, { 0x46d, 0xc33a, (uint16_t)KeyboardModel::g413 }, + { 0x46d, 0xc342, (uint16_t)KeyboardModel::g512 }, { 0x46d, 0xc33c, (uint16_t)KeyboardModel::g513 }, { 0x46d, 0xc333, (uint16_t)KeyboardModel::g610 }, { 0x46d, 0xc338, (uint16_t)KeyboardModel::g610 }, @@ -63,7 +64,8 @@ class LedKeyboard { g213, g410, g413, - g513, + g512, + g513, g610, g810, g910, diff --git a/src/helpers/help.cpp b/src/helpers/help.cpp index f7f3a00..36548d1 100644 --- a/src/helpers/help.cpp +++ b/src/helpers/help.cpp @@ -32,6 +32,7 @@ namespace help { if(cmdName == "g213-led") return KeyboardFeatures::g213; else if(cmdName == "g410-led") return KeyboardFeatures::g410; else if(cmdName == "g413-led") return KeyboardFeatures::g413; + else if(cmdName == "g512-led") return KeyboardFeatures::g512; else if(cmdName == "g513-led") return KeyboardFeatures::g513; else if(cmdName == "g610-led") return KeyboardFeatures::g610; else if(cmdName == "g810-led") return KeyboardFeatures::g810; diff --git a/src/helpers/help.h b/src/helpers/help.h index fc710fa..f90058b 100644 --- a/src/helpers/help.h +++ b/src/helpers/help.h @@ -47,6 +47,7 @@ namespace help { g213 = rgb | logo1 | numpad | multimedia | setall | setregion | setindicators | poweronfx | userstoredlighting, g410 = rgb | commit | setall | setgroup | setkey | poweronfx | userstoredlighting, g413 = intensity | setall | userstoredlighting, + g512 = rgb | commit | numpad | setall | setgroup | setkey | setindicators | poweronfx | userstoredlighting, g513 = rgb | commit | numpad | setall | setgroup | setkey | setindicators | poweronfx | userstoredlighting, g610 = intensity | commit | logo1 | numpad | multimedia | setall | setgroup | setkey | setindicators | poweronfx | userstoredlighting, g810 = rgb | commit | logo1 | numpad | multimedia | setall | setgroup | setkey | setindicators | poweronfx, diff --git a/udev/g810-led.rules b/udev/g810-led.rules index 1757150..d123e18 100644 --- a/udev/g810-led.rules +++ b/udev/g810-led.rules @@ -1,6 +1,7 @@ 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}=="c33a", MODE="666" RUN+="/usr/bin/g413-led -p /etc/g810-led/profile" +ACTION=="add", SUBSYSTEMS=="usb", ATTRS{idVendor}=="046d", ATTRS{idProduct}=="c342", MODE="666" RUN+="/usr/bin/g512-led -p /etc/g810-led/profile" ACTION=="add", SUBSYSTEMS=="usb", ATTRS{idVendor}=="046d", ATTRS{idProduct}=="c33c", MODE="666" RUN+="/usr/bin/g513-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" @@ -12,6 +13,7 @@ ACTION=="add", SUBSYSTEMS=="usb", ATTRS{idVendor}=="046d", ATTRS{idProduct}=="c3 ACTION=="add", SUBSYSTEM=="usb", ATTRS{idVendor}=="046d", ATTRS{idProduct}=="c336", MODE="666" RUN+="/usr/bin/g213-led -p /etc/g810-led/profile" ACTION=="add", SUBSYSTEM=="usb", ATTRS{idVendor}=="046d", ATTRS{idProduct}=="c330", MODE="666" RUN+="/usr/bin/g410-led -p /etc/g810-led/profile" ACTION=="add", SUBSYSTEM=="usb", ATTRS{idVendor}=="046d", ATTRS{idProduct}=="c33a", MODE="666" RUN+="/usr/bin/g413-led -p /etc/g810-led/profile" +ACTION=="add", SUBSYSTEM=="usb", ATTRS{idVendor}=="046d", ATTRS{idProduct}=="c342", MODE="666" RUN+="/usr/bin/g512-led -p /etc/g810-led/profile" ACTION=="add", SUBSYSTEM=="usb", ATTRS{idVendor}=="046d", ATTRS{idProduct}=="c33c", MODE="666" RUN+="/usr/bin/g513-led -p /etc/g810-led/profile" ACTION=="add", SUBSYSTEM=="usb", ATTRS{idVendor}=="046d", ATTRS{idProduct}=="c333", MODE="666" RUN+="/usr/bin/g610-led -p /etc/g810-led/profile" ACTION=="add", SUBSYSTEM=="usb", ATTRS{idVendor}=="046d", ATTRS{idProduct}=="c338", MODE="666" RUN+="/usr/bin/g610-led -p /etc/g810-led/profile"