diff --git a/devices/orbweaver/orbweaver.go b/devices/orbweaver/orbweaver.go index 56da180..1ee2d2b 100644 --- a/devices/orbweaver/orbweaver.go +++ b/devices/orbweaver/orbweaver.go @@ -1,153 +1,153 @@ -package orbweaver - -import ( - "encoding/binary" - "io" - "os" - - "github.com/OrbTools/OrbCommon/gui" -) - -//BINDING Map of Default Keys -var BINDING = [...]byte{41, 2, 3, 4, 5, 15, 16, 17, 18, 19, 58, 30, 31, 32, 33, 42, 44, 45, 46, 47, 56, 103, 106, 108, 105, 57} - -//GUI gui definition for an orbweaver -var GUI = &gui.GUI{ - Pages: []*gui.Page{ - { - Hive: "MIP", - Name: "Grid", - Type: gui.PGrid, - Keys: []*gui.Key{ - { - KeyID: 0, - KeyName: "01", - }, { - KeyID: 1, - KeyName: "02", - }, { - KeyID: 2, - KeyName: "03", - }, { - KeyID: 3, - KeyName: "04", - }, { - KeyID: 4, - KeyName: "05", - }, { - KeyID: 5, - KeyName: "06", - }, { - KeyID: 6, - KeyName: "07", - }, { - KeyID: 7, - KeyName: "08", - }, { - KeyID: 8, - KeyName: "09", - }, { - KeyID: 9, - KeyName: "10", - }, { - KeyID: 10, - KeyName: "11", - }, { - KeyID: 11, - KeyName: "12", - }, { - KeyID: 12, - KeyName: "13", - }, { - KeyID: 13, - KeyName: "11", - }, { - KeyID: 14, - KeyName: "11", - }, { - KeyID: 15, - KeyName: "11", - }, { - KeyID: 16, - KeyName: "11", - }, { - KeyID: 17, - KeyName: "11", - }, { - KeyID: 18, - KeyName: "11", - }, { - KeyID: 19, - KeyName: "20", - }, - }, - }, { - Hive: "SIP", - Name: "Side Keys", - Type: gui.PList, - Keys: []*gui.Key{ - { - KeyID: 0, - KeyName: "Upper Button", - }, { - KeyID: 1, - KeyName: "DPad Up", - }, { - KeyID: 2, - KeyName: "DPad Right", - }, { - KeyID: 3, - KeyName: "DPad Left", - }, { - KeyID: 4, - KeyName: "DPad Down", - }, { - KeyID: 5, - KeyName: "Lower Button", - }, - }, - }, - }, -} - -//KeyMap singular keymap -type KeyMap struct { - Keymap [26]uint16 - Color [3]byte -} - -//KeyMaps a set of keymaps -type KeyMaps struct { - Maps [7]*KeyMap - Currentmap int - MCount int -} - -//PKM format for altering the keymap -type PKM struct { - MIP [20]uint16 - SIP [6]uint16 - COL [3]byte -} - -//LoadKM Load Orbmap KM structure -func LoadKM(file string) *KeyMap { - mapped := new(KeyMap) - of, _ := os.Open(file) - binary.Read(of, binary.LittleEndian, mapped) - return mapped -} - -//SavePKMKeymap saves an orb after edit -func SavePKMKeymap(mapped *PKM, file io.WriteCloser) { - binary.Write(file, binary.LittleEndian, mapped) - file.Close() -} - -//LoadPKMKeymap loads an orb for editing -func LoadPKMKeymap(file io.ReadCloser) interface{} { - mapped := new(PKM) - binary.Read(file, binary.LittleEndian, mapped) - file.Close() - return mapped -} +package orbweaver + +import ( + "encoding/binary" + "io" + "os" + + "github.com/OrbTools/OrbCommon/gui" +) + +//BINDING Map of Default Keys +var BINDING = [...]byte{41, 2, 3, 4, 5, 15, 16, 17, 18, 19, 58, 30, 31, 32, 33, 42, 44, 45, 46, 47, 56, 103, 106, 108, 105, 57} + +//GUI gui definition for an orbweaver +var GUI = &gui.GUI{ + Pages: []*gui.Page{ + { + Hive: "MIP", + Name: "Grid", + Type: gui.PGrid, + Keys: []*gui.Key{ + { + KeyID: 0, + KeyName: "01", + }, { + KeyID: 1, + KeyName: "02", + }, { + KeyID: 2, + KeyName: "03", + }, { + KeyID: 3, + KeyName: "04", + }, { + KeyID: 4, + KeyName: "05", + }, { + KeyID: 5, + KeyName: "06", + }, { + KeyID: 6, + KeyName: "07", + }, { + KeyID: 7, + KeyName: "08", + }, { + KeyID: 8, + KeyName: "09", + }, { + KeyID: 9, + KeyName: "10", + }, { + KeyID: 10, + KeyName: "11", + }, { + KeyID: 11, + KeyName: "12", + }, { + KeyID: 12, + KeyName: "13", + }, { + KeyID: 13, + KeyName: "11", + }, { + KeyID: 14, + KeyName: "11", + }, { + KeyID: 15, + KeyName: "11", + }, { + KeyID: 16, + KeyName: "11", + }, { + KeyID: 17, + KeyName: "11", + }, { + KeyID: 18, + KeyName: "11", + }, { + KeyID: 19, + KeyName: "20", + }, + }, + }, { + Hive: "SIP", + Name: "Side Keys", + Type: gui.PList, + Keys: []*gui.Key{ + { + KeyID: 0, + KeyName: "Upper Button", + }, { + KeyID: 1, + KeyName: "DPad Up", + }, { + KeyID: 2, + KeyName: "DPad Right", + }, { + KeyID: 3, + KeyName: "DPad Left", + }, { + KeyID: 4, + KeyName: "DPad Down", + }, { + KeyID: 5, + KeyName: "Lower Button", + }, + }, + }, + }, +} + +//KeyMap singular keymap +type KeyMap struct { + Keymap [26]uint16 + Color [3]byte +} + +//KeyMaps a set of keymaps +type KeyMaps struct { + Maps [7]*KeyMap + Currentmap int + MCount int +} + +//PKM format for altering the keymap +type PKM struct { + MIP [20]uint16 + SIP [6]uint16 + COL [3]byte +} + +//LoadKM Load Orbmap KM structure +func LoadKM(file string) *KeyMap { + mapped := new(KeyMap) + of, _ := os.Open(file) + binary.Read(of, binary.LittleEndian, mapped) + return mapped +} + +//SavePKMKeymap saves an orb after edit +func SavePKMKeymap(mapped *PKM, file io.WriteCloser) { + binary.Write(file, binary.LittleEndian, mapped) + file.Close() +} + +//LoadPKMKeymap loads an orb for editing +func LoadPKMKeymap(file io.ReadCloser) interface{} { + mapped := new(PKM) + binary.Read(file, binary.LittleEndian, mapped) + file.Close() + return mapped +} diff --git a/gui/gui.go b/gui/gui.go index 66ba0ce..516cee4 100644 --- a/gui/gui.go +++ b/gui/gui.go @@ -1,33 +1,33 @@ -package gui - -//PageType PGrid, PCircle or PList -type PageType int - -const ( - //PGrid Grid type (keypads) - PGrid PageType = iota - //PCircle type (joysticks) - PCircle - //PList List Type - PList -) - -//GUI a GUI tree -type GUI struct { - Pages []*Page -} - -//Page A page of a binding GUI -type Page struct { - Hive string - Name string - Keys []*Key - Type PageType -} - -//Key a keybind -type Key struct { - KeyID int - KeyName string - Default uint16 -} +package gui + +//PageType PGrid, PCircle or PList +type PageType int + +const ( + //PGrid Grid type (keypads) + PGrid PageType = iota + //PCircle type (joysticks) + PCircle + //PList List Type + PList +) + +//GUI a GUI tree +type GUI struct { + Pages []*Page +} + +//Page A page of a binding GUI +type Page struct { + Hive string + Name string + Keys []*Key + Type PageType +} + +//Key a keybind +type Key struct { + KeyID int + KeyName string + Default uint16 +} diff --git a/hid/data/keycode_data.inc b/hid/data/keycode_data.inc index cd837e1..1baa0ed 100644 --- a/hid/data/keycode_data.inc +++ b/hid/data/keycode_data.inc @@ -1,240 +1,240 @@ -DOM_CODE_DECLARATION { - DOM_CODE(0x000000, 0x0000, 0x0000, 0x0000, 0xffff, NULL, NONE), - DOM_CODE(0x000010, 0x0000, 0x0000, 0x0000, 0xffff, "Hyper", HYPER), - DOM_CODE(0x000011, 0x0000, 0x0000, 0x0000, 0xffff, "Super", SUPER), - DOM_CODE(0x000012, 0x0000, 0x0000, 0x0000, 0xffff, "Fn", FN), - DOM_CODE(0x000013, 0x0000, 0x0000, 0x0000, 0xffff, "FnLock", FN_LOCK), - DOM_CODE(0x000014, 0x0000, 0x0000, 0x0000, 0xffff, "Suspend", SUSPEND), - DOM_CODE(0x000015, 0x0000, 0x0000, 0x0000, 0xffff, "Resume", RESUME), - DOM_CODE(0x000016, 0x0000, 0x0000, 0x0000, 0xffff, "Turbo", TURBO), - DOM_CODE(0x000017, 0x0279, 0x0281, 0x0000, 0xffff, "PrivacyScreenToggle", PRIVACY_SCREEN_TOGGLE), - DOM_CODE(0x010082, 0x008e, 0x0096, 0xe05f, 0xffff, "Sleep", SLEEP), - DOM_CODE(0x010083, 0x008f, 0x0097, 0xe063, 0xffff, "WakeUp", WAKE_UP), - DOM_CODE(0x0100b5, 0x00e3, 0x00eb, 0x0000, 0xffff, "DisplayToggleIntExt", DISPLAY_TOGGLE_INT_EXT), - DOM_CODE(0x070000, 0x0000, 0x0000, 0x0000, 0xffff, NULL, USB_RESERVED), - DOM_CODE(0x070001, 0x0000, 0x0000, 0x00ff, 0xffff, NULL, USB_ERROR_ROLL_OVER), - DOM_CODE(0x070002, 0x0000, 0x0000, 0x00fc, 0xffff, NULL, USB_POST_FAIL), - DOM_CODE(0x070003, 0x0000, 0x0000, 0x0000, 0xffff, NULL, USB_ERROR_UNDEFINED), - DOM_CODE(0x070004, 0x001e, 0x0026, 0x001e, 0x0000, "KeyA", US_A), - DOM_CODE(0x070005, 0x0030, 0x0038, 0x0030, 0x000b, "KeyB", US_B), - DOM_CODE(0x070006, 0x002e, 0x0036, 0x002e, 0x0008, "KeyC", US_C), - DOM_CODE(0x070007, 0x0020, 0x0028, 0x0020, 0x0002, "KeyD", US_D), - DOM_CODE(0x070008, 0x0012, 0x001a, 0x0012, 0x000e, "KeyE", US_E), - DOM_CODE(0x070009, 0x0021, 0x0029, 0x0021, 0x0003, "KeyF", US_F), - DOM_CODE(0x07000a, 0x0022, 0x002a, 0x0022, 0x0005, "KeyG", US_G), - DOM_CODE(0x07000b, 0x0023, 0x002b, 0x0023, 0x0004, "KeyH", US_H), - DOM_CODE(0x07000c, 0x0017, 0x001f, 0x0017, 0x0022, "KeyI", US_I), - DOM_CODE(0x07000d, 0x0024, 0x002c, 0x0024, 0x0026, "KeyJ", US_J), - DOM_CODE(0x07000e, 0x0025, 0x002d, 0x0025, 0x0028, "KeyK", US_K), - DOM_CODE(0x07000f, 0x0026, 0x002e, 0x0026, 0x0025, "KeyL", US_L), - DOM_CODE(0x070010, 0x0032, 0x003a, 0x0032, 0x002e, "KeyM", US_M), - DOM_CODE(0x070011, 0x0031, 0x0039, 0x0031, 0x002d, "KeyN", US_N), - DOM_CODE(0x070012, 0x0018, 0x0020, 0x0018, 0x001f, "KeyO", US_O), - DOM_CODE(0x070013, 0x0019, 0x0021, 0x0019, 0x0023, "KeyP", US_P), - DOM_CODE(0x070014, 0x0010, 0x0018, 0x0010, 0x000c, "KeyQ", US_Q), - DOM_CODE(0x070015, 0x0013, 0x001b, 0x0013, 0x000f, "KeyR", US_R), - DOM_CODE(0x070016, 0x001f, 0x0027, 0x001f, 0x0001, "KeyS", US_S), - DOM_CODE(0x070017, 0x0014, 0x001c, 0x0014, 0x0011, "KeyT", US_T), - DOM_CODE(0x070018, 0x0016, 0x001e, 0x0016, 0x0020, "KeyU", US_U), - DOM_CODE(0x070019, 0x002f, 0x0037, 0x002f, 0x0009, "KeyV", US_V), - DOM_CODE(0x07001a, 0x0011, 0x0019, 0x0011, 0x000d, "KeyW", US_W), - DOM_CODE(0x07001b, 0x002d, 0x0035, 0x002d, 0x0007, "KeyX", US_X), - DOM_CODE(0x07001c, 0x0015, 0x001d, 0x0015, 0x0010, "KeyY", US_Y), - DOM_CODE(0x07001d, 0x002c, 0x0034, 0x002c, 0x0006, "KeyZ", US_Z), - DOM_CODE(0x07001e, 0x0002, 0x000a, 0x0002, 0x0012, "Digit1", DIGIT1), - DOM_CODE(0x07001f, 0x0003, 0x000b, 0x0003, 0x0013, "Digit2", DIGIT2), - DOM_CODE(0x070020, 0x0004, 0x000c, 0x0004, 0x0014, "Digit3", DIGIT3), - DOM_CODE(0x070021, 0x0005, 0x000d, 0x0005, 0x0015, "Digit4", DIGIT4), - DOM_CODE(0x070022, 0x0006, 0x000e, 0x0006, 0x0017, "Digit5", DIGIT5), - DOM_CODE(0x070023, 0x0007, 0x000f, 0x0007, 0x0016, "Digit6", DIGIT6), - DOM_CODE(0x070024, 0x0008, 0x0010, 0x0008, 0x001a, "Digit7", DIGIT7), - DOM_CODE(0x070025, 0x0009, 0x0011, 0x0009, 0x001c, "Digit8", DIGIT8), - DOM_CODE(0x070026, 0x000a, 0x0012, 0x000a, 0x0019, "Digit9", DIGIT9), - DOM_CODE(0x070027, 0x000b, 0x0013, 0x000b, 0x001d, "Digit0", DIGIT0), - DOM_CODE(0x070028, 0x001c, 0x0024, 0x001c, 0x0024, "Enter", ENTER), - DOM_CODE(0x070029, 0x0001, 0x0009, 0x0001, 0x0035, "Escape", ESCAPE), - DOM_CODE(0x07002a, 0x000e, 0x0016, 0x000e, 0x0033, "Backspace", BACKSPACE), - DOM_CODE(0x07002b, 0x000f, 0x0017, 0x000f, 0x0030, "Tab", TAB), - DOM_CODE(0x07002c, 0x0039, 0x0041, 0x0039, 0x0031, "Space", SPACE), - DOM_CODE(0x07002d, 0x000c, 0x0014, 0x000c, 0x001b, "Minus", MINUS), - DOM_CODE(0x07002e, 0x000d, 0x0015, 0x000d, 0x0018, "Equal", EQUAL), - DOM_CODE(0x07002f, 0x001a, 0x0022, 0x001a, 0x0021, "BracketLeft", BRACKET_LEFT), - DOM_CODE(0x070030, 0x001b, 0x0023, 0x001b, 0x001e, "BracketRight", BRACKET_RIGHT), - DOM_CODE(0x070031, 0x002b, 0x0033, 0x002b, 0x002a, "Backslash", BACKSLASH), - DOM_CODE(0x070033, 0x0027, 0x002f, 0x0027, 0x0029, "Semicolon", SEMICOLON), - DOM_CODE(0x070034, 0x0028, 0x0030, 0x0028, 0x0027, "Quote", QUOTE), - DOM_CODE(0x070035, 0x0029, 0x0031, 0x0029, 0x0032, "Backquote", BACKQUOTE), - DOM_CODE(0x070036, 0x0033, 0x003b, 0x0033, 0x002b, "Comma", COMMA), - DOM_CODE(0x070037, 0x0034, 0x003c, 0x0034, 0x002f, "Period", PERIOD), - DOM_CODE(0x070038, 0x0035, 0x003d, 0x0035, 0x002c, "Slash", SLASH), - DOM_CODE(0x070039, 0x003a, 0x0042, 0x003a, 0x0039, "CapsLock", CAPS_LOCK), - DOM_CODE(0x07003a, 0x003b, 0x0043, 0x003b, 0x007a, "F1", F1), - DOM_CODE(0x07003b, 0x003c, 0x0044, 0x003c, 0x0078, "F2", F2), - DOM_CODE(0x07003c, 0x003d, 0x0045, 0x003d, 0x0063, "F3", F3), - DOM_CODE(0x07003d, 0x003e, 0x0046, 0x003e, 0x0076, "F4", F4), - DOM_CODE(0x07003e, 0x003f, 0x0047, 0x003f, 0x0060, "F5", F5), - DOM_CODE(0x07003f, 0x0040, 0x0048, 0x0040, 0x0061, "F6", F6), - DOM_CODE(0x070040, 0x0041, 0x0049, 0x0041, 0x0062, "F7", F7), - DOM_CODE(0x070041, 0x0042, 0x004a, 0x0042, 0x0064, "F8", F8), - DOM_CODE(0x070042, 0x0043, 0x004b, 0x0043, 0x0065, "F9", F9), - DOM_CODE(0x070043, 0x0044, 0x004c, 0x0044, 0x006d, "F10", F10), - DOM_CODE(0x070044, 0x0057, 0x005f, 0x0057, 0x0067, "F11", F11), - DOM_CODE(0x070045, 0x0058, 0x0060, 0x0058, 0x006f, "F12", F12), - DOM_CODE(0x070046, 0x0063, 0x006b, 0xe037, 0xffff, "PrintScreen", PRINT_SCREEN), - DOM_CODE(0x070047, 0x0046, 0x004e, 0x0046, 0xffff, "ScrollLock", SCROLL_LOCK), - DOM_CODE(0x070048, 0x0077, 0x007f, 0x0045, 0xffff, "Pause", PAUSE), - DOM_CODE(0x070049, 0x006e, 0x0076, 0xe052, 0x0072, "Insert", INSERT), - DOM_CODE(0x07004a, 0x0066, 0x006e, 0xe047, 0x0073, "Home", HOME), - DOM_CODE(0x07004b, 0x0068, 0x0070, 0xe049, 0x0074, "PageUp", PAGE_UP), - DOM_CODE(0x07004c, 0x006f, 0x0077, 0xe053, 0x0075, "Delete", DEL), - DOM_CODE(0x07004d, 0x006b, 0x0073, 0xe04f, 0x0077, "End", END), - DOM_CODE(0x07004e, 0x006d, 0x0075, 0xe051, 0x0079, "PageDown", PAGE_DOWN), - DOM_CODE(0x07004f, 0x006a, 0x0072, 0xe04d, 0x007c, "ArrowRight", ARROW_RIGHT), - DOM_CODE(0x070050, 0x0069, 0x0071, 0xe04b, 0x007b, "ArrowLeft", ARROW_LEFT), - DOM_CODE(0x070051, 0x006c, 0x0074, 0xe050, 0x007d, "ArrowDown", ARROW_DOWN), - DOM_CODE(0x070052, 0x0067, 0x006f, 0xe048, 0x007e, "ArrowUp", ARROW_UP), - DOM_CODE(0x070053, 0x0045, 0x004d, 0xe045, 0x0047, "NumLock", NUM_LOCK), - DOM_CODE(0x070054, 0x0062, 0x006a, 0xe035, 0x004b, "NumpadDivide", NUMPAD_DIVIDE), - DOM_CODE(0x070055, 0x0037, 0x003f, 0x0037, 0x0043, "NumpadMultiply", NUMPAD_MULTIPLY), - DOM_CODE(0x070056, 0x004a, 0x0052, 0x004a, 0x004e, "NumpadSubtract", NUMPAD_SUBTRACT), - DOM_CODE(0x070057, 0x004e, 0x0056, 0x004e, 0x0045, "NumpadAdd", NUMPAD_ADD), - DOM_CODE(0x070058, 0x0060, 0x0068, 0xe01c, 0x004c, "NumpadEnter", NUMPAD_ENTER), - DOM_CODE(0x070059, 0x004f, 0x0057, 0x004f, 0x0053, "Numpad1", NUMPAD1), - DOM_CODE(0x07005a, 0x0050, 0x0058, 0x0050, 0x0054, "Numpad2", NUMPAD2), - DOM_CODE(0x07005b, 0x0051, 0x0059, 0x0051, 0x0055, "Numpad3", NUMPAD3), - DOM_CODE(0x07005c, 0x004b, 0x0053, 0x004b, 0x0056, "Numpad4", NUMPAD4), - DOM_CODE(0x07005d, 0x004c, 0x0054, 0x004c, 0x0057, "Numpad5", NUMPAD5), - DOM_CODE(0x07005e, 0x004d, 0x0055, 0x004d, 0x0058, "Numpad6", NUMPAD6), - DOM_CODE(0x07005f, 0x0047, 0x004f, 0x0047, 0x0059, "Numpad7", NUMPAD7), - DOM_CODE(0x070060, 0x0048, 0x0050, 0x0048, 0x005b, "Numpad8", NUMPAD8), - DOM_CODE(0x070061, 0x0049, 0x0051, 0x0049, 0x005c, "Numpad9", NUMPAD9), - DOM_CODE(0x070062, 0x0052, 0x005a, 0x0052, 0x0052, "Numpad0", NUMPAD0), - DOM_CODE(0x070063, 0x0053, 0x005b, 0x0053, 0x0041, "NumpadDecimal", NUMPAD_DECIMAL), - DOM_CODE(0x070064, 0x0056, 0x005e, 0x0056, 0x000a, "IntlBackslash", INTL_BACKSLASH), - DOM_CODE(0x070065, 0x007f, 0x0087, 0xe05d, 0x006e, "ContextMenu", CONTEXT_MENU), - DOM_CODE(0x070066, 0x0074, 0x007c, 0xe05e, 0xffff, "Power", POWER), - DOM_CODE(0x070067, 0x0075, 0x007d, 0x0059, 0x0051, "NumpadEqual", NUMPAD_EQUAL), - DOM_CODE(0x070068, 0x00b7, 0x00bf, 0x0064, 0x0069, "F13", F13), - DOM_CODE(0x070069, 0x00b8, 0x00c0, 0x0065, 0x006b, "F14", F14), - DOM_CODE(0x07006a, 0x00b9, 0x00c1, 0x0066, 0x0071, "F15", F15), - DOM_CODE(0x07006b, 0x00ba, 0x00c2, 0x0067, 0x006a, "F16", F16), - DOM_CODE(0x07006c, 0x00bb, 0x00c3, 0x0068, 0x0040, "F17", F17), - DOM_CODE(0x07006d, 0x00bc, 0x00c4, 0x0069, 0x004f, "F18", F18), - DOM_CODE(0x07006e, 0x00bd, 0x00c5, 0x006a, 0x0050, "F19", F19), - DOM_CODE(0x07006f, 0x00be, 0x00c6, 0x006b, 0x005a, "F20", F20), - DOM_CODE(0x070070, 0x00bf, 0x00c7, 0x006c, 0xffff, "F21", F21), - DOM_CODE(0x070071, 0x00c0, 0x00c8, 0x006d, 0xffff, "F22", F22), - DOM_CODE(0x070072, 0x00c1, 0x00c9, 0x006e, 0xffff, "F23", F23), - DOM_CODE(0x070073, 0x00c2, 0x00ca, 0x0076, 0xffff, "F24", F24), - DOM_CODE(0x070074, 0x0086, 0x008e, 0x0000, 0xffff, "Open", OPEN), - DOM_CODE(0x070075, 0x008a, 0x0092, 0xe03b, 0xffff, "Help", HELP), - DOM_CODE(0x070077, 0x0084, 0x008c, 0x0000, 0xffff, "Select", SELECT), - DOM_CODE(0x070079, 0x0081, 0x0089, 0x0000, 0xffff, "Again", AGAIN), - DOM_CODE(0x07007a, 0x0083, 0x008b, 0xe008, 0xffff, "Undo", UNDO), - DOM_CODE(0x07007b, 0x0089, 0x0091, 0xe017, 0xffff, "Cut", CUT), - DOM_CODE(0x07007c, 0x0085, 0x008d, 0xe018, 0xffff, "Copy", COPY), - DOM_CODE(0x07007d, 0x0087, 0x008f, 0xe00a, 0xffff, "Paste", PASTE), - DOM_CODE(0x07007e, 0x0088, 0x0090, 0x0000, 0xffff, "Find", FIND), - DOM_CODE(0x07007f, 0x0071, 0x0079, 0xe020, 0x004a, "AudioVolumeMute", VOLUME_MUTE), - DOM_CODE(0x070080, 0x0073, 0x007b, 0xe030, 0x0048, "AudioVolumeUp", VOLUME_UP), - DOM_CODE(0x070081, 0x0072, 0x007a, 0xe02e, 0x0049, "AudioVolumeDown", VOLUME_DOWN), - DOM_CODE(0x070085, 0x0079, 0x0081, 0x007e, 0x005f, "NumpadComma", NUMPAD_COMMA), - DOM_CODE(0x070087, 0x0059, 0x0061, 0x0073, 0x005e, "IntlRo", INTL_RO), - DOM_CODE(0x070088, 0x005d, 0x0065, 0x0070, 0xffff, "KanaMode", KANA_MODE), - DOM_CODE(0x070089, 0x007c, 0x0084, 0x007d, 0x005d, "IntlYen", INTL_YEN), - DOM_CODE(0x07008a, 0x005c, 0x0064, 0x0079, 0xffff, "Convert", CONVERT), - DOM_CODE(0x07008b, 0x005e, 0x0066, 0x007b, 0xffff, "NonConvert", NON_CONVERT), - DOM_CODE(0x070090, 0x007a, 0x0082, 0x0072, 0x0068, "Lang1", LANG1), - DOM_CODE(0x070091, 0x007b, 0x0083, 0x0071, 0x0066, "Lang2", LANG2), - DOM_CODE(0x070092, 0x005a, 0x0062, 0x0078, 0xffff, "Lang3", LANG3), - DOM_CODE(0x070093, 0x005b, 0x0063, 0x0077, 0xffff, "Lang4", LANG4), - DOM_CODE(0x070094, 0x0055, 0x005d, 0x0000, 0xffff, "Lang5", LANG5), - DOM_CODE(0x07009b, 0x0000, 0x0000, 0x0000, 0xffff, "Abort", ABORT), - DOM_CODE(0x0700a3, 0x0000, 0x0000, 0x0000, 0xffff, "Props", PROPS), - DOM_CODE(0x0700b6, 0x00b3, 0x00bb, 0x0000, 0xffff, "NumpadParenLeft", NUMPAD_PAREN_LEFT), - DOM_CODE(0x0700b7, 0x00b4, 0x00bc, 0x0000, 0xffff, "NumpadParenRight", NUMPAD_PAREN_RIGHT), - DOM_CODE(0x0700bb, 0x0000, 0x0000, 0x0000, 0xffff, "NumpadBackspace", NUMPAD_BACKSPACE), - DOM_CODE(0x0700d0, 0x0000, 0x0000, 0x0000, 0xffff, "NumpadMemoryStore", NUMPAD_MEMORY_STORE), - DOM_CODE(0x0700d1, 0x0000, 0x0000, 0x0000, 0xffff, "NumpadMemoryRecall", NUMPAD_MEMORY_RECALL), - DOM_CODE(0x0700d2, 0x0000, 0x0000, 0x0000, 0xffff, "NumpadMemoryClear", NUMPAD_MEMORY_CLEAR), - DOM_CODE(0x0700d3, 0x0000, 0x0000, 0x0000, 0xffff, "NumpadMemoryAdd", NUMPAD_MEMORY_ADD), - DOM_CODE(0x0700d4, 0x0000, 0x0000, 0x0000, 0xffff, "NumpadMemorySubtract", NUMPAD_MEMORY_SUBTRACT), - DOM_CODE(0x0700d7, 0x0076, 0x007e, 0x0000, 0xffff, NULL, NUMPAD_SIGN_CHANGE), - DOM_CODE(0x0700d8, 0x0000, 0x0000, 0x0000, 0xffff, "NumpadClear", NUMPAD_CLEAR), - DOM_CODE(0x0700d9, 0x0000, 0x0000, 0x0000, 0xffff, "NumpadClearEntry", NUMPAD_CLEAR_ENTRY), - DOM_CODE(0x0700e0, 0x001d, 0x0025, 0x001d, 0x003b, "ControlLeft", CONTROL_LEFT), - DOM_CODE(0x0700e1, 0x002a, 0x0032, 0x002a, 0x0038, "ShiftLeft", SHIFT_LEFT), - DOM_CODE(0x0700e2, 0x0038, 0x0040, 0x0038, 0x003a, "AltLeft", ALT_LEFT), - DOM_CODE(0x0700e3, 0x007d, 0x0085, 0xe05b, 0x0037, "MetaLeft", META_LEFT), - DOM_CODE(0x0700e4, 0x0061, 0x0069, 0xe01d, 0x003e, "ControlRight", CONTROL_RIGHT), - DOM_CODE(0x0700e5, 0x0036, 0x003e, 0x0036, 0x003c, "ShiftRight", SHIFT_RIGHT), - DOM_CODE(0x0700e6, 0x0064, 0x006c, 0xe038, 0x003d, "AltRight", ALT_RIGHT), - DOM_CODE(0x0700e7, 0x007e, 0x0086, 0xe05c, 0x0036, "MetaRight", META_RIGHT), - DOM_CODE(0x0c0060, 0x0166, 0x016e, 0x0000, 0xffff, NULL, INFO), - DOM_CODE(0x0c0061, 0x0172, 0x017a, 0x0000, 0xffff, NULL, CLOSED_CAPTION_TOGGLE), - DOM_CODE(0x0c006f, 0x00e1, 0x00e9, 0x0000, 0xffff, "BrightnessUp", BRIGHTNESS_UP), - DOM_CODE(0x0c0070, 0x00e0, 0x00e8, 0x0000, 0xffff, "BrightnessDown", BRIGHTNESS_DOWN), - DOM_CODE(0x0c0072, 0x01af, 0x01b7, 0x0000, 0xffff, NULL, BRIGHTNESS_TOGGLE), - DOM_CODE(0x0c0073, 0x0250, 0x0258, 0x0000, 0xffff, NULL, BRIGHTNESS_MINIMIUM), - DOM_CODE(0x0c0074, 0x0251, 0x0259, 0x0000, 0xffff, NULL, BRIGHTNESS_MAXIMUM), - DOM_CODE(0x0c0075, 0x00f4, 0x00fc, 0x0000, 0xffff, NULL, BRIGHTNESS_AUTO), - DOM_CODE(0x0c0079, 0x00e6, 0x00ee, 0x0000, 0xffff, NULL, KBD_ILLUM_UP), - DOM_CODE(0x0c007a, 0x00e5, 0x00ed, 0x0000, 0xffff, NULL, KBD_ILLUM_DOWN), - DOM_CODE(0x0c0083, 0x0195, 0x019d, 0x0000, 0xffff, NULL, MEDIA_LAST), - DOM_CODE(0x0c008c, 0x00a9, 0x00b1, 0x0000, 0xffff, NULL, LAUNCH_PHONE), - DOM_CODE(0x0c008d, 0x016a, 0x0172, 0x0000, 0xffff, NULL, PROGRAM_GUIDE), - DOM_CODE(0x0c0094, 0x00ae, 0x00b6, 0x0000, 0xffff, NULL, EXIT), - DOM_CODE(0x0c009c, 0x019a, 0x01a2, 0x0000, 0xffff, NULL, CHANNEL_UP), - DOM_CODE(0x0c009d, 0x019b, 0x01a3, 0x0000, 0xffff, NULL, CHANNEL_DOWN), - DOM_CODE(0x0c00b0, 0x00cf, 0x00d7, 0x0000, 0xffff, "MediaPlay", MEDIA_PLAY), - DOM_CODE(0x0c00b1, 0x00c9, 0x00d1, 0x0000, 0xffff, "MediaPause", MEDIA_PAUSE), - DOM_CODE(0x0c00b2, 0x00a7, 0x00af, 0x0000, 0xffff, "MediaRecord", MEDIA_RECORD), - DOM_CODE(0x0c00b3, 0x00d0, 0x00d8, 0x0000, 0xffff, "MediaFastForward", MEDIA_FAST_FORWARD), - DOM_CODE(0x0c00b4, 0x00a8, 0x00b0, 0x0000, 0xffff, "MediaRewind", MEDIA_REWIND), - DOM_CODE(0x0c00b5, 0x00a3, 0x00ab, 0xe019, 0xffff, "MediaTrackNext", MEDIA_TRACK_NEXT), - DOM_CODE(0x0c00b6, 0x00a5, 0x00ad, 0xe010, 0xffff, "MediaTrackPrevious", MEDIA_TRACK_PREVIOUS), - DOM_CODE(0x0c00b7, 0x00a6, 0x00ae, 0xe024, 0xffff, "MediaStop", MEDIA_STOP), - DOM_CODE(0x0c00b8, 0x00a1, 0x00a9, 0xe02c, 0xffff, "Eject", EJECT), - DOM_CODE(0x0c00cd, 0x00a4, 0x00ac, 0xe022, 0xffff, "MediaPlayPause", MEDIA_PLAY_PAUSE), - DOM_CODE(0x0c00cf, 0x0246, 0x024e, 0x0000, 0xffff, NULL, SPEECH_INPUT_TOGGLE), - DOM_CODE(0x0c00e5, 0x00d1, 0x00d9, 0x0000, 0xffff, NULL, BASS_BOOST), - DOM_CODE(0x0c0183, 0x00ab, 0x00b3, 0xe06d, 0xffff, "MediaSelect", MEDIA_SELECT), - DOM_CODE(0x0c0184, 0x01a5, 0x01ad, 0x0000, 0xffff, NULL, LAUNCH_WORD_PROCESSOR), - DOM_CODE(0x0c0186, 0x01a7, 0x01af, 0x0000, 0xffff, NULL, LAUNCH_SPREADSHEET), - DOM_CODE(0x0c018a, 0x009b, 0x00a3, 0xe06c, 0xffff, "LaunchMail", LAUNCH_MAIL), - DOM_CODE(0x0c018d, 0x01ad, 0x01b5, 0x0000, 0xffff, NULL, LAUNCH_CONTACTS), - DOM_CODE(0x0c018e, 0x018d, 0x0195, 0x0000, 0xffff, NULL, LAUNCH_CALENDAR), - DOM_CODE(0x0c0192, 0x008c, 0x0094, 0xe021, 0xffff, "LaunchApp2", LAUNCH_APP2), - DOM_CODE(0x0c0194, 0x0090, 0x0098, 0xe06b, 0xffff, "LaunchApp1", LAUNCH_APP1), - DOM_CODE(0x0c0196, 0x0096, 0x009e, 0x0000, 0xffff, NULL, LAUNCH_INTERNET_BROWSER), - DOM_CODE(0x0c019C, 0x01b1, 0x01b9, 0x0000, 0xffff, NULL, LOG_OFF), - DOM_CODE(0x0c019e, 0x0098, 0x00a0, 0x0000, 0xffff, NULL, LOCK_SCREEN), - DOM_CODE(0x0c019f, 0x0243, 0x024b, 0x0000, 0xffff, "LaunchControlPanel", LAUNCH_CONTROL_PANEL), - DOM_CODE(0x0c01a2, 0x0244, 0x024c, 0x0000, 0xffff, "SelectTask", SELECT_TASK), - DOM_CODE(0x0c01a7, 0x00eb, 0x00f3, 0x0000, 0xffff, NULL, LAUNCH_DOCUMENTS), - DOM_CODE(0x0c01ab, 0x01b0, 0x01b8, 0x0000, 0xffff, NULL, SPELL_CHECK), - DOM_CODE(0x0c01ae, 0x0176, 0x017e, 0x0000, 0xffff, NULL, LAUNCH_KEYBOARD_LAYOUT), - DOM_CODE(0x0c01b1, 0x0245, 0x024d, 0x0000, 0xffff, "LaunchScreenSaver", LAUNCH_SCREEN_SAVER), - DOM_CODE(0x0c01cb, 0x0247, 0x024f, 0x0000, 0xffff, "LaunchAssistant", LAUNCH_ASSISTANT), - DOM_CODE(0x0c01b7, 0x0188, 0x0190, 0x0000, 0xffff, NULL, LAUNCH_AUDIO_BROWSER), - DOM_CODE(0x0c0201, 0x00b5, 0x00bd, 0x0000, 0xffff, NULL, NEW), - DOM_CODE(0x0c0203, 0x00ce, 0x00d6, 0x0000, 0xffff, NULL, CLOSE), - DOM_CODE(0x0c0207, 0x00ea, 0x00f2, 0x0000, 0xffff, NULL, SAVE), - DOM_CODE(0x0c0208, 0x00d2, 0x00da, 0x0000, 0xffff, NULL, PRINT), - DOM_CODE(0x0c0221, 0x00d9, 0x00e1, 0xe065, 0xffff, "BrowserSearch", BROWSER_SEARCH), - DOM_CODE(0x0c0223, 0x00ac, 0x00b4, 0xe032, 0xffff, "BrowserHome", BROWSER_HOME), - DOM_CODE(0x0c0224, 0x009e, 0x00a6, 0xe06a, 0xffff, "BrowserBack", BROWSER_BACK), - DOM_CODE(0x0c0225, 0x009f, 0x00a7, 0xe069, 0xffff, "BrowserForward", BROWSER_FORWARD), - DOM_CODE(0x0c0226, 0x0080, 0x0088, 0xe068, 0xffff, "BrowserStop", BROWSER_STOP), - DOM_CODE(0x0c0227, 0x00ad, 0x00b5, 0xe067, 0xffff, "BrowserRefresh", BROWSER_REFRESH), - DOM_CODE(0x0c022a, 0x009c, 0x00a4, 0xe066, 0xffff, "BrowserFavorites", BROWSER_FAVORITES), - DOM_CODE(0x0c022d, 0x01a2, 0x01aa, 0x0000, 0xffff, NULL, ZOOM_IN), - DOM_CODE(0x0c022e, 0x01a3, 0x01ab, 0x0000, 0xffff, NULL, ZOOM_OUT), - DOM_CODE(0x0c0232, 0x0174, 0x017c, 0x0000, 0xffff, "ZoomToggle", ZOOM_TOGGLE), - DOM_CODE(0x0c0279, 0x00b6, 0x00be, 0x0000, 0xffff, NULL, REDO), - DOM_CODE(0x0c0289, 0x00e8, 0x00f0, 0x0000, 0xffff, "MailReply", MAIL_REPLY), - DOM_CODE(0x0c028b, 0x00e9, 0x00f1, 0x0000, 0xffff, "MailForward", MAIL_FORWARD), - DOM_CODE(0x0c028c, 0x00e7, 0x00ef, 0x0000, 0xffff, "MailSend", MAIL_SEND), - DOM_CODE(0x0c029d, 0x0248, 0x0250, 0x0000, 0xffff, "KeyboardLayoutSelect", KEYBOARD_LAYOUT_SELECT), - DOM_CODE(0x0c029f, 0x0078, 0x0080, 0x0000, 0xffff, "ShowAllWindows", SHOW_ALL_WINDOWS), +DOM_CODE_DECLARATION { + DOM_CODE(0x000000, 0x0000, 0x0000, 0x0000, 0xffff, NULL, NONE), + DOM_CODE(0x000010, 0x0000, 0x0000, 0x0000, 0xffff, "Hyper", HYPER), + DOM_CODE(0x000011, 0x0000, 0x0000, 0x0000, 0xffff, "Super", SUPER), + DOM_CODE(0x000012, 0x0000, 0x0000, 0x0000, 0xffff, "Fn", FN), + DOM_CODE(0x000013, 0x0000, 0x0000, 0x0000, 0xffff, "FnLock", FN_LOCK), + DOM_CODE(0x000014, 0x0000, 0x0000, 0x0000, 0xffff, "Suspend", SUSPEND), + DOM_CODE(0x000015, 0x0000, 0x0000, 0x0000, 0xffff, "Resume", RESUME), + DOM_CODE(0x000016, 0x0000, 0x0000, 0x0000, 0xffff, "Turbo", TURBO), + DOM_CODE(0x000017, 0x0279, 0x0281, 0x0000, 0xffff, "PrivacyScreenToggle", PRIVACY_SCREEN_TOGGLE), + DOM_CODE(0x010082, 0x008e, 0x0096, 0xe05f, 0xffff, "Sleep", SLEEP), + DOM_CODE(0x010083, 0x008f, 0x0097, 0xe063, 0xffff, "WakeUp", WAKE_UP), + DOM_CODE(0x0100b5, 0x00e3, 0x00eb, 0x0000, 0xffff, "DisplayToggleIntExt", DISPLAY_TOGGLE_INT_EXT), + DOM_CODE(0x070000, 0x0000, 0x0000, 0x0000, 0xffff, NULL, USB_RESERVED), + DOM_CODE(0x070001, 0x0000, 0x0000, 0x00ff, 0xffff, NULL, USB_ERROR_ROLL_OVER), + DOM_CODE(0x070002, 0x0000, 0x0000, 0x00fc, 0xffff, NULL, USB_POST_FAIL), + DOM_CODE(0x070003, 0x0000, 0x0000, 0x0000, 0xffff, NULL, USB_ERROR_UNDEFINED), + DOM_CODE(0x070004, 0x001e, 0x0026, 0x001e, 0x0000, "KeyA", US_A), + DOM_CODE(0x070005, 0x0030, 0x0038, 0x0030, 0x000b, "KeyB", US_B), + DOM_CODE(0x070006, 0x002e, 0x0036, 0x002e, 0x0008, "KeyC", US_C), + DOM_CODE(0x070007, 0x0020, 0x0028, 0x0020, 0x0002, "KeyD", US_D), + DOM_CODE(0x070008, 0x0012, 0x001a, 0x0012, 0x000e, "KeyE", US_E), + DOM_CODE(0x070009, 0x0021, 0x0029, 0x0021, 0x0003, "KeyF", US_F), + DOM_CODE(0x07000a, 0x0022, 0x002a, 0x0022, 0x0005, "KeyG", US_G), + DOM_CODE(0x07000b, 0x0023, 0x002b, 0x0023, 0x0004, "KeyH", US_H), + DOM_CODE(0x07000c, 0x0017, 0x001f, 0x0017, 0x0022, "KeyI", US_I), + DOM_CODE(0x07000d, 0x0024, 0x002c, 0x0024, 0x0026, "KeyJ", US_J), + DOM_CODE(0x07000e, 0x0025, 0x002d, 0x0025, 0x0028, "KeyK", US_K), + DOM_CODE(0x07000f, 0x0026, 0x002e, 0x0026, 0x0025, "KeyL", US_L), + DOM_CODE(0x070010, 0x0032, 0x003a, 0x0032, 0x002e, "KeyM", US_M), + DOM_CODE(0x070011, 0x0031, 0x0039, 0x0031, 0x002d, "KeyN", US_N), + DOM_CODE(0x070012, 0x0018, 0x0020, 0x0018, 0x001f, "KeyO", US_O), + DOM_CODE(0x070013, 0x0019, 0x0021, 0x0019, 0x0023, "KeyP", US_P), + DOM_CODE(0x070014, 0x0010, 0x0018, 0x0010, 0x000c, "KeyQ", US_Q), + DOM_CODE(0x070015, 0x0013, 0x001b, 0x0013, 0x000f, "KeyR", US_R), + DOM_CODE(0x070016, 0x001f, 0x0027, 0x001f, 0x0001, "KeyS", US_S), + DOM_CODE(0x070017, 0x0014, 0x001c, 0x0014, 0x0011, "KeyT", US_T), + DOM_CODE(0x070018, 0x0016, 0x001e, 0x0016, 0x0020, "KeyU", US_U), + DOM_CODE(0x070019, 0x002f, 0x0037, 0x002f, 0x0009, "KeyV", US_V), + DOM_CODE(0x07001a, 0x0011, 0x0019, 0x0011, 0x000d, "KeyW", US_W), + DOM_CODE(0x07001b, 0x002d, 0x0035, 0x002d, 0x0007, "KeyX", US_X), + DOM_CODE(0x07001c, 0x0015, 0x001d, 0x0015, 0x0010, "KeyY", US_Y), + DOM_CODE(0x07001d, 0x002c, 0x0034, 0x002c, 0x0006, "KeyZ", US_Z), + DOM_CODE(0x07001e, 0x0002, 0x000a, 0x0002, 0x0012, "Digit1", DIGIT1), + DOM_CODE(0x07001f, 0x0003, 0x000b, 0x0003, 0x0013, "Digit2", DIGIT2), + DOM_CODE(0x070020, 0x0004, 0x000c, 0x0004, 0x0014, "Digit3", DIGIT3), + DOM_CODE(0x070021, 0x0005, 0x000d, 0x0005, 0x0015, "Digit4", DIGIT4), + DOM_CODE(0x070022, 0x0006, 0x000e, 0x0006, 0x0017, "Digit5", DIGIT5), + DOM_CODE(0x070023, 0x0007, 0x000f, 0x0007, 0x0016, "Digit6", DIGIT6), + DOM_CODE(0x070024, 0x0008, 0x0010, 0x0008, 0x001a, "Digit7", DIGIT7), + DOM_CODE(0x070025, 0x0009, 0x0011, 0x0009, 0x001c, "Digit8", DIGIT8), + DOM_CODE(0x070026, 0x000a, 0x0012, 0x000a, 0x0019, "Digit9", DIGIT9), + DOM_CODE(0x070027, 0x000b, 0x0013, 0x000b, 0x001d, "Digit0", DIGIT0), + DOM_CODE(0x070028, 0x001c, 0x0024, 0x001c, 0x0024, "Enter", ENTER), + DOM_CODE(0x070029, 0x0001, 0x0009, 0x0001, 0x0035, "Escape", ESCAPE), + DOM_CODE(0x07002a, 0x000e, 0x0016, 0x000e, 0x0033, "Backspace", BACKSPACE), + DOM_CODE(0x07002b, 0x000f, 0x0017, 0x000f, 0x0030, "Tab", TAB), + DOM_CODE(0x07002c, 0x0039, 0x0041, 0x0039, 0x0031, "Space", SPACE), + DOM_CODE(0x07002d, 0x000c, 0x0014, 0x000c, 0x001b, "Minus", MINUS), + DOM_CODE(0x07002e, 0x000d, 0x0015, 0x000d, 0x0018, "Equal", EQUAL), + DOM_CODE(0x07002f, 0x001a, 0x0022, 0x001a, 0x0021, "BracketLeft", BRACKET_LEFT), + DOM_CODE(0x070030, 0x001b, 0x0023, 0x001b, 0x001e, "BracketRight", BRACKET_RIGHT), + DOM_CODE(0x070031, 0x002b, 0x0033, 0x002b, 0x002a, "Backslash", BACKSLASH), + DOM_CODE(0x070033, 0x0027, 0x002f, 0x0027, 0x0029, "Semicolon", SEMICOLON), + DOM_CODE(0x070034, 0x0028, 0x0030, 0x0028, 0x0027, "Quote", QUOTE), + DOM_CODE(0x070035, 0x0029, 0x0031, 0x0029, 0x0032, "Backquote", BACKQUOTE), + DOM_CODE(0x070036, 0x0033, 0x003b, 0x0033, 0x002b, "Comma", COMMA), + DOM_CODE(0x070037, 0x0034, 0x003c, 0x0034, 0x002f, "Period", PERIOD), + DOM_CODE(0x070038, 0x0035, 0x003d, 0x0035, 0x002c, "Slash", SLASH), + DOM_CODE(0x070039, 0x003a, 0x0042, 0x003a, 0x0039, "CapsLock", CAPS_LOCK), + DOM_CODE(0x07003a, 0x003b, 0x0043, 0x003b, 0x007a, "F1", F1), + DOM_CODE(0x07003b, 0x003c, 0x0044, 0x003c, 0x0078, "F2", F2), + DOM_CODE(0x07003c, 0x003d, 0x0045, 0x003d, 0x0063, "F3", F3), + DOM_CODE(0x07003d, 0x003e, 0x0046, 0x003e, 0x0076, "F4", F4), + DOM_CODE(0x07003e, 0x003f, 0x0047, 0x003f, 0x0060, "F5", F5), + DOM_CODE(0x07003f, 0x0040, 0x0048, 0x0040, 0x0061, "F6", F6), + DOM_CODE(0x070040, 0x0041, 0x0049, 0x0041, 0x0062, "F7", F7), + DOM_CODE(0x070041, 0x0042, 0x004a, 0x0042, 0x0064, "F8", F8), + DOM_CODE(0x070042, 0x0043, 0x004b, 0x0043, 0x0065, "F9", F9), + DOM_CODE(0x070043, 0x0044, 0x004c, 0x0044, 0x006d, "F10", F10), + DOM_CODE(0x070044, 0x0057, 0x005f, 0x0057, 0x0067, "F11", F11), + DOM_CODE(0x070045, 0x0058, 0x0060, 0x0058, 0x006f, "F12", F12), + DOM_CODE(0x070046, 0x0063, 0x006b, 0xe037, 0xffff, "PrintScreen", PRINT_SCREEN), + DOM_CODE(0x070047, 0x0046, 0x004e, 0x0046, 0xffff, "ScrollLock", SCROLL_LOCK), + DOM_CODE(0x070048, 0x0077, 0x007f, 0x0045, 0xffff, "Pause", PAUSE), + DOM_CODE(0x070049, 0x006e, 0x0076, 0xe052, 0x0072, "Insert", INSERT), + DOM_CODE(0x07004a, 0x0066, 0x006e, 0xe047, 0x0073, "Home", HOME), + DOM_CODE(0x07004b, 0x0068, 0x0070, 0xe049, 0x0074, "PageUp", PAGE_UP), + DOM_CODE(0x07004c, 0x006f, 0x0077, 0xe053, 0x0075, "Delete", DEL), + DOM_CODE(0x07004d, 0x006b, 0x0073, 0xe04f, 0x0077, "End", END), + DOM_CODE(0x07004e, 0x006d, 0x0075, 0xe051, 0x0079, "PageDown", PAGE_DOWN), + DOM_CODE(0x07004f, 0x006a, 0x0072, 0xe04d, 0x007c, "ArrowRight", ARROW_RIGHT), + DOM_CODE(0x070050, 0x0069, 0x0071, 0xe04b, 0x007b, "ArrowLeft", ARROW_LEFT), + DOM_CODE(0x070051, 0x006c, 0x0074, 0xe050, 0x007d, "ArrowDown", ARROW_DOWN), + DOM_CODE(0x070052, 0x0067, 0x006f, 0xe048, 0x007e, "ArrowUp", ARROW_UP), + DOM_CODE(0x070053, 0x0045, 0x004d, 0xe045, 0x0047, "NumLock", NUM_LOCK), + DOM_CODE(0x070054, 0x0062, 0x006a, 0xe035, 0x004b, "NumpadDivide", NUMPAD_DIVIDE), + DOM_CODE(0x070055, 0x0037, 0x003f, 0x0037, 0x0043, "NumpadMultiply", NUMPAD_MULTIPLY), + DOM_CODE(0x070056, 0x004a, 0x0052, 0x004a, 0x004e, "NumpadSubtract", NUMPAD_SUBTRACT), + DOM_CODE(0x070057, 0x004e, 0x0056, 0x004e, 0x0045, "NumpadAdd", NUMPAD_ADD), + DOM_CODE(0x070058, 0x0060, 0x0068, 0xe01c, 0x004c, "NumpadEnter", NUMPAD_ENTER), + DOM_CODE(0x070059, 0x004f, 0x0057, 0x004f, 0x0053, "Numpad1", NUMPAD1), + DOM_CODE(0x07005a, 0x0050, 0x0058, 0x0050, 0x0054, "Numpad2", NUMPAD2), + DOM_CODE(0x07005b, 0x0051, 0x0059, 0x0051, 0x0055, "Numpad3", NUMPAD3), + DOM_CODE(0x07005c, 0x004b, 0x0053, 0x004b, 0x0056, "Numpad4", NUMPAD4), + DOM_CODE(0x07005d, 0x004c, 0x0054, 0x004c, 0x0057, "Numpad5", NUMPAD5), + DOM_CODE(0x07005e, 0x004d, 0x0055, 0x004d, 0x0058, "Numpad6", NUMPAD6), + DOM_CODE(0x07005f, 0x0047, 0x004f, 0x0047, 0x0059, "Numpad7", NUMPAD7), + DOM_CODE(0x070060, 0x0048, 0x0050, 0x0048, 0x005b, "Numpad8", NUMPAD8), + DOM_CODE(0x070061, 0x0049, 0x0051, 0x0049, 0x005c, "Numpad9", NUMPAD9), + DOM_CODE(0x070062, 0x0052, 0x005a, 0x0052, 0x0052, "Numpad0", NUMPAD0), + DOM_CODE(0x070063, 0x0053, 0x005b, 0x0053, 0x0041, "NumpadDecimal", NUMPAD_DECIMAL), + DOM_CODE(0x070064, 0x0056, 0x005e, 0x0056, 0x000a, "IntlBackslash", INTL_BACKSLASH), + DOM_CODE(0x070065, 0x007f, 0x0087, 0xe05d, 0x006e, "ContextMenu", CONTEXT_MENU), + DOM_CODE(0x070066, 0x0074, 0x007c, 0xe05e, 0xffff, "Power", POWER), + DOM_CODE(0x070067, 0x0075, 0x007d, 0x0059, 0x0051, "NumpadEqual", NUMPAD_EQUAL), + DOM_CODE(0x070068, 0x00b7, 0x00bf, 0x0064, 0x0069, "F13", F13), + DOM_CODE(0x070069, 0x00b8, 0x00c0, 0x0065, 0x006b, "F14", F14), + DOM_CODE(0x07006a, 0x00b9, 0x00c1, 0x0066, 0x0071, "F15", F15), + DOM_CODE(0x07006b, 0x00ba, 0x00c2, 0x0067, 0x006a, "F16", F16), + DOM_CODE(0x07006c, 0x00bb, 0x00c3, 0x0068, 0x0040, "F17", F17), + DOM_CODE(0x07006d, 0x00bc, 0x00c4, 0x0069, 0x004f, "F18", F18), + DOM_CODE(0x07006e, 0x00bd, 0x00c5, 0x006a, 0x0050, "F19", F19), + DOM_CODE(0x07006f, 0x00be, 0x00c6, 0x006b, 0x005a, "F20", F20), + DOM_CODE(0x070070, 0x00bf, 0x00c7, 0x006c, 0xffff, "F21", F21), + DOM_CODE(0x070071, 0x00c0, 0x00c8, 0x006d, 0xffff, "F22", F22), + DOM_CODE(0x070072, 0x00c1, 0x00c9, 0x006e, 0xffff, "F23", F23), + DOM_CODE(0x070073, 0x00c2, 0x00ca, 0x0076, 0xffff, "F24", F24), + DOM_CODE(0x070074, 0x0086, 0x008e, 0x0000, 0xffff, "Open", OPEN), + DOM_CODE(0x070075, 0x008a, 0x0092, 0xe03b, 0xffff, "Help", HELP), + DOM_CODE(0x070077, 0x0084, 0x008c, 0x0000, 0xffff, "Select", SELECT), + DOM_CODE(0x070079, 0x0081, 0x0089, 0x0000, 0xffff, "Again", AGAIN), + DOM_CODE(0x07007a, 0x0083, 0x008b, 0xe008, 0xffff, "Undo", UNDO), + DOM_CODE(0x07007b, 0x0089, 0x0091, 0xe017, 0xffff, "Cut", CUT), + DOM_CODE(0x07007c, 0x0085, 0x008d, 0xe018, 0xffff, "Copy", COPY), + DOM_CODE(0x07007d, 0x0087, 0x008f, 0xe00a, 0xffff, "Paste", PASTE), + DOM_CODE(0x07007e, 0x0088, 0x0090, 0x0000, 0xffff, "Find", FIND), + DOM_CODE(0x07007f, 0x0071, 0x0079, 0xe020, 0x004a, "AudioVolumeMute", VOLUME_MUTE), + DOM_CODE(0x070080, 0x0073, 0x007b, 0xe030, 0x0048, "AudioVolumeUp", VOLUME_UP), + DOM_CODE(0x070081, 0x0072, 0x007a, 0xe02e, 0x0049, "AudioVolumeDown", VOLUME_DOWN), + DOM_CODE(0x070085, 0x0079, 0x0081, 0x007e, 0x005f, "NumpadComma", NUMPAD_COMMA), + DOM_CODE(0x070087, 0x0059, 0x0061, 0x0073, 0x005e, "IntlRo", INTL_RO), + DOM_CODE(0x070088, 0x005d, 0x0065, 0x0070, 0xffff, "KanaMode", KANA_MODE), + DOM_CODE(0x070089, 0x007c, 0x0084, 0x007d, 0x005d, "IntlYen", INTL_YEN), + DOM_CODE(0x07008a, 0x005c, 0x0064, 0x0079, 0xffff, "Convert", CONVERT), + DOM_CODE(0x07008b, 0x005e, 0x0066, 0x007b, 0xffff, "NonConvert", NON_CONVERT), + DOM_CODE(0x070090, 0x007a, 0x0082, 0x0072, 0x0068, "Lang1", LANG1), + DOM_CODE(0x070091, 0x007b, 0x0083, 0x0071, 0x0066, "Lang2", LANG2), + DOM_CODE(0x070092, 0x005a, 0x0062, 0x0078, 0xffff, "Lang3", LANG3), + DOM_CODE(0x070093, 0x005b, 0x0063, 0x0077, 0xffff, "Lang4", LANG4), + DOM_CODE(0x070094, 0x0055, 0x005d, 0x0000, 0xffff, "Lang5", LANG5), + DOM_CODE(0x07009b, 0x0000, 0x0000, 0x0000, 0xffff, "Abort", ABORT), + DOM_CODE(0x0700a3, 0x0000, 0x0000, 0x0000, 0xffff, "Props", PROPS), + DOM_CODE(0x0700b6, 0x00b3, 0x00bb, 0x0000, 0xffff, "NumpadParenLeft", NUMPAD_PAREN_LEFT), + DOM_CODE(0x0700b7, 0x00b4, 0x00bc, 0x0000, 0xffff, "NumpadParenRight", NUMPAD_PAREN_RIGHT), + DOM_CODE(0x0700bb, 0x0000, 0x0000, 0x0000, 0xffff, "NumpadBackspace", NUMPAD_BACKSPACE), + DOM_CODE(0x0700d0, 0x0000, 0x0000, 0x0000, 0xffff, "NumpadMemoryStore", NUMPAD_MEMORY_STORE), + DOM_CODE(0x0700d1, 0x0000, 0x0000, 0x0000, 0xffff, "NumpadMemoryRecall", NUMPAD_MEMORY_RECALL), + DOM_CODE(0x0700d2, 0x0000, 0x0000, 0x0000, 0xffff, "NumpadMemoryClear", NUMPAD_MEMORY_CLEAR), + DOM_CODE(0x0700d3, 0x0000, 0x0000, 0x0000, 0xffff, "NumpadMemoryAdd", NUMPAD_MEMORY_ADD), + DOM_CODE(0x0700d4, 0x0000, 0x0000, 0x0000, 0xffff, "NumpadMemorySubtract", NUMPAD_MEMORY_SUBTRACT), + DOM_CODE(0x0700d7, 0x0076, 0x007e, 0x0000, 0xffff, NULL, NUMPAD_SIGN_CHANGE), + DOM_CODE(0x0700d8, 0x0000, 0x0000, 0x0000, 0xffff, "NumpadClear", NUMPAD_CLEAR), + DOM_CODE(0x0700d9, 0x0000, 0x0000, 0x0000, 0xffff, "NumpadClearEntry", NUMPAD_CLEAR_ENTRY), + DOM_CODE(0x0700e0, 0x001d, 0x0025, 0x001d, 0x003b, "ControlLeft", CONTROL_LEFT), + DOM_CODE(0x0700e1, 0x002a, 0x0032, 0x002a, 0x0038, "ShiftLeft", SHIFT_LEFT), + DOM_CODE(0x0700e2, 0x0038, 0x0040, 0x0038, 0x003a, "AltLeft", ALT_LEFT), + DOM_CODE(0x0700e3, 0x007d, 0x0085, 0xe05b, 0x0037, "MetaLeft", META_LEFT), + DOM_CODE(0x0700e4, 0x0061, 0x0069, 0xe01d, 0x003e, "ControlRight", CONTROL_RIGHT), + DOM_CODE(0x0700e5, 0x0036, 0x003e, 0x0036, 0x003c, "ShiftRight", SHIFT_RIGHT), + DOM_CODE(0x0700e6, 0x0064, 0x006c, 0xe038, 0x003d, "AltRight", ALT_RIGHT), + DOM_CODE(0x0700e7, 0x007e, 0x0086, 0xe05c, 0x0036, "MetaRight", META_RIGHT), + DOM_CODE(0x0c0060, 0x0166, 0x016e, 0x0000, 0xffff, NULL, INFO), + DOM_CODE(0x0c0061, 0x0172, 0x017a, 0x0000, 0xffff, NULL, CLOSED_CAPTION_TOGGLE), + DOM_CODE(0x0c006f, 0x00e1, 0x00e9, 0x0000, 0xffff, "BrightnessUp", BRIGHTNESS_UP), + DOM_CODE(0x0c0070, 0x00e0, 0x00e8, 0x0000, 0xffff, "BrightnessDown", BRIGHTNESS_DOWN), + DOM_CODE(0x0c0072, 0x01af, 0x01b7, 0x0000, 0xffff, NULL, BRIGHTNESS_TOGGLE), + DOM_CODE(0x0c0073, 0x0250, 0x0258, 0x0000, 0xffff, NULL, BRIGHTNESS_MINIMIUM), + DOM_CODE(0x0c0074, 0x0251, 0x0259, 0x0000, 0xffff, NULL, BRIGHTNESS_MAXIMUM), + DOM_CODE(0x0c0075, 0x00f4, 0x00fc, 0x0000, 0xffff, NULL, BRIGHTNESS_AUTO), + DOM_CODE(0x0c0079, 0x00e6, 0x00ee, 0x0000, 0xffff, NULL, KBD_ILLUM_UP), + DOM_CODE(0x0c007a, 0x00e5, 0x00ed, 0x0000, 0xffff, NULL, KBD_ILLUM_DOWN), + DOM_CODE(0x0c0083, 0x0195, 0x019d, 0x0000, 0xffff, NULL, MEDIA_LAST), + DOM_CODE(0x0c008c, 0x00a9, 0x00b1, 0x0000, 0xffff, NULL, LAUNCH_PHONE), + DOM_CODE(0x0c008d, 0x016a, 0x0172, 0x0000, 0xffff, NULL, PROGRAM_GUIDE), + DOM_CODE(0x0c0094, 0x00ae, 0x00b6, 0x0000, 0xffff, NULL, EXIT), + DOM_CODE(0x0c009c, 0x019a, 0x01a2, 0x0000, 0xffff, NULL, CHANNEL_UP), + DOM_CODE(0x0c009d, 0x019b, 0x01a3, 0x0000, 0xffff, NULL, CHANNEL_DOWN), + DOM_CODE(0x0c00b0, 0x00cf, 0x00d7, 0x0000, 0xffff, "MediaPlay", MEDIA_PLAY), + DOM_CODE(0x0c00b1, 0x00c9, 0x00d1, 0x0000, 0xffff, "MediaPause", MEDIA_PAUSE), + DOM_CODE(0x0c00b2, 0x00a7, 0x00af, 0x0000, 0xffff, "MediaRecord", MEDIA_RECORD), + DOM_CODE(0x0c00b3, 0x00d0, 0x00d8, 0x0000, 0xffff, "MediaFastForward", MEDIA_FAST_FORWARD), + DOM_CODE(0x0c00b4, 0x00a8, 0x00b0, 0x0000, 0xffff, "MediaRewind", MEDIA_REWIND), + DOM_CODE(0x0c00b5, 0x00a3, 0x00ab, 0xe019, 0xffff, "MediaTrackNext", MEDIA_TRACK_NEXT), + DOM_CODE(0x0c00b6, 0x00a5, 0x00ad, 0xe010, 0xffff, "MediaTrackPrevious", MEDIA_TRACK_PREVIOUS), + DOM_CODE(0x0c00b7, 0x00a6, 0x00ae, 0xe024, 0xffff, "MediaStop", MEDIA_STOP), + DOM_CODE(0x0c00b8, 0x00a1, 0x00a9, 0xe02c, 0xffff, "Eject", EJECT), + DOM_CODE(0x0c00cd, 0x00a4, 0x00ac, 0xe022, 0xffff, "MediaPlayPause", MEDIA_PLAY_PAUSE), + DOM_CODE(0x0c00cf, 0x0246, 0x024e, 0x0000, 0xffff, NULL, SPEECH_INPUT_TOGGLE), + DOM_CODE(0x0c00e5, 0x00d1, 0x00d9, 0x0000, 0xffff, NULL, BASS_BOOST), + DOM_CODE(0x0c0183, 0x00ab, 0x00b3, 0xe06d, 0xffff, "MediaSelect", MEDIA_SELECT), + DOM_CODE(0x0c0184, 0x01a5, 0x01ad, 0x0000, 0xffff, NULL, LAUNCH_WORD_PROCESSOR), + DOM_CODE(0x0c0186, 0x01a7, 0x01af, 0x0000, 0xffff, NULL, LAUNCH_SPREADSHEET), + DOM_CODE(0x0c018a, 0x009b, 0x00a3, 0xe06c, 0xffff, "LaunchMail", LAUNCH_MAIL), + DOM_CODE(0x0c018d, 0x01ad, 0x01b5, 0x0000, 0xffff, NULL, LAUNCH_CONTACTS), + DOM_CODE(0x0c018e, 0x018d, 0x0195, 0x0000, 0xffff, NULL, LAUNCH_CALENDAR), + DOM_CODE(0x0c0192, 0x008c, 0x0094, 0xe021, 0xffff, "LaunchApp2", LAUNCH_APP2), + DOM_CODE(0x0c0194, 0x0090, 0x0098, 0xe06b, 0xffff, "LaunchApp1", LAUNCH_APP1), + DOM_CODE(0x0c0196, 0x0096, 0x009e, 0x0000, 0xffff, NULL, LAUNCH_INTERNET_BROWSER), + DOM_CODE(0x0c019C, 0x01b1, 0x01b9, 0x0000, 0xffff, NULL, LOG_OFF), + DOM_CODE(0x0c019e, 0x0098, 0x00a0, 0x0000, 0xffff, NULL, LOCK_SCREEN), + DOM_CODE(0x0c019f, 0x0243, 0x024b, 0x0000, 0xffff, "LaunchControlPanel", LAUNCH_CONTROL_PANEL), + DOM_CODE(0x0c01a2, 0x0244, 0x024c, 0x0000, 0xffff, "SelectTask", SELECT_TASK), + DOM_CODE(0x0c01a7, 0x00eb, 0x00f3, 0x0000, 0xffff, NULL, LAUNCH_DOCUMENTS), + DOM_CODE(0x0c01ab, 0x01b0, 0x01b8, 0x0000, 0xffff, NULL, SPELL_CHECK), + DOM_CODE(0x0c01ae, 0x0176, 0x017e, 0x0000, 0xffff, NULL, LAUNCH_KEYBOARD_LAYOUT), + DOM_CODE(0x0c01b1, 0x0245, 0x024d, 0x0000, 0xffff, "LaunchScreenSaver", LAUNCH_SCREEN_SAVER), + DOM_CODE(0x0c01cb, 0x0247, 0x024f, 0x0000, 0xffff, "LaunchAssistant", LAUNCH_ASSISTANT), + DOM_CODE(0x0c01b7, 0x0188, 0x0190, 0x0000, 0xffff, NULL, LAUNCH_AUDIO_BROWSER), + DOM_CODE(0x0c0201, 0x00b5, 0x00bd, 0x0000, 0xffff, NULL, NEW), + DOM_CODE(0x0c0203, 0x00ce, 0x00d6, 0x0000, 0xffff, NULL, CLOSE), + DOM_CODE(0x0c0207, 0x00ea, 0x00f2, 0x0000, 0xffff, NULL, SAVE), + DOM_CODE(0x0c0208, 0x00d2, 0x00da, 0x0000, 0xffff, NULL, PRINT), + DOM_CODE(0x0c0221, 0x00d9, 0x00e1, 0xe065, 0xffff, "BrowserSearch", BROWSER_SEARCH), + DOM_CODE(0x0c0223, 0x00ac, 0x00b4, 0xe032, 0xffff, "BrowserHome", BROWSER_HOME), + DOM_CODE(0x0c0224, 0x009e, 0x00a6, 0xe06a, 0xffff, "BrowserBack", BROWSER_BACK), + DOM_CODE(0x0c0225, 0x009f, 0x00a7, 0xe069, 0xffff, "BrowserForward", BROWSER_FORWARD), + DOM_CODE(0x0c0226, 0x0080, 0x0088, 0xe068, 0xffff, "BrowserStop", BROWSER_STOP), + DOM_CODE(0x0c0227, 0x00ad, 0x00b5, 0xe067, 0xffff, "BrowserRefresh", BROWSER_REFRESH), + DOM_CODE(0x0c022a, 0x009c, 0x00a4, 0xe066, 0xffff, "BrowserFavorites", BROWSER_FAVORITES), + DOM_CODE(0x0c022d, 0x01a2, 0x01aa, 0x0000, 0xffff, NULL, ZOOM_IN), + DOM_CODE(0x0c022e, 0x01a3, 0x01ab, 0x0000, 0xffff, NULL, ZOOM_OUT), + DOM_CODE(0x0c0232, 0x0174, 0x017c, 0x0000, 0xffff, "ZoomToggle", ZOOM_TOGGLE), + DOM_CODE(0x0c0279, 0x00b6, 0x00be, 0x0000, 0xffff, NULL, REDO), + DOM_CODE(0x0c0289, 0x00e8, 0x00f0, 0x0000, 0xffff, "MailReply", MAIL_REPLY), + DOM_CODE(0x0c028b, 0x00e9, 0x00f1, 0x0000, 0xffff, "MailForward", MAIL_FORWARD), + DOM_CODE(0x0c028c, 0x00e7, 0x00ef, 0x0000, 0xffff, "MailSend", MAIL_SEND), + DOM_CODE(0x0c029d, 0x0248, 0x0250, 0x0000, 0xffff, "KeyboardLayoutSelect", KEYBOARD_LAYOUT_SELECT), + DOM_CODE(0x0c029f, 0x0078, 0x0080, 0x0000, 0xffff, "ShowAllWindows", SHOW_ALL_WINDOWS), }; \ No newline at end of file diff --git a/hid/generator/gen.go b/hid/generator/gen.go index 67fd948..a20c8d1 100644 --- a/hid/generator/gen.go +++ b/hid/generator/gen.go @@ -1,74 +1,74 @@ -package main - -import ( - "encoding/json" - "io" - "io/fs" - "os" - "regexp" - "strconv" -) - -type KeyMaps struct { - Usb map[uint16]Key - Evdev map[uint16]Key - Xkb map[uint16]Key - Win map[uint16]Key - Mac map[uint16]Key - Code map[string]Key - Arr []Key -} - -type Key struct { - Usb uint16 - Evdev uint16 - Xkb uint16 - Win uint16 - Mac uint16 - Code string -} - -func main() { - rege, _ := regexp.Compile("DOM_CODE\\(0x07([0-9a-f]*), 0x([0-9a-f]*), 0x([0-9a-f]*), 0x([0-9a-f]*), 0x([0-9a-f]*), \"?[A-Za-z0-9]*\"?, ([A-Za-z_0-9]*)") - //DOM_CODE(USB, evdev, XKB, Win, Mac, _, Code) - fil, _ := os.OpenFile("hid/data/keycode_data.inc", 0, fs.FileMode(os.O_RDONLY)) - byts, _ := io.ReadAll(fil) - fil.Close() - matches := rege.FindAllSubmatch(byts, -1) - KeyMaps := KeyMaps{ - Usb: make(map[uint16]Key), - Evdev: make(map[uint16]Key), - Xkb: make(map[uint16]Key), - Win: make(map[uint16]Key), - Mac: make(map[uint16]Key), - Code: make(map[string]Key), - } - Arr := make([]Key, 0) - for _, bar := range matches { - U, _ := strconv.ParseUint(string(bar[1]), 16, 16) - E, _ := strconv.ParseUint(string(bar[2]), 16, 16) - X, _ := strconv.ParseUint(string(bar[3]), 16, 16) - W, _ := strconv.ParseUint(string(bar[4]), 16, 16) - M, _ := strconv.ParseUint(string(bar[5]), 16, 16) - Keys := Key{ - Usb: uint16(U), - Evdev: uint16(E), - Xkb: uint16(X), - Win: uint16(W), - Mac: uint16(M), - Code: string(bar[6]), - } - KeyMaps.Usb[uint16(U)] = Keys - KeyMaps.Evdev[uint16(E)] = Keys - KeyMaps.Xkb[uint16(X)] = Keys - KeyMaps.Win[uint16(W)] = Keys - KeyMaps.Mac[uint16(M)] = Keys - KeyMaps.Code[string(bar[6])] = Keys - Arr = append(Arr, Keys) - } - KeyMaps.Arr = Arr - out, _ := os.Create("hid/generated.json") - defer out.Close() - jso, _ := json.Marshal(KeyMaps) - out.Write(jso) -} +package main + +import ( + "encoding/json" + "io" + "io/fs" + "os" + "regexp" + "strconv" +) + +type KeyMaps struct { + Usb map[uint16]Key + Evdev map[uint16]Key + Xkb map[uint16]Key + Win map[uint16]Key + Mac map[uint16]Key + Code map[string]Key + Arr []Key +} + +type Key struct { + Usb uint16 + Evdev uint16 + Xkb uint16 + Win uint16 + Mac uint16 + Code string +} + +func main() { + rege, _ := regexp.Compile("DOM_CODE\\(0x07([0-9a-f]*), 0x([0-9a-f]*), 0x([0-9a-f]*), 0x([0-9a-f]*), 0x([0-9a-f]*), \"?[A-Za-z0-9]*\"?, ([A-Za-z_0-9]*)") + //DOM_CODE(USB, evdev, XKB, Win, Mac, _, Code) + fil, _ := os.OpenFile("hid/data/keycode_data.inc", 0, fs.FileMode(os.O_RDONLY)) + byts, _ := io.ReadAll(fil) + fil.Close() + matches := rege.FindAllSubmatch(byts, -1) + KeyMaps := KeyMaps{ + Usb: make(map[uint16]Key), + Evdev: make(map[uint16]Key), + Xkb: make(map[uint16]Key), + Win: make(map[uint16]Key), + Mac: make(map[uint16]Key), + Code: make(map[string]Key), + } + Arr := make([]Key, 0) + for _, bar := range matches { + U, _ := strconv.ParseUint(string(bar[1]), 16, 16) + E, _ := strconv.ParseUint(string(bar[2]), 16, 16) + X, _ := strconv.ParseUint(string(bar[3]), 16, 16) + W, _ := strconv.ParseUint(string(bar[4]), 16, 16) + M, _ := strconv.ParseUint(string(bar[5]), 16, 16) + Keys := Key{ + Usb: uint16(U), + Evdev: uint16(E), + Xkb: uint16(X), + Win: uint16(W), + Mac: uint16(M), + Code: string(bar[6]), + } + KeyMaps.Usb[uint16(U)] = Keys + KeyMaps.Evdev[uint16(E)] = Keys + KeyMaps.Xkb[uint16(X)] = Keys + KeyMaps.Win[uint16(W)] = Keys + KeyMaps.Mac[uint16(M)] = Keys + KeyMaps.Code[string(bar[6])] = Keys + Arr = append(Arr, Keys) + } + KeyMaps.Arr = Arr + out, _ := os.Create("hid/generated.json") + defer out.Close() + jso, _ := json.Marshal(KeyMaps) + out.Write(jso) +} diff --git a/hid/hid.go b/hid/hid.go index befb667..13f805c 100644 --- a/hid/hid.go +++ b/hid/hid.go @@ -1,63 +1,63 @@ -package hid - -import ( - _ "embed" - "encoding/json" -) - -type KeyMaps struct { - Usb map[uint16]Key - Evdev map[uint16]Key - Xkb map[uint16]Key - Win map[uint16]Key - Mac map[uint16]Key - Code map[string]Key - Arr []Key -} - -type Key struct { - Usb uint16 - Evdev uint16 - Xkb uint16 - Win uint16 - Mac uint16 - Code string -} - -var Mappings KeyMaps = KeyMaps{} - -//go:embed generated.json -var file []byte - -func init() { - json.Unmarshal(file, &Mappings) -} -func GetWindowsFromHid(uv uint16) uint16 { - return Mappings.Usb[uv].Win -} -func GetHidFromWindows(uv uint16) uint16 { - return Mappings.Win[uv].Usb -} - -func GetLinuxFromHid(uv uint16) uint16 { - return Mappings.Usb[uv].Evdev -} -func GetHidFromLinux(uv uint16) uint16 { - return Mappings.Evdev[uv].Usb -} - -func GetMappingFromHID(uv uint16) Key { - return Mappings.Usb[uv] -} - -func GetMappingFromWindows(uv uint16) Key { - return Mappings.Win[uv] -} - -func GetMappingFromLinux(uv uint16) Key { - return Mappings.Evdev[uv] -} - -func GetMappingFromName(name string) Key { - return Mappings.Code[name] -} +package hid + +import ( + _ "embed" + "encoding/json" +) + +type KeyMaps struct { + Usb map[uint16]Key + Evdev map[uint16]Key + Xkb map[uint16]Key + Win map[uint16]Key + Mac map[uint16]Key + Code map[string]Key + Arr []Key +} + +type Key struct { + Usb uint16 + Evdev uint16 + Xkb uint16 + Win uint16 + Mac uint16 + Code string +} + +var Mappings KeyMaps = KeyMaps{} + +//go:embed generated.json +var file []byte + +func init() { + json.Unmarshal(file, &Mappings) +} +func GetWindowsFromHid(uv uint16) uint16 { + return Mappings.Usb[uv].Win +} +func GetHidFromWindows(uv uint16) uint16 { + return Mappings.Win[uv].Usb +} + +func GetLinuxFromHid(uv uint16) uint16 { + return Mappings.Usb[uv].Evdev +} +func GetHidFromLinux(uv uint16) uint16 { + return Mappings.Evdev[uv].Usb +} + +func GetMappingFromHID(uv uint16) Key { + return Mappings.Usb[uv] +} + +func GetMappingFromWindows(uv uint16) Key { + return Mappings.Win[uv] +} + +func GetMappingFromLinux(uv uint16) Key { + return Mappings.Evdev[uv] +} + +func GetMappingFromName(name string) Key { + return Mappings.Code[name] +} diff --git a/module.go b/module.go index c5c64b8..d0d85fe 100644 --- a/module.go +++ b/module.go @@ -1,3 +1,3 @@ -package OrbCommon - -//go:generate go run hid/generator/gen.go +package OrbCommon + +//go:generate go run hid/generator/gen.go