M686, M913: Rewrite mapping buttons as keyboard keys

This commit is contained in:
dokutan 2022-01-04 18:42:21 +01:00
parent 4ba501c093
commit a610000e99
9 changed files with 32 additions and 310 deletions

View file

@ -163,7 +163,6 @@ std::map< std::string, uint8_t > rd_mouse::_c_keyboard_key_values = {
{ "Shift_r", 0xe5 }, { "Shift_r", 0xe5 },
{ "Return", 0x28 }, { "Return", 0x28 },
{ "Backspace", 0x2a }, { "Backspace", 0x2a },
{ "Caps_Lock", 0x39 },
//special characters //special characters
{ "Space", 0x2c }, { "Space", 0x2c },
{ "Tilde", 0x35 }, { "Tilde", 0x35 },

View file

@ -62,149 +62,6 @@ std::map< int, std::array<uint8_t, 3> > mouse_m686::_c_keyboard_key_buttons = {
{ 11, {0x02, 0x60, 0x87} }, // button_dpi_down { 11, {0x02, 0x60, 0x87} }, // button_dpi_down
}; };
/* see documentation/m913-key-press.txt for a description of these packets, partially generated with:
#!/usr/bin/env julia
for i in [0:25;]
println("{ \"", Char('a'+i), "\", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x", string(4+i, base=16, pad=2), ", 0x00, 0x41, 0x", string(4+i, base=16, pad=2), ", 0x00, 0x", string(0x89 - 2*i, base=16, pad=2), ", 0x00, 0x00, 0x48} },")
end
*/
std::map< std::string, std::array<uint8_t, 17> > mouse_m686::_c_keyboard_key_packets = {
{ "a", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x04, 0x00, 0x41, 0x04, 0x00, 0x89, 0x00, 0x00, 0x48} },
{ "b", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x05, 0x00, 0x41, 0x05, 0x00, 0x87, 0x00, 0x00, 0x48} },
{ "c", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x06, 0x00, 0x41, 0x06, 0x00, 0x85, 0x00, 0x00, 0x48} },
{ "d", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x07, 0x00, 0x41, 0x07, 0x00, 0x83, 0x00, 0x00, 0x48} },
{ "e", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x08, 0x00, 0x41, 0x08, 0x00, 0x81, 0x00, 0x00, 0x48} },
{ "f", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x09, 0x00, 0x41, 0x09, 0x00, 0x7f, 0x00, 0x00, 0x48} },
{ "g", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x0a, 0x00, 0x41, 0x0a, 0x00, 0x7d, 0x00, 0x00, 0x48} },
{ "h", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x0b, 0x00, 0x41, 0x0b, 0x00, 0x7b, 0x00, 0x00, 0x48} },
{ "i", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x0c, 0x00, 0x41, 0x0c, 0x00, 0x79, 0x00, 0x00, 0x48} },
{ "j", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x0d, 0x00, 0x41, 0x0d, 0x00, 0x77, 0x00, 0x00, 0x48} },
{ "k", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x0e, 0x00, 0x41, 0x0e, 0x00, 0x75, 0x00, 0x00, 0x48} },
{ "l", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x0f, 0x00, 0x41, 0x0f, 0x00, 0x73, 0x00, 0x00, 0x48} },
{ "m", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x10, 0x00, 0x41, 0x10, 0x00, 0x71, 0x00, 0x00, 0x48} },
{ "n", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x11, 0x00, 0x41, 0x11, 0x00, 0x6f, 0x00, 0x00, 0x48} },
{ "o", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x12, 0x00, 0x41, 0x12, 0x00, 0x6d, 0x00, 0x00, 0x48} },
{ "p", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x13, 0x00, 0x41, 0x13, 0x00, 0x6b, 0x00, 0x00, 0x48} },
{ "q", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x14, 0x00, 0x41, 0x14, 0x00, 0x69, 0x00, 0x00, 0x48} },
{ "r", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x15, 0x00, 0x41, 0x15, 0x00, 0x67, 0x00, 0x00, 0x48} },
{ "s", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x16, 0x00, 0x41, 0x16, 0x00, 0x65, 0x00, 0x00, 0x48} },
{ "t", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x17, 0x00, 0x41, 0x17, 0x00, 0x63, 0x00, 0x00, 0x48} },
{ "u", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x18, 0x00, 0x41, 0x18, 0x00, 0x61, 0x00, 0x00, 0x48} },
{ "v", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x19, 0x00, 0x41, 0x19, 0x00, 0x5f, 0x00, 0x00, 0x48} },
{ "w", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x1a, 0x00, 0x41, 0x1a, 0x00, 0x5d, 0x00, 0x00, 0x48} },
{ "x", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x1b, 0x00, 0x41, 0x1b, 0x00, 0x5b, 0x00, 0x00, 0x48} },
{ "y", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x1c, 0x00, 0x41, 0x1c, 0x00, 0x59, 0x00, 0x00, 0x48} },
{ "z", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x1d, 0x00, 0x41, 0x1d, 0x00, 0x57, 0x00, 0x00, 0x48} },
{ "1", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x1e, 0x00, 0x41, 0x1e, 0x00, 0x55, 0x00, 0x00, 0x48} },
{ "2", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x1f, 0x00, 0x41, 0x1f, 0x00, 0x53, 0x00, 0x00, 0x48} },
{ "3", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x20, 0x00, 0x41, 0x20, 0x00, 0x51, 0x00, 0x00, 0x48} },
{ "4", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x21, 0x00, 0x41, 0x21, 0x00, 0x4f, 0x00, 0x00, 0x48} },
{ "5", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x22, 0x00, 0x41, 0x22, 0x00, 0x4d, 0x00, 0x00, 0x48} },
{ "6", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x23, 0x00, 0x41, 0x23, 0x00, 0x4b, 0x00, 0x00, 0x48} },
{ "7", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x24, 0x00, 0x41, 0x24, 0x00, 0x49, 0x00, 0x00, 0x48} },
{ "8", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x25, 0x00, 0x41, 0x25, 0x00, 0x47, 0x00, 0x00, 0x48} },
{ "9", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x26, 0x00, 0x41, 0x26, 0x00, 0x45, 0x00, 0x00, 0x48} },
{ "0", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x27, 0x00, 0x41, 0x27, 0x00, 0x43, 0x00, 0x00, 0x48} },
{ "Return", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x28, 0x00, 0x41, 0x28, 0x00, 0x41, 0x00, 0x00, 0x48} },
{ "Esc", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x29, 0x00, 0x41, 0x29, 0x00, 0x3f, 0x00, 0x00, 0x48} },
{ "Backspace", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x2a, 0x00, 0x41, 0x2a, 0x00, 0x3d, 0x00, 0x00, 0x48} },
{ "Tab", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x2b, 0x00, 0x41, 0x2b, 0x00, 0x3b, 0x00, 0x00, 0x48} },
{ "Space", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x2c, 0x00, 0x41, 0x2c, 0x00, 0x39, 0x00, 0x00, 0x48} },
{ "Minus", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x2d, 0x00, 0x41, 0x2d, 0x00, 0x37, 0x00, 0x00, 0x48} },
{ "Equals", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x2e, 0x00, 0x41, 0x2e, 0x00, 0x35, 0x00, 0x00, 0x48} },
{ "Bracket_l", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x2f, 0x00, 0x41, 0x2f, 0x00, 0x33, 0x00, 0x00, 0x48} },
{ "Bracket_r", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x30, 0x00, 0x41, 0x30, 0x00, 0x31, 0x00, 0x00, 0x48} },
{ "Backslash", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x31, 0x00, 0x41, 0x31, 0x00, 0x2f, 0x00, 0x00, 0x48} },
{ "Semicolon", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x33, 0x00, 0x41, 0x33, 0x00, 0x2b, 0x00, 0x00, 0x48} },
{ "Apostrophe", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x34, 0x00, 0x41, 0x34, 0x00, 0x29, 0x00, 0x00, 0x48} },
{ "Grave", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x35, 0x00, 0x41, 0x35, 0x00, 0x27, 0x00, 0x00, 0x48} },
{ "Comma", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x36, 0x00, 0x41, 0x36, 0x00, 0x25, 0x00, 0x00, 0x48} },
{ "Period", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x37, 0x00, 0x41, 0x37, 0x00, 0x23, 0x00, 0x00, 0x48} },
{ "Slash", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x38, 0x00, 0x41, 0x38, 0x00, 0x21, 0x00, 0x00, 0x48} },
{ "Caps_Lock", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x39, 0x00, 0x41, 0x39, 0x00, 0x1f, 0x00, 0x00, 0x48} },
{ "F1", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x3a, 0x00, 0x41, 0x3a, 0x00, 0x1d, 0x00, 0x00, 0x48} },
{ "F2", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x3b, 0x00, 0x41, 0x3b, 0x00, 0x1b, 0x00, 0x00, 0x48} },
{ "F3", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x3c, 0x00, 0x41, 0x3c, 0x00, 0x19, 0x00, 0x00, 0x48} },
{ "F4", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x3d, 0x00, 0x41, 0x3d, 0x00, 0x17, 0x00, 0x00, 0x48} },
{ "F5", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x3e, 0x00, 0x41, 0x3e, 0x00, 0x15, 0x00, 0x00, 0x48} },
{ "F6", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x3f, 0x00, 0x41, 0x3f, 0x00, 0x13, 0x00, 0x00, 0x48} },
{ "F7", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x40, 0x00, 0x41, 0x40, 0x00, 0x11, 0x00, 0x00, 0x48} },
{ "F8", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x41, 0x00, 0x41, 0x41, 0x00, 0x0f, 0x00, 0x00, 0x48} },
{ "F9", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x42, 0x00, 0x41, 0x42, 0x00, 0x0d, 0x00, 0x00, 0x48} },
{ "F10", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x43, 0x00, 0x41, 0x43, 0x00, 0x0b, 0x00, 0x00, 0x48} },
{ "F11", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x44, 0x00, 0x41, 0x44, 0x00, 0x09, 0x00, 0x00, 0x48} },
{ "F12", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x45, 0x00, 0x41, 0x45, 0x00, 0x07, 0x00, 0x00, 0x48} },
{ "Sys_Rq", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x46, 0x00, 0x41, 0x46, 0x00, 0x05, 0x00, 0x00, 0x48} },
{ "Scroll_Lock", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x47, 0x00, 0x41, 0x47, 0x00, 0x03, 0x00, 0x00, 0x48} },
{ "Pause", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x48, 0x00, 0x41, 0x48, 0x00, 0x01, 0x00, 0x00, 0x48} },
{ "Home", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x4a, 0x00, 0x41, 0x4a, 0x00, 0xfd, 0x00, 0x00, 0x48} },
{ "PgUp", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x4b, 0x00, 0x41, 0x4b, 0x00, 0xfb, 0x00, 0x00, 0x48} },
{ "Delete", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x4c, 0x00, 0x41, 0x4c, 0x00, 0xf9, 0x00, 0x00, 0x48} },
{ "End", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x4d, 0x00, 0x41, 0x4d, 0x00, 0xf7, 0x00, 0x00, 0x48} },
{ "PgDown", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x4e, 0x00, 0x41, 0x4e, 0x00, 0xf5, 0x00, 0x00, 0x48} },
{ "Right", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x4f, 0x00, 0x41, 0x4f, 0x00, 0xf3, 0x00, 0x00, 0x48} },
{ "Left", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x50, 0x00, 0x41, 0x50, 0x00, 0xf1, 0x00, 0x00, 0x48} },
{ "Down", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x51, 0x00, 0x41, 0x51, 0x00, 0xef, 0x00, 0x00, 0x48} },
{ "Up", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x52, 0x00, 0x41, 0x52, 0x00, 0xed, 0x00, 0x00, 0x48} },
{ "Num_Lock", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x53, 0x00, 0x41, 0x53, 0x00, 0xeb, 0x00, 0x00, 0x48} },
{ "Num_Slash", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x54, 0x00, 0x41, 0x54, 0x00, 0xe9, 0x00, 0x00, 0x48} },
{ "Num_Asterisk", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x55, 0x00, 0x41, 0x55, 0x00, 0xe7, 0x00, 0x00, 0x48} },
{ "Num_Minus", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x56, 0x00, 0x41, 0x56, 0x00, 0xe5, 0x00, 0x00, 0x48} },
{ "Num_Plus", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x57, 0x00, 0x41, 0x57, 0x00, 0xe3, 0x00, 0x00, 0x48} },
{ "Num_Return", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x58, 0x00, 0x41, 0x58, 0x00, 0xe1, 0x00, 0x00, 0x48} },
{ "Num_1", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x59, 0x00, 0x41, 0x59, 0x00, 0xdf, 0x00, 0x00, 0x48} },
{ "Num_2", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x5a, 0x00, 0x41, 0x5a, 0x00, 0xdd, 0x00, 0x00, 0x48} },
{ "Num_3", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x5b, 0x00, 0x41, 0x5b, 0x00, 0xdb, 0x00, 0x00, 0x48} },
{ "Num_4", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x5c, 0x00, 0x41, 0x5c, 0x00, 0xd9, 0x00, 0x00, 0x48} },
{ "Num_5", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x5d, 0x00, 0x41, 0x5d, 0x00, 0xd7, 0x00, 0x00, 0x48} },
{ "Num_6", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x5e, 0x00, 0x41, 0x5e, 0x00, 0xd5, 0x00, 0x00, 0x48} },
{ "Num_7", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x5f, 0x00, 0x41, 0x5f, 0x00, 0xd3, 0x00, 0x00, 0x48} },
{ "Num_8", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x60, 0x00, 0x41, 0x60, 0x00, 0xd1, 0x00, 0x00, 0x48} },
{ "Num_9", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x61, 0x00, 0x41, 0x61, 0x00, 0xcf, 0x00, 0x00, 0x48} },
{ "Num_0", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x62, 0x00, 0x41, 0x62, 0x00, 0xcd, 0x00, 0x00, 0x48} },
{ "Num_Period", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x63, 0x00, 0x41, 0x63, 0x00, 0xcb, 0x00, 0x00, 0x48} },
{ "Int_Key", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x64, 0x00, 0x41, 0x64, 0x00, 0xc9, 0x00, 0x00, 0x48} },
{ "Compose", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x65, 0x00, 0x41, 0x65, 0x00, 0xc7, 0x00, 0x00, 0x48} },
{ "Power", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x66, 0x00, 0x41, 0x66, 0x00, 0xc5, 0x00, 0x00, 0x48} },
{ "Num_Equals", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x67, 0x00, 0x41, 0x67, 0x00, 0xc3, 0x00, 0x00, 0x48} },
{ "F13", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x68, 0x00, 0x41, 0x68, 0x00, 0xc1, 0x00, 0x00, 0x48} },
{ "F14", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x69, 0x00, 0x41, 0x69, 0x00, 0xbf, 0x00, 0x00, 0x48} },
{ "F15", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x6a, 0x00, 0x41, 0x6a, 0x00, 0xbd, 0x00, 0x00, 0x48} },
{ "F16", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x6b, 0x00, 0x41, 0x6b, 0x00, 0xbb, 0x00, 0x00, 0x48} },
{ "F17", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x6c, 0x00, 0x41, 0x6c, 0x00, 0xb9, 0x00, 0x00, 0x48} },
{ "F18", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x6d, 0x00, 0x41, 0x6d, 0x00, 0xb7, 0x00, 0x00, 0x48} },
{ "F19", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x6e, 0x00, 0x41, 0x6e, 0x00, 0xb5, 0x00, 0x00, 0x48} },
{ "F20", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x6f, 0x00, 0x41, 0x6f, 0x00, 0xb3, 0x00, 0x00, 0x48} },
{ "F21", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x70, 0x00, 0x41, 0x70, 0x00, 0xb1, 0x00, 0x00, 0x48} },
{ "F22", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x71, 0x00, 0x41, 0x71, 0x00, 0xaf, 0x00, 0x00, 0x48} },
{ "F23", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x72, 0x00, 0x41, 0x72, 0x00, 0xad, 0x00, 0x00, 0x48} },
{ "F24", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x73, 0x00, 0x41, 0x73, 0x00, 0xab, 0x00, 0x00, 0x48} },
{ "Execute", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x74, 0x00, 0x41, 0x74, 0x00, 0xa9, 0x00, 0x00, 0x48} },
{ "Help", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x75, 0x00, 0x41, 0x75, 0x00, 0xa7, 0x00, 0x00, 0x48} },
{ "Props", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x76, 0x00, 0x41, 0x76, 0x00, 0xa5, 0x00, 0x00, 0x48} },
{ "Select", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x77, 0x00, 0x41, 0x77, 0x00, 0xa3, 0x00, 0x00, 0x48} },
{ "Stop", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x78, 0x00, 0x41, 0x78, 0x00, 0xa1, 0x00, 0x00, 0x48} },
{ "Again", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x79, 0x00, 0x41, 0x79, 0x00, 0x9f, 0x00, 0x00, 0x48} },
{ "Undo", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x7a, 0x00, 0x41, 0x7a, 0x00, 0x9d, 0x00, 0x00, 0x48} },
{ "Cut", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x7b, 0x00, 0x41, 0x7b, 0x00, 0x9b, 0x00, 0x00, 0x48} },
{ "Copy", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x7c, 0x00, 0x41, 0x7c, 0x00, 0x99, 0x00, 0x00, 0x48} },
{ "Paste", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x7d, 0x00, 0x41, 0x7d, 0x00, 0x97, 0x00, 0x00, 0x48} },
{ "Find", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x7e, 0x00, 0x41, 0x7e, 0x00, 0x95, 0x00, 0x00, 0x48} },
{ "Mute", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x7f, 0x00, 0x41, 0x7f, 0x00, 0x93, 0x00, 0x00, 0x48} },
{ "Volume_Up", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x80, 0x00, 0x41, 0x80, 0x00, 0x91, 0x00, 0x00, 0x48} },
{ "Volume_Down", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x81, 0x00, 0x41, 0x81, 0x00, 0x8f, 0x00, 0x00, 0x48} },
{ "Num_Comma", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x85, 0x00, 0x41, 0x85, 0x00, 0x87, 0x00, 0x00, 0x48} },
{ "Ro", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x87, 0x00, 0x41, 0x87, 0x00, 0x83, 0x00, 0x00, 0x48} },
{ "Katakana_Hiragana", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x88, 0x00, 0x41, 0x88, 0x00, 0x81, 0x00, 0x00, 0x48} },
{ "Yen", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x89, 0x00, 0x41, 0x89, 0x00, 0x7f, 0x00, 0x00, 0x48} },
{ "Henkan", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x8a, 0x00, 0x41, 0x8a, 0x00, 0x7d, 0x00, 0x00, 0x48} },
{ "Muhenkan", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x8b, 0x00, 0x41, 0x8b, 0x00, 0x7b, 0x00, 0x00, 0x48} },
{ "Hanguel", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x90, 0x00, 0x41, 0x90, 0x00, 0x71, 0x00, 0x00, 0x48} },
{ "Hanja", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x91, 0x00, 0x41, 0x91, 0x00, 0x6f, 0x00, 0x00, 0x48} },
{ "Hiragana", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x93, 0x00, 0x41, 0x93, 0x00, 0x6b, 0x00, 0x00, 0x48} },
{ "Zenkaku_Hankaku", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x94, 0x00, 0x41, 0x94, 0x00, 0x69, 0x00, 0x00, 0x48} },
};
// DPI → bytecode // DPI → bytecode
std::map< int, std::array<uint8_t,3> > mouse_m686::_c_dpi_codes = { std::map< int, std::array<uint8_t,3> > mouse_m686::_c_dpi_codes = {
{ 100, { 0x00, 0x00, 0x55 } }, // minimum DPI { 100, { 0x00, 0x00, 0x55 } }, // minimum DPI

View file

@ -331,8 +331,6 @@ class mouse_m686 : public rd_mouse, protected rd_mouse_wireless {
std::vector<std::array<uint8_t, 17>> _s_keyboard_key_packets; std::vector<std::array<uint8_t, 17>> _s_keyboard_key_packets;
//usb data packets //usb data packets
/// Packets to map buttons to keyboard keys
static std::map< std::string, std::array<uint8_t, 17> > _c_keyboard_key_packets;
/// button mapping /// button mapping
static uint8_t _c_data_button_mapping[8][17]; static uint8_t _c_data_button_mapping[8][17];
/// DPI values /// DPI values

View file

@ -175,17 +175,24 @@ int mouse_m686::set_key_mapping( rd_profile profile, int key, std::string mappin
profile = rd_mouse::rd_profile::profile_1; profile = rd_mouse::rd_profile::profile_1;
// the M686 uses different keycodes, therefore the decoding is done here // the M686 uses different keycodes, therefore the decoding is done here
if( _c_keyboard_key_packets.find(mapping) != _c_keyboard_key_packets.end() ){ // keyboard key if( _c_keyboard_key_values.find(mapping) != _c_keyboard_key_values.end() ){ // keyboard key
// the button gets mapped as "default" // the button gets mapped as "default"
_s_keymap_data[rd_profile_to_m686_profile(profile)][key] = rd_mouse_wireless::_c_keycodes["default"]; _s_keymap_data[rd_profile_to_m686_profile(profile)][key] = rd_mouse_wireless::_c_keycodes["default"];
// and additional packets are sent // and additional packets are sent
_s_keyboard_key_packets.push_back(_c_keyboard_key_packets[mapping]); _s_keyboard_key_packets.push_back(_c_data_button_as_keyboard_key);
_s_keyboard_key_packets.back()[3] = _c_keyboard_key_buttons[key][0]; _s_keyboard_key_packets.back()[3] = _c_keyboard_key_buttons[key][0];
_s_keyboard_key_packets.back()[4] = _c_keyboard_key_buttons[key][1]; _s_keyboard_key_packets.back()[4] = _c_keyboard_key_buttons[key][1];
_s_keyboard_key_packets.back()[16] = _c_keyboard_key_buttons[key][2]; _s_keyboard_key_packets.back()[16] = _c_keyboard_key_buttons[key][2];
_s_keyboard_key_packets.back()[8] = _c_keyboard_key_values[mapping];
_s_keyboard_key_packets.back()[11] = _c_keyboard_key_values[mapping];
_s_keyboard_key_packets.back()[13] = _i_keyboard_key_checksum(_c_keyboard_key_values[mapping]);
}else if( rd_mouse_wireless::_c_keycodes.find(mapping) != rd_mouse_wireless::_c_keycodes.end() ){ // mouse buttons, special functions, ... }else if( rd_mouse_wireless::_c_keycodes.find(mapping) != rd_mouse_wireless::_c_keycodes.end() ){ // mouse buttons, special functions, ...
_s_keymap_data[rd_profile_to_m686_profile(profile)][key] = rd_mouse_wireless::_c_keycodes[mapping]; _s_keymap_data[rd_profile_to_m686_profile(profile)][key] = rd_mouse_wireless::_c_keycodes[mapping];

View file

@ -70,149 +70,6 @@ std::map< int, std::array<uint8_t, 3> > mouse_m913::_c_keyboard_key_buttons = {
{ 15, {0x02, 0xe0, 0x07} }, // button_12 { 15, {0x02, 0xe0, 0x07} }, // button_12
}; };
/* see documentation/m913-key-press.txt for a description of these packets, partially generated with:
#!/usr/bin/env julia
for i in [0:25;]
println("{ \"", Char('a'+i), "\", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x", string(4+i, base=16, pad=2), ", 0x00, 0x41, 0x", string(4+i, base=16, pad=2), ", 0x00, 0x", string(0x89 - 2*i, base=16, pad=2), ", 0x00, 0x00, 0x48} },")
end
*/
std::map< std::string, std::array<uint8_t, 17> > mouse_m913::_c_keyboard_key_packets = {
{ "a", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x04, 0x00, 0x41, 0x04, 0x00, 0x89, 0x00, 0x00, 0x48} },
{ "b", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x05, 0x00, 0x41, 0x05, 0x00, 0x87, 0x00, 0x00, 0x48} },
{ "c", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x06, 0x00, 0x41, 0x06, 0x00, 0x85, 0x00, 0x00, 0x48} },
{ "d", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x07, 0x00, 0x41, 0x07, 0x00, 0x83, 0x00, 0x00, 0x48} },
{ "e", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x08, 0x00, 0x41, 0x08, 0x00, 0x81, 0x00, 0x00, 0x48} },
{ "f", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x09, 0x00, 0x41, 0x09, 0x00, 0x7f, 0x00, 0x00, 0x48} },
{ "g", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x0a, 0x00, 0x41, 0x0a, 0x00, 0x7d, 0x00, 0x00, 0x48} },
{ "h", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x0b, 0x00, 0x41, 0x0b, 0x00, 0x7b, 0x00, 0x00, 0x48} },
{ "i", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x0c, 0x00, 0x41, 0x0c, 0x00, 0x79, 0x00, 0x00, 0x48} },
{ "j", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x0d, 0x00, 0x41, 0x0d, 0x00, 0x77, 0x00, 0x00, 0x48} },
{ "k", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x0e, 0x00, 0x41, 0x0e, 0x00, 0x75, 0x00, 0x00, 0x48} },
{ "l", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x0f, 0x00, 0x41, 0x0f, 0x00, 0x73, 0x00, 0x00, 0x48} },
{ "m", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x10, 0x00, 0x41, 0x10, 0x00, 0x71, 0x00, 0x00, 0x48} },
{ "n", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x11, 0x00, 0x41, 0x11, 0x00, 0x6f, 0x00, 0x00, 0x48} },
{ "o", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x12, 0x00, 0x41, 0x12, 0x00, 0x6d, 0x00, 0x00, 0x48} },
{ "p", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x13, 0x00, 0x41, 0x13, 0x00, 0x6b, 0x00, 0x00, 0x48} },
{ "q", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x14, 0x00, 0x41, 0x14, 0x00, 0x69, 0x00, 0x00, 0x48} },
{ "r", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x15, 0x00, 0x41, 0x15, 0x00, 0x67, 0x00, 0x00, 0x48} },
{ "s", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x16, 0x00, 0x41, 0x16, 0x00, 0x65, 0x00, 0x00, 0x48} },
{ "t", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x17, 0x00, 0x41, 0x17, 0x00, 0x63, 0x00, 0x00, 0x48} },
{ "u", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x18, 0x00, 0x41, 0x18, 0x00, 0x61, 0x00, 0x00, 0x48} },
{ "v", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x19, 0x00, 0x41, 0x19, 0x00, 0x5f, 0x00, 0x00, 0x48} },
{ "w", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x1a, 0x00, 0x41, 0x1a, 0x00, 0x5d, 0x00, 0x00, 0x48} },
{ "x", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x1b, 0x00, 0x41, 0x1b, 0x00, 0x5b, 0x00, 0x00, 0x48} },
{ "y", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x1c, 0x00, 0x41, 0x1c, 0x00, 0x59, 0x00, 0x00, 0x48} },
{ "z", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x1d, 0x00, 0x41, 0x1d, 0x00, 0x57, 0x00, 0x00, 0x48} },
{ "1", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x1e, 0x00, 0x41, 0x1e, 0x00, 0x55, 0x00, 0x00, 0x48} },
{ "2", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x1f, 0x00, 0x41, 0x1f, 0x00, 0x53, 0x00, 0x00, 0x48} },
{ "3", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x20, 0x00, 0x41, 0x20, 0x00, 0x51, 0x00, 0x00, 0x48} },
{ "4", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x21, 0x00, 0x41, 0x21, 0x00, 0x4f, 0x00, 0x00, 0x48} },
{ "5", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x22, 0x00, 0x41, 0x22, 0x00, 0x4d, 0x00, 0x00, 0x48} },
{ "6", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x23, 0x00, 0x41, 0x23, 0x00, 0x4b, 0x00, 0x00, 0x48} },
{ "7", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x24, 0x00, 0x41, 0x24, 0x00, 0x49, 0x00, 0x00, 0x48} },
{ "8", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x25, 0x00, 0x41, 0x25, 0x00, 0x47, 0x00, 0x00, 0x48} },
{ "9", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x26, 0x00, 0x41, 0x26, 0x00, 0x45, 0x00, 0x00, 0x48} },
{ "0", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x27, 0x00, 0x41, 0x27, 0x00, 0x43, 0x00, 0x00, 0x48} },
{ "Return", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x28, 0x00, 0x41, 0x28, 0x00, 0x41, 0x00, 0x00, 0x48} },
{ "Esc", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x29, 0x00, 0x41, 0x29, 0x00, 0x3f, 0x00, 0x00, 0x48} },
{ "Backspace", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x2a, 0x00, 0x41, 0x2a, 0x00, 0x3d, 0x00, 0x00, 0x48} },
{ "Tab", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x2b, 0x00, 0x41, 0x2b, 0x00, 0x3b, 0x00, 0x00, 0x48} },
{ "Space", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x2c, 0x00, 0x41, 0x2c, 0x00, 0x39, 0x00, 0x00, 0x48} },
{ "Minus", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x2d, 0x00, 0x41, 0x2d, 0x00, 0x37, 0x00, 0x00, 0x48} },
{ "Equals", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x2e, 0x00, 0x41, 0x2e, 0x00, 0x35, 0x00, 0x00, 0x48} },
{ "Bracket_l", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x2f, 0x00, 0x41, 0x2f, 0x00, 0x33, 0x00, 0x00, 0x48} },
{ "Bracket_r", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x30, 0x00, 0x41, 0x30, 0x00, 0x31, 0x00, 0x00, 0x48} },
{ "Backslash", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x31, 0x00, 0x41, 0x31, 0x00, 0x2f, 0x00, 0x00, 0x48} },
{ "Semicolon", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x33, 0x00, 0x41, 0x33, 0x00, 0x2b, 0x00, 0x00, 0x48} },
{ "Apostrophe", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x34, 0x00, 0x41, 0x34, 0x00, 0x29, 0x00, 0x00, 0x48} },
{ "Grave", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x35, 0x00, 0x41, 0x35, 0x00, 0x27, 0x00, 0x00, 0x48} },
{ "Comma", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x36, 0x00, 0x41, 0x36, 0x00, 0x25, 0x00, 0x00, 0x48} },
{ "Period", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x37, 0x00, 0x41, 0x37, 0x00, 0x23, 0x00, 0x00, 0x48} },
{ "Slash", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x38, 0x00, 0x41, 0x38, 0x00, 0x21, 0x00, 0x00, 0x48} },
{ "Caps_Lock", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x39, 0x00, 0x41, 0x39, 0x00, 0x1f, 0x00, 0x00, 0x48} },
{ "F1", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x3a, 0x00, 0x41, 0x3a, 0x00, 0x1d, 0x00, 0x00, 0x48} },
{ "F2", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x3b, 0x00, 0x41, 0x3b, 0x00, 0x1b, 0x00, 0x00, 0x48} },
{ "F3", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x3c, 0x00, 0x41, 0x3c, 0x00, 0x19, 0x00, 0x00, 0x48} },
{ "F4", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x3d, 0x00, 0x41, 0x3d, 0x00, 0x17, 0x00, 0x00, 0x48} },
{ "F5", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x3e, 0x00, 0x41, 0x3e, 0x00, 0x15, 0x00, 0x00, 0x48} },
{ "F6", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x3f, 0x00, 0x41, 0x3f, 0x00, 0x13, 0x00, 0x00, 0x48} },
{ "F7", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x40, 0x00, 0x41, 0x40, 0x00, 0x11, 0x00, 0x00, 0x48} },
{ "F8", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x41, 0x00, 0x41, 0x41, 0x00, 0x0f, 0x00, 0x00, 0x48} },
{ "F9", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x42, 0x00, 0x41, 0x42, 0x00, 0x0d, 0x00, 0x00, 0x48} },
{ "F10", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x43, 0x00, 0x41, 0x43, 0x00, 0x0b, 0x00, 0x00, 0x48} },
{ "F11", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x44, 0x00, 0x41, 0x44, 0x00, 0x09, 0x00, 0x00, 0x48} },
{ "F12", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x45, 0x00, 0x41, 0x45, 0x00, 0x07, 0x00, 0x00, 0x48} },
{ "Sys_Rq", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x46, 0x00, 0x41, 0x46, 0x00, 0x05, 0x00, 0x00, 0x48} },
{ "Scroll_Lock", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x47, 0x00, 0x41, 0x47, 0x00, 0x03, 0x00, 0x00, 0x48} },
{ "Pause", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x48, 0x00, 0x41, 0x48, 0x00, 0x01, 0x00, 0x00, 0x48} },
{ "Home", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x4a, 0x00, 0x41, 0x4a, 0x00, 0xfd, 0x00, 0x00, 0x48} },
{ "PgUp", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x4b, 0x00, 0x41, 0x4b, 0x00, 0xfb, 0x00, 0x00, 0x48} },
{ "Delete", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x4c, 0x00, 0x41, 0x4c, 0x00, 0xf9, 0x00, 0x00, 0x48} },
{ "End", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x4d, 0x00, 0x41, 0x4d, 0x00, 0xf7, 0x00, 0x00, 0x48} },
{ "PgDown", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x4e, 0x00, 0x41, 0x4e, 0x00, 0xf5, 0x00, 0x00, 0x48} },
{ "Right", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x4f, 0x00, 0x41, 0x4f, 0x00, 0xf3, 0x00, 0x00, 0x48} },
{ "Left", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x50, 0x00, 0x41, 0x50, 0x00, 0xf1, 0x00, 0x00, 0x48} },
{ "Down", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x51, 0x00, 0x41, 0x51, 0x00, 0xef, 0x00, 0x00, 0x48} },
{ "Up", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x52, 0x00, 0x41, 0x52, 0x00, 0xed, 0x00, 0x00, 0x48} },
{ "Num_Lock", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x53, 0x00, 0x41, 0x53, 0x00, 0xeb, 0x00, 0x00, 0x48} },
{ "Num_Slash", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x54, 0x00, 0x41, 0x54, 0x00, 0xe9, 0x00, 0x00, 0x48} },
{ "Num_Asterisk", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x55, 0x00, 0x41, 0x55, 0x00, 0xe7, 0x00, 0x00, 0x48} },
{ "Num_Minus", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x56, 0x00, 0x41, 0x56, 0x00, 0xe5, 0x00, 0x00, 0x48} },
{ "Num_Plus", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x57, 0x00, 0x41, 0x57, 0x00, 0xe3, 0x00, 0x00, 0x48} },
{ "Num_Return", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x58, 0x00, 0x41, 0x58, 0x00, 0xe1, 0x00, 0x00, 0x48} },
{ "Num_1", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x59, 0x00, 0x41, 0x59, 0x00, 0xdf, 0x00, 0x00, 0x48} },
{ "Num_2", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x5a, 0x00, 0x41, 0x5a, 0x00, 0xdd, 0x00, 0x00, 0x48} },
{ "Num_3", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x5b, 0x00, 0x41, 0x5b, 0x00, 0xdb, 0x00, 0x00, 0x48} },
{ "Num_4", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x5c, 0x00, 0x41, 0x5c, 0x00, 0xd9, 0x00, 0x00, 0x48} },
{ "Num_5", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x5d, 0x00, 0x41, 0x5d, 0x00, 0xd7, 0x00, 0x00, 0x48} },
{ "Num_6", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x5e, 0x00, 0x41, 0x5e, 0x00, 0xd5, 0x00, 0x00, 0x48} },
{ "Num_7", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x5f, 0x00, 0x41, 0x5f, 0x00, 0xd3, 0x00, 0x00, 0x48} },
{ "Num_8", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x60, 0x00, 0x41, 0x60, 0x00, 0xd1, 0x00, 0x00, 0x48} },
{ "Num_9", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x61, 0x00, 0x41, 0x61, 0x00, 0xcf, 0x00, 0x00, 0x48} },
{ "Num_0", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x62, 0x00, 0x41, 0x62, 0x00, 0xcd, 0x00, 0x00, 0x48} },
{ "Num_Period", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x63, 0x00, 0x41, 0x63, 0x00, 0xcb, 0x00, 0x00, 0x48} },
{ "Int_Key", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x64, 0x00, 0x41, 0x64, 0x00, 0xc9, 0x00, 0x00, 0x48} },
{ "Compose", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x65, 0x00, 0x41, 0x65, 0x00, 0xc7, 0x00, 0x00, 0x48} },
{ "Power", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x66, 0x00, 0x41, 0x66, 0x00, 0xc5, 0x00, 0x00, 0x48} },
{ "Num_Equals", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x67, 0x00, 0x41, 0x67, 0x00, 0xc3, 0x00, 0x00, 0x48} },
{ "F13", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x68, 0x00, 0x41, 0x68, 0x00, 0xc1, 0x00, 0x00, 0x48} },
{ "F14", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x69, 0x00, 0x41, 0x69, 0x00, 0xbf, 0x00, 0x00, 0x48} },
{ "F15", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x6a, 0x00, 0x41, 0x6a, 0x00, 0xbd, 0x00, 0x00, 0x48} },
{ "F16", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x6b, 0x00, 0x41, 0x6b, 0x00, 0xbb, 0x00, 0x00, 0x48} },
{ "F17", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x6c, 0x00, 0x41, 0x6c, 0x00, 0xb9, 0x00, 0x00, 0x48} },
{ "F18", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x6d, 0x00, 0x41, 0x6d, 0x00, 0xb7, 0x00, 0x00, 0x48} },
{ "F19", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x6e, 0x00, 0x41, 0x6e, 0x00, 0xb5, 0x00, 0x00, 0x48} },
{ "F20", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x6f, 0x00, 0x41, 0x6f, 0x00, 0xb3, 0x00, 0x00, 0x48} },
{ "F21", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x70, 0x00, 0x41, 0x70, 0x00, 0xb1, 0x00, 0x00, 0x48} },
{ "F22", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x71, 0x00, 0x41, 0x71, 0x00, 0xaf, 0x00, 0x00, 0x48} },
{ "F23", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x72, 0x00, 0x41, 0x72, 0x00, 0xad, 0x00, 0x00, 0x48} },
{ "F24", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x73, 0x00, 0x41, 0x73, 0x00, 0xab, 0x00, 0x00, 0x48} },
{ "Execute", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x74, 0x00, 0x41, 0x74, 0x00, 0xa9, 0x00, 0x00, 0x48} },
{ "Help", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x75, 0x00, 0x41, 0x75, 0x00, 0xa7, 0x00, 0x00, 0x48} },
{ "Props", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x76, 0x00, 0x41, 0x76, 0x00, 0xa5, 0x00, 0x00, 0x48} },
{ "Select", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x77, 0x00, 0x41, 0x77, 0x00, 0xa3, 0x00, 0x00, 0x48} },
{ "Stop", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x78, 0x00, 0x41, 0x78, 0x00, 0xa1, 0x00, 0x00, 0x48} },
{ "Again", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x79, 0x00, 0x41, 0x79, 0x00, 0x9f, 0x00, 0x00, 0x48} },
{ "Undo", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x7a, 0x00, 0x41, 0x7a, 0x00, 0x9d, 0x00, 0x00, 0x48} },
{ "Cut", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x7b, 0x00, 0x41, 0x7b, 0x00, 0x9b, 0x00, 0x00, 0x48} },
{ "Copy", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x7c, 0x00, 0x41, 0x7c, 0x00, 0x99, 0x00, 0x00, 0x48} },
{ "Paste", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x7d, 0x00, 0x41, 0x7d, 0x00, 0x97, 0x00, 0x00, 0x48} },
{ "Find", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x7e, 0x00, 0x41, 0x7e, 0x00, 0x95, 0x00, 0x00, 0x48} },
{ "Mute", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x7f, 0x00, 0x41, 0x7f, 0x00, 0x93, 0x00, 0x00, 0x48} },
{ "Volume_Up", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x80, 0x00, 0x41, 0x80, 0x00, 0x91, 0x00, 0x00, 0x48} },
{ "Volume_Down", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x81, 0x00, 0x41, 0x81, 0x00, 0x8f, 0x00, 0x00, 0x48} },
{ "Num_Comma", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x85, 0x00, 0x41, 0x85, 0x00, 0x87, 0x00, 0x00, 0x48} },
{ "Ro", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x87, 0x00, 0x41, 0x87, 0x00, 0x83, 0x00, 0x00, 0x48} },
{ "Katakana_Hiragana", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x88, 0x00, 0x41, 0x88, 0x00, 0x81, 0x00, 0x00, 0x48} },
{ "Yen", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x89, 0x00, 0x41, 0x89, 0x00, 0x7f, 0x00, 0x00, 0x48} },
{ "Henkan", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x8a, 0x00, 0x41, 0x8a, 0x00, 0x7d, 0x00, 0x00, 0x48} },
{ "Muhenkan", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x8b, 0x00, 0x41, 0x8b, 0x00, 0x7b, 0x00, 0x00, 0x48} },
{ "Hanguel", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x90, 0x00, 0x41, 0x90, 0x00, 0x71, 0x00, 0x00, 0x48} },
{ "Hanja", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x91, 0x00, 0x41, 0x91, 0x00, 0x6f, 0x00, 0x00, 0x48} },
{ "Hiragana", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x93, 0x00, 0x41, 0x93, 0x00, 0x6b, 0x00, 0x00, 0x48} },
{ "Zenkaku_Hankaku", {0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x94, 0x00, 0x41, 0x94, 0x00, 0x69, 0x00, 0x00, 0x48} },
};
// DPI → bytecode // DPI → bytecode
std::map< int, std::array<uint8_t,3> > mouse_m913::_c_dpi_codes = { std::map< int, std::array<uint8_t,3> > mouse_m913::_c_dpi_codes = {
{ 100, { 0x00, 0x00, 0x55 } }, // minimum DPI { 100, { 0x00, 0x00, 0x55 } }, // minimum DPI
@ -377,19 +234,6 @@ std::map< int, std::array<uint8_t,3> > mouse_m913::_c_dpi_codes = {
{ 16000, { 0xbd, 0xbd, 0xdb } } // maximum DPI { 16000, { 0xbd, 0xbd, 0xdb } } // maximum DPI
}; };
//usb data packets
uint8_t mouse_m913::_c_data_unknown_1[9][17] = {
{0x08, 0x07, 0x00, 0x01, 0x60, 0x08, 0x02, 0x81, 0x21, 0x00, 0x41, 0x21, 0x00, 0x4f, 0x00, 0x00, 0x88},
{0x08, 0x07, 0x00, 0x01, 0x80, 0x08, 0x02, 0x81, 0x22, 0x00, 0x41, 0x22, 0x00, 0x4d, 0x00, 0x00, 0x68},
{0x08, 0x07, 0x00, 0x01, 0xa0, 0x08, 0x02, 0x81, 0x23, 0x00, 0x41, 0x23, 0x00, 0x4b, 0x00, 0x00, 0x48},
{0x08, 0x07, 0x00, 0x02, 0x00, 0x08, 0x02, 0x81, 0x24, 0x00, 0x41, 0x24, 0x00, 0x49, 0x00, 0x00, 0xe7},
{0x08, 0x07, 0x00, 0x02, 0x20, 0x08, 0x02, 0x81, 0x25, 0x00, 0x41, 0x25, 0x00, 0x47, 0x00, 0x00, 0xc7},
{0x08, 0x07, 0x00, 0x02, 0x80, 0x08, 0x02, 0x81, 0x26, 0x00, 0x41, 0x26, 0x00, 0x45, 0x00, 0x00, 0x67},
{0x08, 0x07, 0x00, 0x02, 0xa0, 0x08, 0x02, 0x81, 0x27, 0x00, 0x41, 0x27, 0x00, 0x43, 0x00, 0x00, 0x47},
{0x08, 0x07, 0x00, 0x02, 0xc0, 0x08, 0x02, 0x81, 0x57, 0x00, 0x41, 0x57, 0x00, 0xe3, 0x00, 0x00, 0x27},
{0x08, 0x07, 0x00, 0x02, 0xe0, 0x08, 0x02, 0x81, 0x56, 0x00, 0x41, 0x56, 0x00, 0xe5, 0x00, 0x00, 0x07},
};
uint8_t mouse_m913::_c_data_button_mapping[8][17] = { uint8_t mouse_m913::_c_data_button_mapping[8][17] = {
{0x08, 0x07, 0x00, 0x00, 0x60, 0x08, 0x00, 0x00, 0x00, 0x55, 0x05, 0x00, 0x00, 0x50, 0x00, 0x00, 0x34}, {0x08, 0x07, 0x00, 0x00, 0x60, 0x08, 0x00, 0x00, 0x00, 0x55, 0x05, 0x00, 0x00, 0x50, 0x00, 0x00, 0x34},
{0x08, 0x07, 0x00, 0x00, 0x68, 0x08, 0x05, 0x00, 0x00, 0x50, 0x01, 0x08, 0x00, 0x4c, 0x00, 0x00, 0x2c}, {0x08, 0x07, 0x00, 0x00, 0x68, 0x08, 0x05, 0x00, 0x00, 0x50, 0x01, 0x08, 0x00, 0x4c, 0x00, 0x00, 0x2c},

View file

@ -331,10 +331,6 @@ class mouse_m913 : public rd_mouse, protected rd_mouse_wireless {
std::vector<std::array<uint8_t, 17>> _s_keyboard_key_packets; std::vector<std::array<uint8_t, 17>> _s_keyboard_key_packets;
//usb data packets //usb data packets
/// Packets to map buttons to keyboard keys
static std::map< std::string, std::array<uint8_t, 17> > _c_keyboard_key_packets;
/// mapping buttons to keyboard keys TODO!: replace and remove
static uint8_t _c_data_unknown_1[9][17];
/// button mapping /// button mapping
static uint8_t _c_data_button_mapping[8][17]; static uint8_t _c_data_button_mapping[8][17];
/// DPI values /// DPI values

View file

@ -175,17 +175,24 @@ int mouse_m913::set_key_mapping( rd_profile profile, int key, std::string mappin
profile = rd_mouse::rd_profile::profile_1; profile = rd_mouse::rd_profile::profile_1;
// the M913 uses different keycodes, therefore the decoding is done here // the M913 uses different keycodes, therefore the decoding is done here
if( _c_keyboard_key_packets.find(mapping) != _c_keyboard_key_packets.end() ){ // keyboard key if( _c_keyboard_key_values.find(mapping) != _c_keyboard_key_values.end() ){ // keyboard key
// the button gets mapped as "default" // the button gets mapped as "default"
_s_keymap_data[rd_profile_to_m913_profile(profile)][key] = rd_mouse_wireless::_c_keycodes["default"]; _s_keymap_data[rd_profile_to_m913_profile(profile)][key] = rd_mouse_wireless::_c_keycodes["default"];
// and additional packets are sent // and additional packets are sent
_s_keyboard_key_packets.push_back(_c_keyboard_key_packets[mapping]); _s_keyboard_key_packets.push_back(_c_data_button_as_keyboard_key);
_s_keyboard_key_packets.back()[3] = _c_keyboard_key_buttons[key][0]; _s_keyboard_key_packets.back()[3] = _c_keyboard_key_buttons[key][0];
_s_keyboard_key_packets.back()[4] = _c_keyboard_key_buttons[key][1]; _s_keyboard_key_packets.back()[4] = _c_keyboard_key_buttons[key][1];
_s_keyboard_key_packets.back()[16] = _c_keyboard_key_buttons[key][2]; _s_keyboard_key_packets.back()[16] = _c_keyboard_key_buttons[key][2];
_s_keyboard_key_packets.back()[8] = _c_keyboard_key_values[mapping];
_s_keyboard_key_packets.back()[11] = _c_keyboard_key_values[mapping];
_s_keyboard_key_packets.back()[13] = _i_keyboard_key_checksum(_c_keyboard_key_values[mapping]);
}else if( rd_mouse_wireless::_c_keycodes.find(mapping) != rd_mouse_wireless::_c_keycodes.end() ){ // mouse buttons, special functions, ... }else if( rd_mouse_wireless::_c_keycodes.find(mapping) != rd_mouse_wireless::_c_keycodes.end() ){ // mouse buttons, special functions, ...
_s_keymap_data[rd_profile_to_m913_profile(profile)][key] = rd_mouse_wireless::_c_keycodes[mapping]; _s_keymap_data[rd_profile_to_m913_profile(profile)][key] = rd_mouse_wireless::_c_keycodes[mapping];

View file

@ -33,3 +33,11 @@ std::map< std::string, std::array<uint8_t, 4> > rd_mouse_wireless::_c_keycodes =
{ "none", { 0x00, 0x00, 0x00, 0x55 } }, { "none", { 0x00, 0x00, 0x00, 0x55 } },
{ "profile_switch", { 0x09, 0x00, 0x00, 0x4c } }, { "profile_switch", { 0x09, 0x00, 0x00, 0x4c } },
}; };
uint8_t rd_mouse_wireless::_i_keyboard_key_checksum(uint8_t scancode){
return (uint8_t)(0x91 - (uint8_t)(2 * scancode));
}
std::array<uint8_t, 17> rd_mouse_wireless::_c_data_button_as_keyboard_key = {
0x08, 0x07, 0x00, 0x01, 0x60, 0x08, 0x02, 0x81, 0x21, 0x00, 0x41, 0x21, 0x00, 0x4f, 0x00, 0x00, 0x88
};

View file

@ -34,6 +34,12 @@ class rd_mouse_wireless{
/// Values/keycodes of mouse buttons and special button functions /// Values/keycodes of mouse buttons and special button functions
static std::map< std::string, std::array<uint8_t, 4> > _c_keycodes; static std::map< std::string, std::array<uint8_t, 4> > _c_keycodes;
/// Computes the checksum used when mapping a button as a keyboard key
static uint8_t _i_keyboard_key_checksum(uint8_t scancode);
/// Used to map a button as a keyboard key
static std::array<uint8_t, 17> _c_data_button_as_keyboard_key;
}; };
#endif #endif