From 68551c65ecebcf08415fa73fcd9b67fe92e31c66 Mon Sep 17 00:00:00 2001 From: MatMoul Date: Wed, 1 Aug 2018 23:37:29 +0200 Subject: [PATCH] Add support to G512 and G513 --- README.md | 6 +++++- makefile | 5 +++++ src/classes/Keyboard.cpp | 4 ++++ src/classes/Keyboard.h | 2 ++ udev/g810-led.rules | 1 + 5 files changed, 17 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 9c1e021..9d653d4 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,13 @@ # g810-led
-Linux led controller for Logitech G213, G410, G413, G610, G810, G910 and GPRO Keyboards.
+Linux led controller for Logitech G213, G410, G413, G512, G513, G610, G810, G910 and GPRO Keyboards.
## Compatible keyboards :
- **G213 Prodigy**
- **G410 Atlas Spectrum**
- **G413 Carbon**
+- **G512 Carbon**
+- **G513 Carbon**
- **G610 Orion Brown**
- **G610 Orion Red**
- **G810 Orion Spectrum**
@@ -23,6 +25,8 @@ Linux led controller for Logitech G213, G410, G413, G610, G810, G910 and GPRO Ke `g213-led --help`
`g410-led --help`
`g413-led --help`
+`g512-led --help`
+`g513-led --help`
`g610-led --help`
`g810-led --help`
`g910-led --help`
diff --git a/makefile b/makefile index 019636d..e912e8c 100644 --- a/makefile +++ b/makefile @@ -61,6 +61,8 @@ setup: @test -s $(DESTDIR)/usr/bin/g213-led || ln -s /usr/bin/$(PROGN) $(DESTDIR)/usr/bin/g213-led @test -s $(DESTDIR)/usr/bin/g410-led || ln -s /usr/bin/$(PROGN) $(DESTDIR)/usr/bin/g410-led @test -s $(DESTDIR)/usr/bin/g413-led || ln -s /usr/bin/$(PROGN) $(DESTDIR)/usr/bin/g413-led + @test -s $(DESTDIR)/usr/bin/g512-led || ln -s /usr/bin/$(PROGN) $(DESTDIR)/usr/bin/g512-led + @test -s $(DESTDIR)/usr/bin/g513-led || ln -s /usr/bin/$(PROGN) $(DESTDIR)/usr/bin/g513-led @test -s $(DESTDIR)/usr/bin/g610-led || ln -s /usr/bin/$(PROGN) $(DESTDIR)/usr/bin/g610-led @test -s $(DESTDIR)/usr/bin/g910-led || ln -s /usr/bin/$(PROGN) $(DESTDIR)/usr/bin/g910-led @test -s $(DESTDIR)/usr/bin/gpro-led || ln -s /usr/bin/$(PROGN) $(DESTDIR)/usr/bin/gpro-led @@ -106,6 +108,9 @@ uninstall: @rm /usr/bin/g213-led @rm /usr/bin/g410-led @rm /usr/bin/g413-led + @rm /usr/bin/g413-led + @rm /usr/bin/g512-led + @rm /usr/bin/g513-led @rm /usr/bin/g610-led @rm /usr/bin/g910-led @rm /usr/bin/gpro-led diff --git a/src/classes/Keyboard.cpp b/src/classes/Keyboard.cpp index f657b2d..9c54f9d 100644 --- a/src/classes/Keyboard.cpp +++ b/src/classes/Keyboard.cpp @@ -358,6 +358,7 @@ bool LedKeyboard::commit() { case KeyboardModel::g413: return true; // Keyboard is non-transactional case KeyboardModel::g410: + case KeyboardModel::g513: case KeyboardModel::g610: case KeyboardModel::g810: case KeyboardModel::gpro: @@ -569,6 +570,7 @@ bool LedKeyboard::setAllKeys(LedKeyboard::Color color) { setNativeEffect(NativeEffect::color, NativeEffectPart::keys, 0, color); return true; case KeyboardModel::g410: + case KeyboardModel::g513: case KeyboardModel::g610: case KeyboardModel::g810: case KeyboardModel::g910: @@ -731,6 +733,7 @@ bool LedKeyboard::setNativeEffect(NativeEffect effect, NativeEffectPart part, ui if (part == NativeEffectPart::logo) return true; //Does not have logo component break; case KeyboardModel::g410: + case KeyboardModel::g513: case KeyboardModel::g610: // Unconfirmed case KeyboardModel::g810: case KeyboardModel::gpro: @@ -856,6 +859,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::g513: case KeyboardModel::g610: case KeyboardModel::g810: case KeyboardModel::gpro: diff --git a/src/classes/Keyboard.h b/src/classes/Keyboard.h index 5e6dca8..76e178f 100644 --- a/src/classes/Keyboard.h +++ b/src/classes/Keyboard.h @@ -31,6 +31,7 @@ class LedKeyboard { { 0x46d, 0xc336, (u_int16_t)KeyboardModel::g213 }, { 0x46d, 0xc330, (u_int16_t)KeyboardModel::g410 }, { 0x46d, 0xc33a, (u_int16_t)KeyboardModel::g413 }, + { 0x46d, 0xc33c, (u_int16_t)KeyboardModel::g513 }, { 0x46d, 0xc333, (u_int16_t)KeyboardModel::g610 }, { 0x46d, 0xc338, (u_int16_t)KeyboardModel::g610 }, { 0x46d, 0xc331, (u_int16_t)KeyboardModel::g810 }, @@ -45,6 +46,7 @@ class LedKeyboard { g213, g410, g413, + g513, g610, g810, g910, diff --git a/udev/g810-led.rules b/udev/g810-led.rules index d0935f3..08c0d63 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}=="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" ACTION=="add", SUBSYSTEMS=="usb", ATTRS{idVendor}=="046d", ATTRS{idProduct}=="c331", MODE="666" RUN+="/usr/bin/g810-led -p /etc/g810-led/profile"