mirror of
https://github.com/MatMoul/g810-led.git
synced 2024-12-23 01:06:11 +00:00
Resolve merge conflicts
This commit is contained in:
commit
5ba6063ad2
2
makefile
2
makefile
@ -64,6 +64,7 @@ setup:
|
|||||||
@test -s $(DESTDIR)/usr/bin/g512-led || ln -s /usr/bin/$(PROGN) $(DESTDIR)/usr/bin/g512-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/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/g610-led || ln -s /usr/bin/$(PROGN) $(DESTDIR)/usr/bin/g610-led
|
||||||
|
@test -s $(DESTDIR)/usr/bin/g815-led || ln -s /usr/bin/$(PROGN) $(DESTDIR)/usr/bin/g815-led
|
||||||
@test -s $(DESTDIR)/usr/bin/g910-led || ln -s /usr/bin/$(PROGN) $(DESTDIR)/usr/bin/g910-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
|
@test -s $(DESTDIR)/usr/bin/gpro-led || ln -s /usr/bin/$(PROGN) $(DESTDIR)/usr/bin/gpro-led
|
||||||
@cp sample_profiles/* $(DESTDIR)/etc/$(PROGN)/samples
|
@cp sample_profiles/* $(DESTDIR)/etc/$(PROGN)/samples
|
||||||
@ -111,6 +112,7 @@ uninstall:
|
|||||||
@rm /usr/bin/g512-led
|
@rm /usr/bin/g512-led
|
||||||
@rm /usr/bin/g513-led
|
@rm /usr/bin/g513-led
|
||||||
@rm /usr/bin/g610-led
|
@rm /usr/bin/g610-led
|
||||||
|
@rm /usr/bin/g815-led
|
||||||
@rm /usr/bin/g910-led
|
@rm /usr/bin/g910-led
|
||||||
@rm /usr/bin/gpro-led
|
@rm /usr/bin/gpro-led
|
||||||
@rm /usr/bin/$(PROGN)
|
@rm /usr/bin/$(PROGN)
|
||||||
|
@ -19,6 +19,7 @@
|
|||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
#include <map>
|
||||||
|
|
||||||
#if defined(hidapi)
|
#if defined(hidapi)
|
||||||
#include <locale>
|
#include <locale>
|
||||||
@ -378,10 +379,12 @@ bool LedKeyboard::commit() {
|
|||||||
case KeyboardModel::g513:
|
case KeyboardModel::g513:
|
||||||
case KeyboardModel::g610:
|
case KeyboardModel::g610:
|
||||||
case KeyboardModel::g810:
|
case KeyboardModel::g810:
|
||||||
case KeyboardModel::g815:
|
|
||||||
case KeyboardModel::gpro:
|
case KeyboardModel::gpro:
|
||||||
data = { 0x11, 0xff, 0x0c, 0x5a };
|
data = { 0x11, 0xff, 0x0c, 0x5a };
|
||||||
break;
|
break;
|
||||||
|
case KeyboardModel::g815:
|
||||||
|
data = { 0x11, 0xff, 0x10, 0x7f };
|
||||||
|
break;
|
||||||
case KeyboardModel::g910:
|
case KeyboardModel::g910:
|
||||||
data = { 0x11, 0xff, 0x0f, 0x5d };
|
data = { 0x11, 0xff, 0x0f, 0x5d };
|
||||||
break;
|
break;
|
||||||
@ -401,7 +404,98 @@ bool LedKeyboard::setKeys(KeyValueArray keyValues) {
|
|||||||
|
|
||||||
bool retval = true;
|
bool retval = true;
|
||||||
|
|
||||||
vector<vector<KeyValue>> SortedKeys = {
|
vector<vector<KeyValue>> SortedKeys;
|
||||||
|
map<int32_t, vector<KeyValue>> KeyByColors;
|
||||||
|
map<int32_t, vector<KeyValue>>::iterator KeyByColorsIterator;
|
||||||
|
const uint8_t maxKeyPerColor = 13;
|
||||||
|
|
||||||
|
switch (currentDevice.model) {
|
||||||
|
case KeyboardModel::g815:
|
||||||
|
for (uint8_t i = 0; i < keyValues.size(); i++) {
|
||||||
|
uint32_t colorkey = static_cast<uint32_t>(keyValues[i].color.red | keyValues[i].color.green << 8 | keyValues[i].color.blue << 16 );
|
||||||
|
if (KeyByColors.count(colorkey) == 0) KeyByColors.insert(pair<uint32_t, vector<KeyValue>>(colorkey, {}));
|
||||||
|
KeyByColors[colorkey].push_back(keyValues[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (auto& x: KeyByColors) {
|
||||||
|
if (x.second.size() > 0) {
|
||||||
|
uint8_t gi = 0;
|
||||||
|
while (gi < x.second.size()) {
|
||||||
|
size_t data_size = 20;
|
||||||
|
byte_buffer_t data = { 0x11, 0xff, 0x10, 0x6c };
|
||||||
|
data.push_back(x.second[0].color.red);
|
||||||
|
data.push_back(x.second[0].color.green);
|
||||||
|
data.push_back(x.second[0].color.blue);
|
||||||
|
for (uint8_t i = 0; i < maxKeyPerColor; i++) {
|
||||||
|
if (gi + i < x.second.size()) {
|
||||||
|
switch (x.second[gi+i].key) {
|
||||||
|
case Key::logo2:
|
||||||
|
case Key::game:
|
||||||
|
case Key::caps:
|
||||||
|
case Key::scroll:
|
||||||
|
case Key::num:
|
||||||
|
case Key::stop:
|
||||||
|
case Key::g6:
|
||||||
|
case Key::g7:
|
||||||
|
case Key::g8:
|
||||||
|
case Key::g9:
|
||||||
|
break;
|
||||||
|
case Key::play:
|
||||||
|
data.push_back(0x9b);
|
||||||
|
break;
|
||||||
|
case Key::mute:
|
||||||
|
data.push_back(0x9c);
|
||||||
|
break;
|
||||||
|
case Key::next:
|
||||||
|
data.push_back(0x9d);
|
||||||
|
break;
|
||||||
|
case Key::prev:
|
||||||
|
data.push_back(0x9e);
|
||||||
|
break;
|
||||||
|
case Key::ctrl_left:
|
||||||
|
case Key::shift_left:
|
||||||
|
case Key::alt_left:
|
||||||
|
case Key::win_left:
|
||||||
|
case Key::ctrl_right:
|
||||||
|
case Key::shift_right:
|
||||||
|
case Key::alt_right:
|
||||||
|
case Key::win_right:
|
||||||
|
data.push_back((static_cast<uint8_t>(x.second[gi+i].key) & 0x00ff) - 0x78);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
switch (static_cast<KeyAddressGroup>((static_cast<uint16_t>(x.second[gi+i].key) & 0xff00) / 0xff)) {
|
||||||
|
case KeyAddressGroup::logo:
|
||||||
|
data.push_back((static_cast<uint8_t>(x.second[gi+i].key) & 0x00ff) + 0xd1);
|
||||||
|
break;
|
||||||
|
case KeyAddressGroup::indicators:
|
||||||
|
data.push_back((static_cast<uint8_t>(x.second[gi+i].key) & 0x00ff) + 0x98);
|
||||||
|
break;
|
||||||
|
case KeyAddressGroup::gkeys:
|
||||||
|
data.push_back((static_cast<uint8_t>(x.second[gi+i].key) & 0x00ff) + 0xb3);
|
||||||
|
break;
|
||||||
|
case KeyAddressGroup::keys:
|
||||||
|
data.push_back((static_cast<uint8_t>(x.second[gi+i].key) & 0x00ff) - 0x03);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (data.size() < data_size) data.push_back(0xff);
|
||||||
|
data.resize(data_size, 0x00);
|
||||||
|
if (retval) retval = sendDataInternal(data);
|
||||||
|
else sendDataInternal(data);
|
||||||
|
|
||||||
|
gi = gi + maxKeyPerColor;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
SortedKeys = {
|
||||||
{}, // Logo AddressGroup
|
{}, // Logo AddressGroup
|
||||||
{}, // Indicators AddressGroup
|
{}, // Indicators AddressGroup
|
||||||
{}, // Multimedia AddressGroup
|
{}, // Multimedia AddressGroup
|
||||||
@ -451,7 +545,6 @@ bool LedKeyboard::setKeys(KeyValueArray keyValues) {
|
|||||||
break;
|
break;
|
||||||
case LedKeyboard::KeyAddressGroup::keys:
|
case LedKeyboard::KeyAddressGroup::keys:
|
||||||
switch (currentDevice.model) {
|
switch (currentDevice.model) {
|
||||||
case LedKeyboard::KeyboardModel::g512:
|
|
||||||
case LedKeyboard::KeyboardModel::g513:
|
case LedKeyboard::KeyboardModel::g513:
|
||||||
case LedKeyboard::KeyboardModel::g610:
|
case LedKeyboard::KeyboardModel::g610:
|
||||||
case LedKeyboard::KeyboardModel::g810:
|
case LedKeyboard::KeyboardModel::g810:
|
||||||
@ -531,6 +624,8 @@ bool LedKeyboard::setKeys(KeyValueArray keyValues) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -544,12 +639,7 @@ bool LedKeyboard::setGroupKeys(KeyGroup keyGroup, LedKeyboard::Color color) {
|
|||||||
keyArray = keyGroupLogo;
|
keyArray = keyGroupLogo;
|
||||||
break;
|
break;
|
||||||
case KeyGroup::indicators:
|
case KeyGroup::indicators:
|
||||||
switch (currentDevice.model) {
|
|
||||||
case KeyboardModel::g815:
|
|
||||||
return true;
|
|
||||||
default:
|
|
||||||
keyArray = keyGroupIndicators;
|
keyArray = keyGroupIndicators;
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case KeyGroup::gkeys:
|
case KeyGroup::gkeys:
|
||||||
keyArray = keyGroupGKeys;
|
keyArray = keyGroupGKeys;
|
||||||
@ -600,6 +690,7 @@ bool LedKeyboard::setAllKeys(LedKeyboard::Color color) {
|
|||||||
case KeyboardModel::g513:
|
case KeyboardModel::g513:
|
||||||
case KeyboardModel::g610:
|
case KeyboardModel::g610:
|
||||||
case KeyboardModel::g810:
|
case KeyboardModel::g810:
|
||||||
|
case KeyboardModel::g815:
|
||||||
case KeyboardModel::g910:
|
case KeyboardModel::g910:
|
||||||
case KeyboardModel::gpro:
|
case KeyboardModel::gpro:
|
||||||
for (uint8_t i = 0; i < keyGroupLogo.size(); i++) keyValues.push_back({keyGroupLogo[i], color});
|
for (uint8_t i = 0; i < keyGroupLogo.size(); i++) keyValues.push_back({keyGroupLogo[i], color});
|
||||||
@ -623,6 +714,17 @@ bool LedKeyboard::setAllKeys(LedKeyboard::Color color) {
|
|||||||
bool LedKeyboard::setMRKey(uint8_t value) {
|
bool LedKeyboard::setMRKey(uint8_t value) {
|
||||||
LedKeyboard::byte_buffer_t data;
|
LedKeyboard::byte_buffer_t data;
|
||||||
switch (currentDevice.model) {
|
switch (currentDevice.model) {
|
||||||
|
case KeyboardModel::g815:
|
||||||
|
switch (value) {
|
||||||
|
case 0x00:
|
||||||
|
case 0x01:
|
||||||
|
data = { 0x11, 0xff, 0x0c, 0x0c, value };
|
||||||
|
data.resize(20, 0x00);
|
||||||
|
return sendDataInternal(data);
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
case KeyboardModel::g910:
|
case KeyboardModel::g910:
|
||||||
switch (value) {
|
switch (value) {
|
||||||
case 0x00:
|
case 0x00:
|
||||||
@ -643,6 +745,24 @@ bool LedKeyboard::setMRKey(uint8_t value) {
|
|||||||
bool LedKeyboard::setMNKey(uint8_t value) {
|
bool LedKeyboard::setMNKey(uint8_t value) {
|
||||||
LedKeyboard::byte_buffer_t data;
|
LedKeyboard::byte_buffer_t data;
|
||||||
switch (currentDevice.model) {
|
switch (currentDevice.model) {
|
||||||
|
case KeyboardModel::g815:
|
||||||
|
switch (value) {
|
||||||
|
case 0x01:
|
||||||
|
data = { 0x11, 0xff, 0x0b, 0x1c, 0x01 };
|
||||||
|
data.resize(20, 0x00);
|
||||||
|
return sendDataInternal(data);
|
||||||
|
case 0x02:
|
||||||
|
data = { 0x11, 0xff, 0x0b, 0x1c, 0x02 };
|
||||||
|
data.resize(20, 0x00);
|
||||||
|
return sendDataInternal(data);
|
||||||
|
case 0x03:
|
||||||
|
data = { 0x11, 0xff, 0x0b, 0x1c, 0x04 };
|
||||||
|
data.resize(20, 0x00);
|
||||||
|
return sendDataInternal(data);
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
case KeyboardModel::g910:
|
case KeyboardModel::g910:
|
||||||
switch (value) {
|
switch (value) {
|
||||||
case 0x00:
|
case 0x00:
|
||||||
@ -669,6 +789,17 @@ bool LedKeyboard::setMNKey(uint8_t value) {
|
|||||||
bool LedKeyboard::setGKeysMode(uint8_t value) {
|
bool LedKeyboard::setGKeysMode(uint8_t value) {
|
||||||
LedKeyboard::byte_buffer_t data;
|
LedKeyboard::byte_buffer_t data;
|
||||||
switch (currentDevice.model) {
|
switch (currentDevice.model) {
|
||||||
|
case KeyboardModel::g815:
|
||||||
|
switch (value) {
|
||||||
|
case 0x00:
|
||||||
|
case 0x01:
|
||||||
|
data = { 0x11, 0xff, 0x0a, 0x2b, value };
|
||||||
|
data.resize(20, 0x00);
|
||||||
|
return sendDataInternal(data);
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
case KeyboardModel::g910:
|
case KeyboardModel::g910:
|
||||||
switch (value) {
|
switch (value) {
|
||||||
case 0x00:
|
case 0x00:
|
||||||
@ -722,6 +853,17 @@ bool LedKeyboard::setStartupMode(StartupMode startupMode) {
|
|||||||
return sendDataInternal(data);
|
return sendDataInternal(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool LedKeyboard::setOnBoardMode(OnBoardMode onBoardMode) {
|
||||||
|
byte_buffer_t data;
|
||||||
|
switch (currentDevice.model) {
|
||||||
|
case KeyboardModel::g815:
|
||||||
|
data = { 0x11, 0xff, 0x11, 0x1a, static_cast<uint8_t>(onBoardMode) };
|
||||||
|
data.resize(20, 0x00);
|
||||||
|
return sendDataInternal(data);
|
||||||
|
default:
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bool LedKeyboard::setNativeEffect(NativeEffect effect, NativeEffectPart part,
|
bool LedKeyboard::setNativeEffect(NativeEffect effect, NativeEffectPart part,
|
||||||
std::chrono::duration<uint16_t, std::milli> period, Color color,
|
std::chrono::duration<uint16_t, std::milli> period, Color color,
|
||||||
@ -945,6 +1087,20 @@ LedKeyboard::byte_buffer_t LedKeyboard::getKeyGroupAddress(LedKeyboard::KeyAddre
|
|||||||
return { 0x12, 0xff, 0x0c, 0x3a, 0x00, 0x01, 0x00, 0x0e };
|
return { 0x12, 0xff, 0x0c, 0x3a, 0x00, 0x01, 0x00, 0x0e };
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case KeyboardModel::g815:
|
||||||
|
switch (keyAddressGroup) {
|
||||||
|
case LedKeyboard::KeyAddressGroup::logo:
|
||||||
|
return { 0x11, 0xff, 0x10, 0x1c };
|
||||||
|
case LedKeyboard::KeyAddressGroup::indicators:
|
||||||
|
return { 0x11, 0xff, 0x10, 0x1c };
|
||||||
|
case LedKeyboard::KeyAddressGroup::gkeys:
|
||||||
|
return { 0x11, 0xff, 0x10, 0x1c };
|
||||||
|
case LedKeyboard::KeyAddressGroup::multimedia:
|
||||||
|
return { 0x11, 0xff, 0x10, 0x1c };
|
||||||
|
case LedKeyboard::KeyAddressGroup::keys:
|
||||||
|
return { 0x11, 0xff, 0x10, 0x1c };
|
||||||
|
}
|
||||||
|
break;
|
||||||
case KeyboardModel::g910:
|
case KeyboardModel::g910:
|
||||||
switch (keyAddressGroup) {
|
switch (keyAddressGroup) {
|
||||||
case LedKeyboard::KeyAddressGroup::logo:
|
case LedKeyboard::KeyAddressGroup::logo:
|
||||||
|
@ -80,6 +80,10 @@ class LedKeyboard {
|
|||||||
wave = 0x01,
|
wave = 0x01,
|
||||||
color
|
color
|
||||||
};
|
};
|
||||||
|
enum class OnBoardMode : uint8_t {
|
||||||
|
board = 0x01,
|
||||||
|
software
|
||||||
|
};
|
||||||
enum class NativeEffectGroup : uint8_t {
|
enum class NativeEffectGroup : uint8_t {
|
||||||
off,
|
off,
|
||||||
color,
|
color,
|
||||||
@ -203,6 +207,7 @@ class LedKeyboard {
|
|||||||
|
|
||||||
bool setRegion(uint8_t region, Color color);
|
bool setRegion(uint8_t region, Color color);
|
||||||
bool setStartupMode(StartupMode startupMode);
|
bool setStartupMode(StartupMode startupMode);
|
||||||
|
bool setOnBoardMode(OnBoardMode onBoardMode);
|
||||||
|
|
||||||
bool setNativeEffect(NativeEffect effect, NativeEffectPart part,
|
bool setNativeEffect(NativeEffect effect, NativeEffectPart part,
|
||||||
std::chrono::duration<uint16_t, std::milli> period, Color color,
|
std::chrono::duration<uint16_t, std::milli> period, Color color,
|
||||||
|
@ -36,6 +36,7 @@ namespace help {
|
|||||||
else if(cmdName == "g513-led") return KeyboardFeatures::g513;
|
else if(cmdName == "g513-led") return KeyboardFeatures::g513;
|
||||||
else if(cmdName == "g610-led") return KeyboardFeatures::g610;
|
else if(cmdName == "g610-led") return KeyboardFeatures::g610;
|
||||||
else if(cmdName == "g810-led") return KeyboardFeatures::g810;
|
else if(cmdName == "g810-led") return KeyboardFeatures::g810;
|
||||||
|
else if(cmdName == "g815-led") return KeyboardFeatures::g815;
|
||||||
else if(cmdName == "g910-led") return KeyboardFeatures::g910;
|
else if(cmdName == "g910-led") return KeyboardFeatures::g910;
|
||||||
else if(cmdName == "gpro-led") return KeyboardFeatures::gpro;
|
else if(cmdName == "gpro-led") return KeyboardFeatures::gpro;
|
||||||
return KeyboardFeatures::all;
|
return KeyboardFeatures::all;
|
||||||
@ -90,6 +91,10 @@ namespace help {
|
|||||||
cout<<" --startup-mode {startup mode}\t\tSet startup mode"<<endl;
|
cout<<" --startup-mode {startup mode}\t\tSet startup mode"<<endl;
|
||||||
cout<<endl;
|
cout<<endl;
|
||||||
}
|
}
|
||||||
|
if((features | KeyboardFeatures::onboardmode) == features) {
|
||||||
|
cout<<" --on-board-mode {on-board mode}\t\tSet on-board mode"<<endl;
|
||||||
|
cout<<endl;
|
||||||
|
}
|
||||||
cout<<" --list-keyboards \t\t\tList connected keyboards"<<endl;
|
cout<<" --list-keyboards \t\t\tList connected keyboards"<<endl;
|
||||||
cout<<" --print-device\t\t\tPrint device information for the keyboard"<<endl;
|
cout<<" --print-device\t\t\tPrint device information for the keyboard"<<endl;
|
||||||
cout<<endl;
|
cout<<endl;
|
||||||
@ -120,6 +125,7 @@ namespace help {
|
|||||||
if((features | KeyboardFeatures::setgroup) == features)
|
if((features | KeyboardFeatures::setgroup) == features)
|
||||||
cout<<" group values :\t\t\tlogo, indicators, fkeys, ... (use --help-keys for more detail)"<<endl;
|
cout<<" group values :\t\t\tlogo, indicators, fkeys, ... (use --help-keys for more detail)"<<endl;
|
||||||
cout<<" startup mode :\t\t\twave, color"<<endl;
|
cout<<" startup mode :\t\t\twave, color"<<endl;
|
||||||
|
cout<<" on-board mode :\t\t\tboard, software"<<endl;
|
||||||
cout<<endl;
|
cout<<endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -324,6 +330,9 @@ namespace help {
|
|||||||
if((features | KeyboardFeatures::poweronfx) == features)
|
if((features | KeyboardFeatures::poweronfx) == features)
|
||||||
cout<<cmdName<<" --startup-mode color # Set keyboard power on effect"<<endl;
|
cout<<cmdName<<" --startup-mode color # Set keyboard power on effect"<<endl;
|
||||||
cout<<endl;
|
cout<<endl;
|
||||||
|
if((features | KeyboardFeatures::onboardmode) == features)
|
||||||
|
cout<<cmdName<<" --on-board-mode color # Set keyboard power on effect"<<endl;
|
||||||
|
cout<<endl;
|
||||||
if((features | KeyboardFeatures::commit) == features) {
|
if((features | KeyboardFeatures::commit) == features) {
|
||||||
cout<<"Samples with no commit :"<<endl;
|
cout<<"Samples with no commit :"<<endl;
|
||||||
if((features | KeyboardFeatures::setall) == features)
|
if((features | KeyboardFeatures::setall) == features)
|
||||||
|
@ -39,10 +39,11 @@ namespace help {
|
|||||||
poweronfx = 8192,
|
poweronfx = 8192,
|
||||||
// "user-stored lighting" can be recalled with backlight+7 on the G Pro
|
// "user-stored lighting" can be recalled with backlight+7 on the G Pro
|
||||||
userstoredlighting = 16384,
|
userstoredlighting = 16384,
|
||||||
|
onboardmode = 32768,
|
||||||
// fx features
|
// fx features
|
||||||
|
|
||||||
all = rgb | intensity | commit | logo1 | logo2 | numpad | multimedia | gkeys |
|
all = rgb | intensity | commit | logo1 | logo2 | numpad | multimedia | gkeys |
|
||||||
setall | setgroup | setkey | setregion | setindicators | poweronfx | userstoredlighting,
|
setall | setgroup | setkey | setregion | setindicators | poweronfx | userstoredlighting | onboardmode,
|
||||||
|
|
||||||
g213 = rgb | logo1 | numpad | multimedia | setall | setregion | setindicators | poweronfx | userstoredlighting,
|
g213 = rgb | logo1 | numpad | multimedia | setall | setregion | setindicators | poweronfx | userstoredlighting,
|
||||||
g410 = rgb | commit | setall | setgroup | setkey | poweronfx | userstoredlighting,
|
g410 = rgb | commit | setall | setgroup | setkey | poweronfx | userstoredlighting,
|
||||||
@ -51,6 +52,7 @@ namespace help {
|
|||||||
g513 = 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,
|
g610 = intensity | commit | logo1 | numpad | multimedia | setall | setgroup | setkey | setindicators | poweronfx | userstoredlighting,
|
||||||
g810 = rgb | commit | logo1 | numpad | multimedia | setall | setgroup | setkey | setindicators | poweronfx,
|
g810 = rgb | commit | logo1 | numpad | multimedia | setall | setgroup | setkey | setindicators | poweronfx,
|
||||||
|
g815 = rgb | commit | logo1 | numpad | multimedia | gkeys | setall | setgroup | setkey | setindicators | onboardmode,
|
||||||
g910 = rgb | commit | logo1 | logo2 | numpad | multimedia | gkeys | setall | setgroup | setkey | setindicators | poweronfx | userstoredlighting,
|
g910 = rgb | commit | logo1 | logo2 | numpad | multimedia | gkeys | setall | setgroup | setkey | setindicators | poweronfx | userstoredlighting,
|
||||||
gpro = rgb | commit | logo1 | setall | setgroup | setkey | setindicators | poweronfx | userstoredlighting
|
gpro = rgb | commit | logo1 | setall | setgroup | setkey | setindicators | poweronfx | userstoredlighting
|
||||||
};
|
};
|
||||||
|
@ -37,6 +37,13 @@ namespace utils {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool parseOnBoardMode(std::string val, LedKeyboard::OnBoardMode &onBoardMode) {
|
||||||
|
if (val == "software") onBoardMode = LedKeyboard::OnBoardMode ::software;
|
||||||
|
else if (val == "board") onBoardMode = LedKeyboard::OnBoardMode::board;
|
||||||
|
else return false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
bool parseNativeEffect(std::string val, LedKeyboard::NativeEffect &nativeEffect) {
|
bool parseNativeEffect(std::string val, LedKeyboard::NativeEffect &nativeEffect) {
|
||||||
if (val == "color") nativeEffect = LedKeyboard::NativeEffect::color;
|
if (val == "color") nativeEffect = LedKeyboard::NativeEffect::color;
|
||||||
else if (val == "cycle") nativeEffect = LedKeyboard::NativeEffect::cycle;
|
else if (val == "cycle") nativeEffect = LedKeyboard::NativeEffect::cycle;
|
||||||
|
@ -26,6 +26,7 @@ namespace utils {
|
|||||||
std::string getCmdName(std::string cmd);
|
std::string getCmdName(std::string cmd);
|
||||||
|
|
||||||
bool parseStartupMode(std::string val, LedKeyboard::StartupMode &startupMode);
|
bool parseStartupMode(std::string val, LedKeyboard::StartupMode &startupMode);
|
||||||
|
bool parseOnBoardMode(std::string val, LedKeyboard::OnBoardMode &onBoardMode);
|
||||||
bool parseNativeEffect(std::string val, LedKeyboard::NativeEffect &nativeEffect);
|
bool parseNativeEffect(std::string val, LedKeyboard::NativeEffect &nativeEffect);
|
||||||
bool parseNativeEffectPart(std::string val, LedKeyboard::NativeEffectPart &nativeEffectPart);
|
bool parseNativeEffectPart(std::string val, LedKeyboard::NativeEffectPart &nativeEffectPart);
|
||||||
bool parseKey(std::string val, LedKeyboard::Key &key);
|
bool parseKey(std::string val, LedKeyboard::Key &key);
|
||||||
|
13
src/main.cpp
13
src/main.cpp
@ -174,6 +174,14 @@ int setStartupMode(LedKeyboard &kbd, std::string arg2) {
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int setOnBoardMode(LedKeyboard &kbd, std::string arg2) {
|
||||||
|
LedKeyboard::OnBoardMode onBoardMode;
|
||||||
|
if (! utils::parseOnBoardMode(arg2, onBoardMode)) return 1;
|
||||||
|
if (! kbd.open()) return 1;
|
||||||
|
if (kbd.setOnBoardMode(onBoardMode)) return 0;
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
int parseProfile(LedKeyboard &kbd, std::istream &stream) {
|
int parseProfile(LedKeyboard &kbd, std::istream &stream) {
|
||||||
std::string line;
|
std::string line;
|
||||||
@ -220,6 +228,10 @@ int parseProfile(LedKeyboard &kbd, std::istream &stream) {
|
|||||||
if (setMNKey(kbd, args[1]) == 1) retval = 1;
|
if (setMNKey(kbd, args[1]) == 1) retval = 1;
|
||||||
} else if (args[0] == "gkm" && args.size() > 1) {
|
} else if (args[0] == "gkm" && args.size() > 1) {
|
||||||
if (setGKeysMode(kbd, args[1]) == 1) retval = 1;
|
if (setGKeysMode(kbd, args[1]) == 1) retval = 1;
|
||||||
|
} else if (args[0] == "sm" && args.size() > 1) {
|
||||||
|
if (setStartupMode(kbd, args[1]) == 1) retval = 1;
|
||||||
|
} else if (args[0] == "obm" && args.size() > 1) {
|
||||||
|
if (setOnBoardMode(kbd, args[1]) == 1) retval = 1;
|
||||||
} else if (args[0] == "fx" && args.size() > 4) {
|
} else if (args[0] == "fx" && args.size() > 4) {
|
||||||
if (setFX(kbd, args[1], args[2], args[3], args[4]) == 1) retval = 1;
|
if (setFX(kbd, args[1], args[2], args[3], args[4]) == 1) retval = 1;
|
||||||
} else if (args[0] == "fx" && args.size() > 3) {
|
} else if (args[0] == "fx" && args.size() > 3) {
|
||||||
@ -337,6 +349,7 @@ int main(int argc, char **argv) {
|
|||||||
else if (argc > (argIndex + 3) && arg == "-fx-store")
|
else if (argc > (argIndex + 3) && arg == "-fx-store")
|
||||||
return storeFX(kbd, argv[argIndex + 1], argv[argIndex + 2], argv[argIndex + 3]);
|
return storeFX(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 if (argc > (argIndex + 1) && arg == "--on-board-mode") return setOnBoardMode(kbd, argv[argIndex + 1]);
|
||||||
else { help::usage(argv[0]); return 1; }
|
else { help::usage(argv[0]); return 1; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7,6 +7,7 @@ ACTION=="add", SUBSYSTEMS=="usb", ATTRS{idVendor}=="046d", ATTRS{idProduct}=="c3
|
|||||||
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}=="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"
|
ACTION=="add", SUBSYSTEMS=="usb", ATTRS{idVendor}=="046d", ATTRS{idProduct}=="c331", MODE="666" RUN+="/usr/bin/g810-led -p /etc/g810-led/profile"
|
||||||
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}=="c337", MODE="666" RUN+="/usr/bin/g810-led -p /etc/g810-led/profile"
|
||||||
|
ACTION=="add", SUBSYSTEMS=="usb", ATTRS{idVendor}=="046d", ATTRS{idProduct}=="c33f", MODE="666" RUN+="/usr/bin/g815-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}=="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}=="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/gpro-led -p /etc/g810-led/profile"
|
ACTION=="add", SUBSYSTEMS=="usb", ATTRS{idVendor}=="046d", ATTRS{idProduct}=="c339", MODE="666" RUN+="/usr/bin/gpro-led -p /etc/g810-led/profile"
|
||||||
|
Loading…
Reference in New Issue
Block a user