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

Finalization of g213 support

This commit is contained in:
MatMoul 2017-04-21 23:00:21 +02:00
parent 793aa0d557
commit 9ae812b88e
5 changed files with 10 additions and 11 deletions

View File

@ -46,6 +46,8 @@
* Improve makefile
## [pearsonk](https://github.com/pearsonk) :
* Add g213 protocol (very hard work)
* Add support of g213
* Implement underlying device IO as a shared library
## [wextia](https://github.com/wextia) :

View File

@ -435,9 +435,7 @@ bool LedKeyboard::setAllKeys(LedKeyboard::Color color) {
switch (m_keyboardModel) {
case KeyboardModel::g213:
for (uint8_t rIndex=0x01; rIndex <= 0x05; rIndex++) {
if (! setRegion(rIndex,color)) return false;
}
for (uint8_t rIndex=0x01; rIndex <= 0x05; rIndex++) if (! setRegion(rIndex, color)) return false;
return true;
case KeyboardModel::g410:
case KeyboardModel::g610:
@ -569,7 +567,6 @@ bool LedKeyboard::setNativeEffect(NativeEffect effect, NativeEffectPart part, ui
switch (m_keyboardModel) {
case KeyboardModel::g213:
protocolByte = 0x0c;
if (part == NativeEffectPart::logo) return false; //Does not have logo component
break;
case KeyboardModel::g410:

View File

@ -19,8 +19,7 @@ namespace help {
cout<<" -a {color}\t\t\t\tSet all keys color"<<endl;
cout<<" -g {keygroup} {color}\t\t\tSet key group color"<<endl;
cout<<" -k {key} {color}\t\t\tSet key color"<<endl;
if (cmdName == "g213-led")
{
if (cmdName == "g213-led") {
cout<<" -r {region} {color}\t\t\tSet the color of a region for a region-based keyboard"<<endl;
}
if (cmdName == "g910-led") {
@ -54,8 +53,7 @@ namespace help {
cout<<"color formats :\t\t\t\tII (hex value for intensity)"<<endl;
else
cout<<"color formats :\t\t\t\tRRGGBB (hex value for red, green and blue)"<<endl;
if (cmdName == "g213-led")
{
if (cmdName == "g213-led") {
cout<<"region formats :\t\t\tRN (integer value for region, 1 to 5)"<<endl;
}
cout<<"speed formats :\t\t\t\tSS (hex value for speed 01 to ff)"<<endl;

View File

@ -73,7 +73,6 @@ int setGKeysMode(LedKeyboard &kbd, std::string arg2) {
int setRegion(LedKeyboard &kbd, std::string arg2, std::string arg3) {
uint8_t region = 0;
LedKeyboard::Color color;
if (! utils::parseColor(arg3, color)) return 1;
if (! utils::parseUInt8(arg2, region)) return 1;
if (kbd.setRegion(region, color)) return 0;
@ -189,6 +188,8 @@ int parseProfile(LedKeyboard &kbd, std::istream &stream) {
if (utils::parseKey(args[1], key))
if (utils::parseColor(args[2], color))
keys.push_back({ key, color });
} else if (args[0] == "r" && args.size() > 2) {
if (setRegion(kbd, args[1], args[2]) == 1) retval = 1;
} else if (args[0] == "mr" && args.size() > 1) {
if (setMRKey(kbd, args[1]) == 1) retval = 1;
} else if (args[0] == "mn" && args.size() > 1) {

View File

@ -1,3 +1,4 @@
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}=="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"