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

updates for G815 support

This commit is contained in:
cornernote 2020-01-13 12:47:29 +10:30
parent a1b1127046
commit a3cbef418d
6 changed files with 75 additions and 4 deletions

View File

@ -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)

View File

@ -377,10 +377,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;
@ -414,6 +416,7 @@ bool LedKeyboard::setKeys(KeyValueArray keyValues) {
switch (currentDevice.model) { switch (currentDevice.model) {
case LedKeyboard::KeyboardModel::g610: case LedKeyboard::KeyboardModel::g610:
case LedKeyboard::KeyboardModel::g810: case LedKeyboard::KeyboardModel::g810:
case LedKeyboard::KeyboardModel::g815:
case LedKeyboard::KeyboardModel::gpro: case LedKeyboard::KeyboardModel::gpro:
if (SortedKeys[0].size() <= 1 && keyValues[i].key == LedKeyboard::Key::logo) if (SortedKeys[0].size() <= 1 && keyValues[i].key == LedKeyboard::Key::logo)
SortedKeys[0].push_back(keyValues[i]); SortedKeys[0].push_back(keyValues[i]);
@ -432,6 +435,7 @@ bool LedKeyboard::setKeys(KeyValueArray keyValues) {
switch (currentDevice.model) { switch (currentDevice.model) {
case LedKeyboard::KeyboardModel::g610: case LedKeyboard::KeyboardModel::g610:
case LedKeyboard::KeyboardModel::g810: case LedKeyboard::KeyboardModel::g810:
case LedKeyboard::KeyboardModel::g815:
case LedKeyboard::KeyboardModel::gpro: case LedKeyboard::KeyboardModel::gpro:
if (SortedKeys[2].size() <= 5) SortedKeys[2].push_back(keyValues[i]); if (SortedKeys[2].size() <= 5) SortedKeys[2].push_back(keyValues[i]);
break; break;
@ -441,6 +445,7 @@ bool LedKeyboard::setKeys(KeyValueArray keyValues) {
break; break;
case LedKeyboard::KeyAddressGroup::gkeys: case LedKeyboard::KeyAddressGroup::gkeys:
switch (currentDevice.model) { switch (currentDevice.model) {
case LedKeyboard::KeyboardModel::g815:
case LedKeyboard::KeyboardModel::g910: case LedKeyboard::KeyboardModel::g910:
if (SortedKeys[3].size() <= 9) SortedKeys[3].push_back(keyValues[i]); if (SortedKeys[3].size() <= 9) SortedKeys[3].push_back(keyValues[i]);
break; break;
@ -453,6 +458,7 @@ bool LedKeyboard::setKeys(KeyValueArray keyValues) {
case LedKeyboard::KeyboardModel::g513: case LedKeyboard::KeyboardModel::g513:
case LedKeyboard::KeyboardModel::g610: case LedKeyboard::KeyboardModel::g610:
case LedKeyboard::KeyboardModel::g810: case LedKeyboard::KeyboardModel::g810:
case LedKeyboard::KeyboardModel::g815:
case LedKeyboard::KeyboardModel::g910: case LedKeyboard::KeyboardModel::g910:
case LedKeyboard::KeyboardModel::gpro: case LedKeyboard::KeyboardModel::gpro:
if (SortedKeys[4].size() <= 120) SortedKeys[4].push_back(keyValues[i]); if (SortedKeys[4].size() <= 120) SortedKeys[4].push_back(keyValues[i]);
@ -597,6 +603,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});
@ -620,6 +627,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:
@ -640,6 +658,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:
@ -666,6 +702,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:
@ -708,6 +755,9 @@ bool LedKeyboard::setStartupMode(StartupMode startupMode) {
case KeyboardModel::gpro: case KeyboardModel::gpro:
data = { 0x11, 0xff, 0x0d, 0x5a, 0x00, 0x01 }; data = { 0x11, 0xff, 0x0d, 0x5a, 0x00, 0x01 };
break; break;
case KeyboardModel::g815:
data = { 0x11, 0xff, 0x11, 0x1b, 0x02 };
break;
case KeyboardModel::g910: case KeyboardModel::g910:
data = { 0x11, 0xff, 0x10, 0x5e, 0x00, 0x01 }; data = { 0x11, 0xff, 0x10, 0x5e, 0x00, 0x01 };
break; break;
@ -940,6 +990,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, 0x0c, 0x3a, 0x00, 0x10, 0x00, 0x01 };
case LedKeyboard::KeyAddressGroup::indicators:
return { 0x12, 0xff, 0x0c, 0x3a, 0x00, 0x40, 0x00, 0x05 };
case LedKeyboard::KeyAddressGroup::gkeys:
return {};
case LedKeyboard::KeyAddressGroup::multimedia:
return { 0x12, 0xff, 0x0c, 0x3a, 0x00, 0x02, 0x00, 0x05 };
case LedKeyboard::KeyAddressGroup::keys:
return { 0x12, 0xff, 0x0c, 0x3a, 0x00, 0x01, 0x00, 0x0e };
}
break;
case KeyboardModel::g910: case KeyboardModel::g910:
switch (keyAddressGroup) { switch (keyAddressGroup) {
case LedKeyboard::KeyAddressGroup::logo: case LedKeyboard::KeyAddressGroup::logo:

View File

@ -35,6 +35,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;

View File

@ -50,6 +50,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 | poweronfx,
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
}; };

View File

@ -217,6 +217,8 @@ 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] == "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) {

View File

@ -6,6 +6,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"