1
0
mirror of https://github.com/MatMoul/g810-led.git synced 2024-12-23 01:06:11 +00:00

Add PRO support

Initial PRO support, effectively treat as g810

Signed-off-by: Lauri Leukkunen <lauri@rahina.org>
This commit is contained in:
Lauri Leukkunen 2017-05-10 12:35:13 +03:00
parent ac8ce20fff
commit bca3eeb469
6 changed files with 18 additions and 5 deletions

View File

@ -1,6 +1,6 @@
# g810-led</br>
Linux led controller for Logitech G213, G410, G610, G810 and G910 Keyboards.</br>
Linux led controller for Logitech G213, G410, G610, G810, G910 and G PRO Keyboards.</br>
## Compatible keyboards :</br>
- **G213 Prodigy**</br>
@ -10,6 +10,7 @@ Linux led controller for Logitech G213, G410, G610, G810 and G910 Keyboards.</br
- **G810 Orion Spectrum**</br>
- **G910 Orion Spark**</br>
- **G910 Orion Spectrum**</br>
- **G PRO**</br>
## Contribute and evolution :</br>
* [CONTRIBUTING.md](https://github.com/MatMoul/g810-led/blob/master/CONTRIBUTING.md)

View File

@ -359,6 +359,7 @@ bool LedKeyboard::commit() {
case KeyboardModel::g410:
case KeyboardModel::g610:
case KeyboardModel::g810:
case KeyboardModel::gpro:
data = { 0x11, 0xff, 0x0c, 0x5a };
break;
case KeyboardModel::g910:
@ -394,6 +395,7 @@ bool LedKeyboard::setKeys(KeyValueArray keyValues) {
switch (currentDevice.model) {
case LedKeyboard::KeyboardModel::g610:
case LedKeyboard::KeyboardModel::g810:
case LedKeyboard::KeyboardModel::gpro:
if (SortedKeys[0].size() <= 1 && keyValues[i].key == LedKeyboard::Key::logo)
SortedKeys[0].push_back(keyValues[i]);
break;
@ -411,6 +413,7 @@ bool LedKeyboard::setKeys(KeyValueArray keyValues) {
switch (currentDevice.model) {
case LedKeyboard::KeyboardModel::g610:
case LedKeyboard::KeyboardModel::g810:
case LedKeyboard::KeyboardModel::gpro:
if (SortedKeys[2].size() <= 5) SortedKeys[2].push_back(keyValues[i]);
break;
default:
@ -431,6 +434,7 @@ bool LedKeyboard::setKeys(KeyValueArray keyValues) {
case LedKeyboard::KeyboardModel::g610:
case LedKeyboard::KeyboardModel::g810:
case LedKeyboard::KeyboardModel::g910:
case LedKeyboard::KeyboardModel::gpro:
if (SortedKeys[4].size() <= 120) SortedKeys[4].push_back(keyValues[i]);
break;
case LedKeyboard::KeyboardModel::g410:
@ -564,6 +568,7 @@ bool LedKeyboard::setAllKeys(LedKeyboard::Color color) {
case KeyboardModel::g610:
case KeyboardModel::g810:
case KeyboardModel::g910:
case KeyboardModel::gpro:
for (uint8_t i = 0; i < keyGroupLogo.size(); i++) keyValues.push_back({keyGroupLogo[i], color});
for (uint8_t i = 0; i < keyGroupIndicators.size(); i++) keyValues.push_back({keyGroupIndicators[i], color});
for (uint8_t i = 0; i < keyGroupMultimedia.size(); i++) keyValues.push_back({keyGroupMultimedia[i], color});
@ -670,6 +675,7 @@ bool LedKeyboard::setStartupMode(StartupMode startupMode) {
case KeyboardModel::g410:
case KeyboardModel::g610:
case KeyboardModel::g810:
case KeyboardModel::gpro:
data = { 0x11, 0xff, 0x0d, 0x5a, 0x00, 0x01 };
break;
case KeyboardModel::g910:
@ -695,6 +701,7 @@ bool LedKeyboard::setNativeEffect(NativeEffect effect, NativeEffectPart part, ui
case KeyboardModel::g410:
case KeyboardModel::g610: // Unconfirmed
case KeyboardModel::g810:
case KeyboardModel::gpro:
protocolByte = 0x0d;
break;
case KeyboardModel::g910:
@ -815,6 +822,7 @@ LedKeyboard::byte_buffer_t LedKeyboard::getKeyGroupAddress(LedKeyboard::KeyAddre
case KeyboardModel::g410:
case KeyboardModel::g610:
case KeyboardModel::g810:
case KeyboardModel::gpro:
switch (keyAddressGroup) {
case LedKeyboard::KeyAddressGroup::logo:
return { 0x11, 0xff, 0x0c, 0x3a, 0x00, 0x10, 0x00, 0x01 };

View File

@ -35,7 +35,8 @@ class LedKeyboard {
{ 0x46d, 0xc331, (u_int16_t)KeyboardModel::g810 },
{ 0x46d, 0xc337, (u_int16_t)KeyboardModel::g810 },
{ 0x46d, 0xc32b, (u_int16_t)KeyboardModel::g910 },
{ 0x46d, 0xc335, (u_int16_t)KeyboardModel::g910 }
{ 0x46d, 0xc335, (u_int16_t)KeyboardModel::g910 },
{ 0x46d, 0xc339, (u_int16_t)KeyboardModel::gpro }
};
enum class KeyboardModel : uint8_t {
@ -44,7 +45,8 @@ class LedKeyboard {
g410,
g610,
g810,
g910
g910,
gpro
};
enum class StartupMode : uint8_t {
wave = 0x01,

View File

@ -18,6 +18,7 @@ namespace help {
else if(cmdName == "g610-led") return KeyboardFeatures::g610;
else if(cmdName == "g810-led") return KeyboardFeatures::g810;
else if(cmdName == "g910-led") return KeyboardFeatures::g910;
else if(cmdName == "gpro-led") return KeyboardFeatures::gpro;
return KeyboardFeatures::all;
}

View File

@ -30,8 +30,8 @@ namespace help {
g410 = rgb | commit | setall | setgroup | setkey | poweronfx,
g610 = intensity | commit | logo1 | numpad | multimedia | setall | setgroup | setkey | setindicators | poweronfx,
g810 = rgb | commit | logo1 | numpad | multimedia | setall | setgroup | setkey | setindicators | poweronfx,
g910 = rgb | commit | logo1 | logo2 | numpad | multimedia | gkeys | setall | setgroup | setkey | setindicators | poweronfx
g910 = rgb | commit | logo1 | logo2 | numpad | multimedia | gkeys | setall | setgroup | setkey | setindicators | poweronfx,
gpro = rgb | commit | logo1 | multimedia | setall | setgroup | setkey | setindicators | poweronfx
};
inline KeyboardFeatures operator|(KeyboardFeatures a, KeyboardFeatures b);

View File

@ -6,3 +6,4 @@ ACTION=="add", SUBSYSTEMS=="usb", ATTRS{idVendor}=="046d", ATTRS{idProduct}=="c3
ACTION=="add", SUBSYSTEMS=="usb", ATTRS{idVendor}=="046d", ATTRS{idProduct}=="c337", MODE="666" RUN+="/usr/bin/g810-led -p /etc/g810-led/profile"
ACTION=="add", SUBSYSTEMS=="usb", ATTRS{idVendor}=="046d", ATTRS{idProduct}=="c32b", MODE="666" RUN+="/usr/bin/g910-led -p /etc/g810-led/profile"
ACTION=="add", SUBSYSTEMS=="usb", ATTRS{idVendor}=="046d", ATTRS{idProduct}=="c335", MODE="666" RUN+="/usr/bin/g910-led -p /etc/g810-led/profile"
ACTION=="add", SUBSYSTEMS=="usb", ATTRS{idVendor}=="046d", ATTRS{idProduct}=="c339", MODE="666" RUN+="/usr/bin/g810-led -p /etc/g810-led/profile"