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

Merge branch 'keynames_backup' into keynames

This commit is contained in:
MatMoul 2016-10-30 00:58:20 +02:00
commit bcafbf8f62
4 changed files with 205 additions and 51 deletions

View File

@ -16,18 +16,18 @@ g indicators $raw0
k mute $raw0 k mute $raw0
# Raw 1 : # Raw 1 :
k esc $raw1 k escape $raw1
g fkeys $raw1 g fkeys $raw1
k printscreen $raw1 k print_screen $raw1
k scrolllock $raw1 k scroll_lock $raw1
k pausebreak $raw1 k pause_break $raw1
k play $raw1 k play_pause $raw1
k stop $raw1 k stop $raw1
k prev $raw1 k prev $raw1
k next $raw1 k next $raw1
# Raw 2 : # Raw 2 :
k ° $raw2 k tilde $raw2
k 1 $raw2 k 1 $raw2
k 2 $raw2 k 2 $raw2
k 3 $raw2 k 3 $raw2
@ -38,16 +38,16 @@ k 7 $raw2
k 8 $raw2 k 8 $raw2
k 9 $raw2 k 9 $raw2
k 0 $raw2 k 0 $raw2
k ? $raw2 k minus $raw2
k tilde $raw2 k equal $raw2
k backspace $raw2 k backspace $raw2
k insert $raw2 k insert $raw2
k home $raw2 k home $raw2
k pageup $raw2 k page_up $raw2
k numlock $raw2 k num_lock $raw2
k numslash $raw2 k num_slash $raw2
k numasterisk $raw2 k num_asterisk $raw2
k numminus $raw2 k num_minus $raw2
# Raw 3 : # Raw 3 :
k tab $raw3 k tab $raw3
@ -61,17 +61,18 @@ k u $raw3
k i $raw3 k i $raw3
k o $raw3 k o $raw3
k p $raw3 k p $raw3
k è $raw3 k open_bracket $raw3
k ¨ $raw3 k close_bracket $raw3
# k backslash $raw3
k delete $raw3 k delete $raw3
k end $raw3 k end $raw3
k pagedown $raw3 k page_down $raw3
k num7 $raw3 k num7 $raw3
k num8 $raw3 k num8 $raw3
k num9 $raw3 k num9 $raw3
# Raw 4 : # Raw 4 :
k capslock $raw4 k caps_lock $raw4
k a $raw4 k a $raw4
k s $raw4 k s $raw4
k d $raw4 k d $raw4
@ -81,18 +82,18 @@ k h $raw4
k j $raw4 k j $raw4
k k $raw4 k k $raw4
k l $raw4 k l $raw4
k é $raw4 k semicolon $raw4
k à $raw4 k quote $raw4
k $ $raw4 k dollar $raw4
k enter $raw4 k enter $raw4
k num4 $raw4 k num4 $raw4
k num5 $raw4 k num5 $raw4
k num6 $raw4 k num6 $raw4
k num+ $raw4 k num_plus $raw4
# Raw 5 : # Raw 5 :
k shiftl $raw5 k shift_left $raw5
k < $raw5 k intl_backslash $raw5
k y $raw5 k y $raw5
k x $raw5 k x $raw5
k c $raw5 k c $raw5
@ -100,29 +101,29 @@ k v $raw5
k b $raw5 k b $raw5
k n $raw5 k n $raw5
k m $raw5 k m $raw5
k , $raw5 k comma $raw5
k . $raw5 k period $raw5
k - $raw5 k slash $raw5
k shiftr $raw5 k shift_right $raw5
k top $raw5 k top $raw5
k num1 $raw5 k num1 $raw5
k num2 $raw5 k num2 $raw5
k num3 $raw5 k num3 $raw5
# Raw 6 : # Raw 6 :
k ctrll $raw6 k ctrl_left $raw6
k winl $raw6 k win_left $raw6
k altl $raw6 k alt_left $raw6
k space $raw6 k space $raw6
k altr $raw6 k alt_right $raw6
k winr $raw6 k win_right $raw6
k menu $raw6 k menu $raw6
k ctrlr $raw6 k ctrl_right $raw6
k left $raw6 k left $raw6
k bottom $raw6 k bottom $raw6
k right $raw6 k right $raw6
k num0 $raw6 k num0 $raw6
k num. $raw6 k num_period $raw6
k numenter $raw6 k numenter $raw6
# Commit # Commit

View File

@ -155,6 +155,8 @@ bool Keyboard::getKeyAddress(Key key, KeyAddress &keyAddress) {
case Key::backspace: keyAddress.id = 0x2a; break; case Key::backspace: keyAddress.id = 0x2a; break;
case Key::tab: keyAddress.id = 0x2b; break; case Key::tab: keyAddress.id = 0x2b; break;
case Key::space: keyAddress.id = 0x2c; break; case Key::space: keyAddress.id = 0x2c; break;
/*
case Key::apostrophe: keyAddress.id = 0x2d; break; // * case Key::apostrophe: keyAddress.id = 0x2d; break; // *
case Key::tilde: keyAddress.id = 0x2e; break; case Key::tilde: keyAddress.id = 0x2e; break;
case Key::open_bracket: keyAddress.id = 0x2f; break; case Key::open_bracket: keyAddress.id = 0x2f; break;
@ -168,6 +170,21 @@ bool Keyboard::getKeyAddress(Key key, KeyAddress &keyAddress) {
case Key::comma: keyAddress.id = 0x36; break; case Key::comma: keyAddress.id = 0x36; break;
case Key::dot: keyAddress.id = 0x37; break; case Key::dot: keyAddress.id = 0x37; break;
case Key::minus: keyAddress.id = 0x38; break; case Key::minus: keyAddress.id = 0x38; break;
*/
case Key::minus: keyAddress.id = 0x2d; break; // *
case Key::equal: keyAddress.id = 0x2e; break;
case Key::open_bracket: keyAddress.id = 0x2f; break;
case Key::close_bracket: keyAddress.id = 0x30; break;
case Key::backslash: keyAddress.id = 0x31; break; // *
case Key::dollar: keyAddress.id = 0x32; break; // *
case Key::semicolon: keyAddress.id = 0x33; break; // *
case Key::quote: keyAddress.id = 0x34; break; // *
case Key::tilde: keyAddress.id = 0x35; break; // *
case Key::comma: keyAddress.id = 0x36; break;
case Key::period: keyAddress.id = 0x37; break;
case Key::slash: keyAddress.id = 0x38; break;
case Key::caps_lock: keyAddress.id = 0x39; break; case Key::caps_lock: keyAddress.id = 0x39; break;
case Key::f1: keyAddress.id = 0x3a; break; case Key::f1: keyAddress.id = 0x3a; break;
case Key::f2: keyAddress.id = 0x3b; break; case Key::f2: keyAddress.id = 0x3b; break;
@ -211,7 +228,9 @@ bool Keyboard::getKeyAddress(Key key, KeyAddress &keyAddress) {
case Key::num_9: keyAddress.id = 0x61; break; case Key::num_9: keyAddress.id = 0x61; break;
case Key::num_0: keyAddress.id = 0x62; break; case Key::num_0: keyAddress.id = 0x62; break;
case Key::num_dot: keyAddress.id = 0x63; break; case Key::num_dot: keyAddress.id = 0x63; break;
case Key::backslash: keyAddress.id = 0x64; break;
case Key::intl_backslash: keyAddress.id = 0x64; break;
case Key::menu: keyAddress.id = 0x65; break; case Key::menu: keyAddress.id = 0x65; break;
case Key::ctrl_left: keyAddress.id = 0xe0; break; case Key::ctrl_left: keyAddress.id = 0xe0; break;
case Key::shift_left: keyAddress.id = 0xe1; break; case Key::shift_left: keyAddress.id = 0xe1; break;
@ -290,6 +309,8 @@ bool Keyboard::parseKey(std::string key, KeyAddress &keyAddress) {
else if (key == "back" || key == "backspace") parsedKey = Key::backspace; else if (key == "back" || key == "backspace") parsedKey = Key::backspace;
else if (key == "tab") parsedKey = Key::tab; else if (key == "tab") parsedKey = Key::tab;
else if (key == "space") parsedKey = Key::space; else if (key == "space") parsedKey = Key::space;
/*
else if (key == "'" || key == "?") parsedKey = Key::apostrophe; else if (key == "'" || key == "?") parsedKey = Key::apostrophe;
else if (key == "tilde" || key == "^" || key == "~") parsedKey = Key::tilde; else if (key == "tilde" || key == "^" || key == "~") parsedKey = Key::tilde;
else if (key == "open_bracket" || key == "openbracket" || key == "è" || key == "ü") parsedKey = Key::open_bracket; else if (key == "open_bracket" || key == "openbracket" || key == "è" || key == "ü") parsedKey = Key::open_bracket;
@ -302,6 +323,22 @@ bool Keyboard::parseKey(std::string key, KeyAddress &keyAddress) {
else if (key == "," || key == "comma") parsedKey = Key::comma; else if (key == "," || key == "comma") parsedKey = Key::comma;
else if (key == "." || key == "dot") parsedKey = Key::dot; else if (key == "." || key == "dot") parsedKey = Key::dot;
else if (key == "-" || key == "minus") parsedKey = Key::minus; else if (key == "-" || key == "minus") parsedKey = Key::minus;
*/
else if (key == "tilde" || key == "~") parsedKey = Key::tilde;
else if (key == "minus" || key == "-") parsedKey = Key::minus;
else if (key == "equal" || key == "=") parsedKey = Key::equal;
else if (key == "open_bracket" || key == "[") parsedKey = Key::open_bracket;
else if (key == "close_bracket" || key == "]") parsedKey = Key::close_bracket;
else if (key == "backslash" || key == "\\") parsedKey = Key::backslash;
else if (key == "semicolon" || key == ";") parsedKey = Key::semicolon;
else if (key == "quote" || key == "\"") parsedKey = Key::quote;
else if (key == "dollar" || key == "$") parsedKey = Key::dollar;
else if (key == "comma" || key == ",") parsedKey = Key::comma;
else if (key == "period" || key == ".") parsedKey = Key::period;
else if (key == "slash" || key == "/") parsedKey = Key::slash;
else if (key == "caps_lock" || key == "capslock") parsedKey = Key::caps_lock; else if (key == "caps_lock" || key == "capslock") parsedKey = Key::caps_lock;
else if (key == "f1") parsedKey = Key::f1; else if (key == "f1") parsedKey = Key::f1;
else if (key == "f2") parsedKey = Key::f2; else if (key == "f2") parsedKey = Key::f2;
@ -344,8 +381,11 @@ bool Keyboard::parseKey(std::string key, KeyAddress &keyAddress) {
else if (key == "num8") parsedKey = Key::num_8; else if (key == "num8") parsedKey = Key::num_8;
else if (key == "num9") parsedKey = Key::num_9; else if (key == "num9") parsedKey = Key::num_9;
else if (key == "num0") parsedKey = Key::num_0; else if (key == "num0") parsedKey = Key::num_0;
else if (key == "num." || key == "num_dot" || key == "numdot") parsedKey = Key::num_dot; else if (key == "num." || key == "num_period" || key == "numperiod") parsedKey = Key::num_dot;
else if (key == "<" || key == ">" || key == "\\" || key == "backslash") parsedKey = Key::backslash;
//else if (key == "<" || key == ">" || key == "\\" || key == "backslash") parsedKey = Key::backslash;
else if (key == "intl_backslash" || key == "<") parsedKey = Key::intl_backslash;
else if (key == "menu") parsedKey = Key::menu; else if (key == "menu") parsedKey = Key::menu;
else if (key == "ctrl_left" || key == "ctrlleft" || key == "ctrll") parsedKey = Key::ctrl_left; else if (key == "ctrl_left" || key == "ctrlleft" || key == "ctrll") parsedKey = Key::ctrl_left;
else if (key == "shift_left" || key == "shiftleft" || key == "shiftl") parsedKey = Key::shift_left; else if (key == "shift_left" || key == "shiftleft" || key == "shiftl") parsedKey = Key::shift_left;
@ -583,12 +623,12 @@ bool Keyboard::setKeys(KeyValue keyValue[], int keyValueCount) {
} }
bool Keyboard::setAllKeys(KeyColors colors) { bool Keyboard::setAllKeys(KeyColors colors) {
KeyValue keyValues[119]; KeyValue keyValues[117];
for (int i = 0; i < 119; i++) { for (int i = 0; i < 117; i++) {
getKeyAddress((Key)i, keyValues[i].key); getKeyAddress((Key)i, keyValues[i].key);
keyValues[i].colors = colors; keyValues[i].colors = colors;
} }
setKeys(keyValues, 119); setKeys(keyValues, 117);
return true; return true;
} }

View File

@ -10,7 +10,7 @@ class Keyboard {
enum class PowerOnEffect { rainbow, color }; enum class PowerOnEffect { rainbow, color };
enum class KeyAddressGroup { logo, indicators, multimedia, keys }; enum class KeyAddressGroup { logo, indicators, multimedia, keys };
enum class Key { // 119 items enum class Key { // 117 items
logo, logo,
caps, num, scroll, game, backlight, caps, num, scroll, game, backlight,
mute, play, stop, prev, next, mute, play, stop, prev, next,
@ -23,8 +23,14 @@ class Keyboard {
n1, n2, n3, n4, n5, n6, n7, n8, n9, n0, n1, n2, n3, n4, n5, n6, n7, n8, n9, n0,
tab, caps_lock, space, backspace, enter, tab, caps_lock, space, backspace, enter,
a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z, a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z,
tilde, minus, equal,
open_bracket, close_bracket, backslash,
semicolon, quote, dollar,
intl_backslash, comma, period, slash
/*
unknown, egrave, eaigu, semicolon, agrave, dollar, apostrophe, degree, backslash, // Need best names unknown, egrave, eaigu, semicolon, agrave, dollar, apostrophe, degree, backslash, // Need best names
comma, dot, minus, open_bracket, close_bracket, tilde comma, dot, minus, open_bracket, close_bracket, tilde
*/
}; };
enum class KeyGroup { logo, indicators, multimedia, fkeys, modifiers, arrows, numeric, functions, keys}; enum class KeyGroup { logo, indicators, multimedia, fkeys, modifiers, arrows, numeric, functions, keys};

View File

@ -34,6 +34,7 @@ void usage() {
cout<<" -p porfilefile :\tLoad a profile\n"; cout<<" -p porfilefile :\tLoad a profile\n";
cout<<"\n"; cout<<"\n";
cout<<" -h | --help :\t\tthis help message\n"; cout<<" -h | --help :\t\tthis help message\n";
cout<<" -lk | --list-keys :\tList keys in groups\n";
cout<<"\n"; cout<<"\n";
cout<<"color formats :\t\tRRGGBB (hex value for red, green and blue)\n"; cout<<"color formats :\t\tRRGGBB (hex value for red, green and blue)\n";
cout<<"\n"; cout<<"\n";
@ -48,6 +49,111 @@ void usage() {
cout<<appname<<" -s color\n"; cout<<appname<<" -s color\n";
} }
void listkeys() {
string appname = "g810-led";
if (lg_pid == 0xc330) appname = "g410-led";
cout<<appname<<" Keys in groups :\n";
cout<<"-------------------------\n";
cout<<"\n";
cout<<"Group logo :\n";
cout<<" Logo\n";
cout<<"\n";
cout<<"Group indicators :\n";
cout<<" num_indicator, numindicator, num\n";
cout<<" caps_indicator, capsindicator, caps\n";
cout<<" scroll_indicator, scrollindicator, scroll\n";
cout<<" game_mode, gamemode, game\n";
cout<<" back_light, backlight, light\n";
cout<<"\n";
cout<<"Group fkeys :\n";
cout<<" f1 - f12\n";
cout<<"\n";
cout<<"Group modifiers :\n";
cout<<" shift_left, shiftleft, shiftl\n";
cout<<" ctrl_left, ctrlleft, ctrll\n";
cout<<" win_left, winleft, win_left\n";
cout<<" alt_left, altleft, altl\n";
cout<<" alt_right, altright, altr, altgr\n";
cout<<" win_right, winright, winr\n";
cout<<" menu\n";
cout<<" ctrl_right, ctrlright, ctrlr\n";
cout<<" shift_right, shiftright, shiftr\n";
cout<<"\n";
cout<<"Group multimedia :\n";
cout<<" mute\n";
cout<<" play_pause, playpause, play\n";
cout<<" stop\n";
cout<<" previous, prev\n";
cout<<" next\n";
cout<<"\n";
cout<<"Group arrows :\n";
cout<<" arrow_top, arrowtop, top\n";
cout<<" arrow_left, arrowleft, left\n";
cout<<" arrow_bottom, arrowbottom, bottom\n";
cout<<" arrow_right, arrowright, right\n";
cout<<"\n";
cout<<"Group numeric :\n";
cout<<" num_lock, numlock\n";
cout<<" num_slash, numslash, num/\n";
cout<<" num_asterisk, numasterisk, num*\n";
cout<<" num_minus, numminus, num-\n";
cout<<" num_plus, numplus, num+\n";
cout<<" numenter\n";
cout<<" num0 - num9\n";
cout<<" num_dot, numdot, num.\n";
cout<<"\n";
cout<<"Group functions :\n";
cout<<" escape, esc\n";
cout<<" print_screen, printscreen, printscr\n";
cout<<" scroll_lock, scrolllock\n";
cout<<" pause_break, pausebreak\n";
cout<<" insert, ins\n";
cout<<" home\n";
cout<<" page_up, pageup\n";
cout<<" delete, del\n";
cout<<" end\n";
cout<<" page_down, pagedown\n";
cout<<"\n";
cout<<"Group keys :\n";
cout<<" 0 - 9\n";
cout<<" a - z\n";
cout<<" tab\n";
cout<<" caps_lock, capslock\n";
cout<<" space\n";
cout<<" backspace, back\n";
cout<<" enter\n";
cout<<" tilde\n";
cout<<" minus\n";
cout<<" equal\n";
cout<<" open_bracket\n";
cout<<" close_bracket\n";
cout<<" backslash\n";
cout<<" semicolon\n";
cout<<" dollar\n";
cout<<" quote\n";
cout<<" intl_backslash\n";
cout<<" comma\n";
cout<<" period\n";
cout<<" slash\n";
/*
cout<<" \n";
cout<<" Keys EN-US FR-CH\n";
cout<<" k1 : tilde §\n";
cout<<" k2 : minus '\n";
cout<<" k3 : = plus ^\n";
cout<<" k4 : [ è\n";
cout<<" k5 : ] !\n";
cout<<" k6 : \\ unknown\n";
cout<<" k7 : ; é\n";
cout<<" k8 : ' à\n";
cout<<" k9 : unknown $\n";
cout<<" k10 : unknown <\n";
cout<<" k11 : , ,\n";
cout<<" k12 : . .\n";
cout<<" k13 : / -\n";
*/
}
int commit() { int commit() {
Keyboard lg_kbd; Keyboard lg_kbd;
lg_kbd.attach(lg_pid); lg_kbd.attach(lg_pid);
@ -242,6 +348,7 @@ int main(int argc, char *argv[]) {
if (argc > 1) { if (argc > 1) {
string argCmd = argv[1]; string argCmd = argv[1];
if (argCmd == "-h" || argCmd == "--help") { usage(); return 0; } if (argCmd == "-h" || argCmd == "--help") { usage(); return 0; }
else if (argCmd == "-lk" || argCmd == "--list-keys") { listkeys(); return 0; }
else if (argCmd == "-s" && argc == 3) return setStartupEffect(argv[2]); else if (argCmd == "-s" && argc == 3) return setStartupEffect(argv[2]);
else if (argCmd == "-a" && argc == 3) return setAllKeys(argv[2], true); else if (argCmd == "-a" && argc == 3) return setAllKeys(argv[2], true);
else if (argCmd == "-an" && argc == 3) return setAllKeys(argv[2], false); else if (argCmd == "-an" && argc == 3) return setAllKeys(argv[2], false);