mirror of
https://github.com/MatMoul/g810-led.git
synced 2024-12-23 09:16:11 +00:00
Finalization of g213 support
This commit is contained in:
parent
793aa0d557
commit
9ae812b88e
@ -46,6 +46,8 @@
|
|||||||
* Improve makefile
|
* Improve makefile
|
||||||
|
|
||||||
## [pearsonk](https://github.com/pearsonk) :
|
## [pearsonk](https://github.com/pearsonk) :
|
||||||
|
* Add g213 protocol (very hard work)
|
||||||
|
* Add support of g213
|
||||||
* Implement underlying device IO as a shared library
|
* Implement underlying device IO as a shared library
|
||||||
|
|
||||||
## [wextia](https://github.com/wextia) :
|
## [wextia](https://github.com/wextia) :
|
||||||
|
@ -435,9 +435,7 @@ bool LedKeyboard::setAllKeys(LedKeyboard::Color color) {
|
|||||||
|
|
||||||
switch (m_keyboardModel) {
|
switch (m_keyboardModel) {
|
||||||
case KeyboardModel::g213:
|
case KeyboardModel::g213:
|
||||||
for (uint8_t rIndex=0x01; rIndex <= 0x05; rIndex++) {
|
for (uint8_t rIndex=0x01; rIndex <= 0x05; rIndex++) if (! setRegion(rIndex, color)) return false;
|
||||||
if (! setRegion(rIndex,color)) return false;
|
|
||||||
}
|
|
||||||
return true;
|
return true;
|
||||||
case KeyboardModel::g410:
|
case KeyboardModel::g410:
|
||||||
case KeyboardModel::g610:
|
case KeyboardModel::g610:
|
||||||
@ -531,7 +529,7 @@ bool LedKeyboard::setRegion(uint8_t region, LedKeyboard::Color color) {
|
|||||||
LedKeyboard::byte_buffer_t data;
|
LedKeyboard::byte_buffer_t data;
|
||||||
switch (m_keyboardModel) {
|
switch (m_keyboardModel) {
|
||||||
case KeyboardModel::g213:
|
case KeyboardModel::g213:
|
||||||
data = {0x11, 0xff, 0x0c, 0x3a, region, 0x01, color.red, color.green, color.blue };
|
data = { 0x11, 0xff, 0x0c, 0x3a, region, 0x01, color.red, color.green, color.blue };
|
||||||
data.resize(20,0x00);
|
data.resize(20,0x00);
|
||||||
return sendDataInternal(data);
|
return sendDataInternal(data);
|
||||||
break;
|
break;
|
||||||
@ -569,7 +567,6 @@ bool LedKeyboard::setNativeEffect(NativeEffect effect, NativeEffectPart part, ui
|
|||||||
switch (m_keyboardModel) {
|
switch (m_keyboardModel) {
|
||||||
case KeyboardModel::g213:
|
case KeyboardModel::g213:
|
||||||
protocolByte = 0x0c;
|
protocolByte = 0x0c;
|
||||||
|
|
||||||
if (part == NativeEffectPart::logo) return false; //Does not have logo component
|
if (part == NativeEffectPart::logo) return false; //Does not have logo component
|
||||||
break;
|
break;
|
||||||
case KeyboardModel::g410:
|
case KeyboardModel::g410:
|
||||||
|
@ -19,8 +19,7 @@ namespace help {
|
|||||||
cout<<" -a {color}\t\t\t\tSet all keys color"<<endl;
|
cout<<" -a {color}\t\t\t\tSet all keys color"<<endl;
|
||||||
cout<<" -g {keygroup} {color}\t\t\tSet key group color"<<endl;
|
cout<<" -g {keygroup} {color}\t\t\tSet key group color"<<endl;
|
||||||
cout<<" -k {key} {color}\t\t\tSet key 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;
|
cout<<" -r {region} {color}\t\t\tSet the color of a region for a region-based keyboard"<<endl;
|
||||||
}
|
}
|
||||||
if (cmdName == "g910-led") {
|
if (cmdName == "g910-led") {
|
||||||
@ -54,8 +53,7 @@ namespace help {
|
|||||||
cout<<"color formats :\t\t\t\tII (hex value for intensity)"<<endl;
|
cout<<"color formats :\t\t\t\tII (hex value for intensity)"<<endl;
|
||||||
else
|
else
|
||||||
cout<<"color formats :\t\t\t\tRRGGBB (hex value for red, green and blue)"<<endl;
|
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<<"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;
|
cout<<"speed formats :\t\t\t\tSS (hex value for speed 01 to ff)"<<endl;
|
||||||
|
@ -73,10 +73,9 @@ int setGKeysMode(LedKeyboard &kbd, std::string arg2) {
|
|||||||
int setRegion(LedKeyboard &kbd, std::string arg2, std::string arg3) {
|
int setRegion(LedKeyboard &kbd, std::string arg2, std::string arg3) {
|
||||||
uint8_t region = 0;
|
uint8_t region = 0;
|
||||||
LedKeyboard::Color color;
|
LedKeyboard::Color color;
|
||||||
|
|
||||||
if (! utils::parseColor(arg3, color)) return 1;
|
if (! utils::parseColor(arg3, color)) return 1;
|
||||||
if (! utils::parseUInt8(arg2, region)) return 1;
|
if (! utils::parseUInt8(arg2, region)) return 1;
|
||||||
if (kbd.setRegion(region,color)) return 0;
|
if (kbd.setRegion(region, color)) return 0;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -189,6 +188,8 @@ int parseProfile(LedKeyboard &kbd, std::istream &stream) {
|
|||||||
if (utils::parseKey(args[1], key))
|
if (utils::parseKey(args[1], key))
|
||||||
if (utils::parseColor(args[2], color))
|
if (utils::parseColor(args[2], color))
|
||||||
keys.push_back({ key, 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) {
|
} else if (args[0] == "mr" && args.size() > 1) {
|
||||||
if (setMRKey(kbd, args[1]) == 1) retval = 1;
|
if (setMRKey(kbd, args[1]) == 1) retval = 1;
|
||||||
} else if (args[0] == "mn" && args.size() > 1) {
|
} else if (args[0] == "mn" && args.size() > 1) {
|
||||||
|
@ -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}=="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}=="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}=="c338", MODE="666" RUN+="/usr/bin/g610-led -p /etc/g810-led/profile"
|
||||||
|
Loading…
Reference in New Issue
Block a user