From 10836ae78302aa778553300167f6cdebdf8d884b Mon Sep 17 00:00:00 2001 From: David Härdeman Date: Wed, 22 Jul 2015 23:39:29 +0200 Subject: Improve rcm-server integration with evdev generation --- Makefile | 9 +- RemoteControlManager.xml | 2 + keymaps/default/test2.layout | 2 +- linux-input-enum.h | 428 ------------------------------------- linux-input-keycodes.c | 428 ------------------------------------- linux-input-keycodes.h | 440 +++++++++++++++++++++++++++++++++++++-- rcm-client-main.c | 23 +- rcm-client-receive.c | 39 +++- rcm-client-receive.h | 3 +- rcm-server-evdev.c | 127 +++++++++++ rcm-server-evdev.h | 7 + rcm-server-keymap.c | 46 ++-- rcm-server-keymap.h | 4 +- rcm-server-main.c | 75 +++++-- shared.c | 45 ++++ shared.h | 21 +- tools/generate-input-keycodes.sh | 34 +-- 17 files changed, 766 insertions(+), 967 deletions(-) delete mode 100644 linux-input-enum.h delete mode 100644 linux-input-keycodes.c create mode 100644 rcm-server-evdev.c create mode 100644 rcm-server-evdev.h create mode 100644 shared.c diff --git a/Makefile b/Makefile index b24c909..1ea58e6 100644 --- a/Makefile +++ b/Makefile @@ -19,15 +19,15 @@ RCM_CFLAGS = ${GENERIC_CFLAGS} ${EXTRA_CFLAGS} $(shell pkg-config --cflags ${RCM RCM_LDFLAGS = ${GENERIC_LDFLAGS} ${EXTRA_LDFLAGS} $(shell pkg-config --libs ${RCM_PACKAGES}) RCM_COMPILE = $(CC) $(RCM_CFLAGS) RCM_LINK = $(CC) $(RCM_CFLAGS) $(RCM_LDFLAGS) -RCM_OBJECTS = rcm-server-main.o rcm-server-keymap.o linux-input-keycodes.o -RCM_HEADERS = rcm-server-main.h rcm-server-keymap.h utils.h $(COMMON_HEADERS) +RCM_OBJECTS = rcm-server-main.o rcm-server-keymap.o rcm-server-evdev.o shared.o +RCM_HEADERS = rcm-server-main.h rcm-server-keymap.h rcm-server-evdev.h utils.h $(COMMON_HEADERS) RCC_PACKAGES = gtk+-3.0 RCC_CFLAGS = ${GENERIC_CFLAGS} ${EXTRA_CFLAGS} $(shell pkg-config --cflags ${RCC_PACKAGES}) RCC_LDFLAGS = ${GENERIC_LDFLAGS} ${EXTRA_LDFLAGS} $(shell pkg-config --libs ${RCC_PACKAGES}) RCC_COMPILE = $(CC) $(RCC_CFLAGS) RCC_LINK = $(CC) $(RCC_CFLAGS) $(RCC_LDFLAGS) -RCC_OBJECTS = rcm-client-main.o rcm-client-hardware-list.o rcm-client-hardware-info.o rcm-client-receive.o rcm-client-transmit.o generated.o linux-input-keycodes.o +RCC_OBJECTS = rcm-client-main.o rcm-client-hardware-list.o rcm-client-hardware-info.o rcm-client-receive.o rcm-client-transmit.o generated.o shared.o RCC_HEADERS = rcm-client-main.h rcm-client-hardware-list.h rcm-client-hardware-info.h rcm-client-receive.h rcm-client-transmit.h generated.h $(COMMON_HEADERS) INSTALL = install -c @@ -48,6 +48,9 @@ mandir = ${prefix}/share/man all: rcm-server rcm-client .DEFAULT: all +shared.o: shared.c shared.h + $(CC) $(GENERIC_CFLAGS) $(EXTRA_CFLAGS) -o $@ -c $< + linux-input-keycodes.o: linux-input-keycodes.c $(COMMON_HEADERS) $(CC) $(GENERIC_CFLAGS) $(EXTRA_CFLAGS) -o $@ -c $< diff --git a/RemoteControlManager.xml b/RemoteControlManager.xml index 6577dd0..78cef7a 100644 --- a/RemoteControlManager.xml +++ b/RemoteControlManager.xml @@ -24,6 +24,8 @@ + + diff --git a/keymaps/default/test2.layout b/keymaps/default/test2.layout index 16bfa23..eeee7e1 100644 --- a/keymaps/default/test2.layout +++ b/keymaps/default/test2.layout @@ -15,7 +15,7 @@ Map=nec:0xf00f0006:KEY_NUMERIC_6 Map=nec:0xf00f0007:KEY_NUMERIC_7 Map=nec:0xf00f0008:KEY_NUMERIC_8 Map=nec:0xf00f0009:KEY_NUMERIC_9 -Map=nec:0xf00f0010:KEY_OK +Map=nec:0x07f80ff0:KEY_OK Map=nec:0xf00f0011:KEY_UP Map=nec:0xf00f0012:KEY_DOWN Map=nec:0xf00f0013:KEY_LEFT diff --git a/linux-input-enum.h b/linux-input-enum.h deleted file mode 100644 index 8aa9cf0..0000000 --- a/linux-input-enum.h +++ /dev/null @@ -1,428 +0,0 @@ -#ifndef foolinuxinputenumhfoo -#define foolinuximputenumhfoo - -/* AUTOGENERATED: DO NOT EDIT */ - -enum linux_input_keyval { - KEY_RESERVED = 0, - KEY_ESC = 1, - KEY_1 = 2, - KEY_2 = 3, - KEY_3 = 4, - KEY_4 = 5, - KEY_5 = 6, - KEY_6 = 7, - KEY_7 = 8, - KEY_8 = 9, - KEY_9 = 10, - KEY_0 = 11, - KEY_MINUS = 12, - KEY_EQUAL = 13, - KEY_BACKSPACE = 14, - KEY_TAB = 15, - KEY_Q = 16, - KEY_W = 17, - KEY_E = 18, - KEY_R = 19, - KEY_T = 20, - KEY_Y = 21, - KEY_U = 22, - KEY_I = 23, - KEY_O = 24, - KEY_P = 25, - KEY_LEFTBRACE = 26, - KEY_RIGHTBRACE = 27, - KEY_ENTER = 28, - KEY_LEFTCTRL = 29, - KEY_A = 30, - KEY_S = 31, - KEY_D = 32, - KEY_F = 33, - KEY_G = 34, - KEY_H = 35, - KEY_J = 36, - KEY_K = 37, - KEY_L = 38, - KEY_SEMICOLON = 39, - KEY_APOSTROPHE = 40, - KEY_GRAVE = 41, - KEY_LEFTSHIFT = 42, - KEY_BACKSLASH = 43, - KEY_Z = 44, - KEY_X = 45, - KEY_C = 46, - KEY_V = 47, - KEY_B = 48, - KEY_N = 49, - KEY_M = 50, - KEY_COMMA = 51, - KEY_DOT = 52, - KEY_SLASH = 53, - KEY_RIGHTSHIFT = 54, - KEY_KPASTERISK = 55, - KEY_LEFTALT = 56, - KEY_SPACE = 57, - KEY_CAPSLOCK = 58, - KEY_F1 = 59, - KEY_F2 = 60, - KEY_F3 = 61, - KEY_F4 = 62, - KEY_F5 = 63, - KEY_F6 = 64, - KEY_F7 = 65, - KEY_F8 = 66, - KEY_F9 = 67, - KEY_F10 = 68, - KEY_NUMLOCK = 69, - KEY_SCROLLLOCK = 70, - KEY_KP7 = 71, - KEY_KP8 = 72, - KEY_KP9 = 73, - KEY_KPMINUS = 74, - KEY_KP4 = 75, - KEY_KP5 = 76, - KEY_KP6 = 77, - KEY_KPPLUS = 78, - KEY_KP1 = 79, - KEY_KP2 = 80, - KEY_KP3 = 81, - KEY_KP0 = 82, - KEY_KPDOT = 83, - KEY_ZENKAKUHANKAKU = 85, - KEY_102ND = 86, - KEY_F11 = 87, - KEY_F12 = 88, - KEY_RO = 89, - KEY_KATAKANA = 90, - KEY_HIRAGANA = 91, - KEY_HENKAN = 92, - KEY_KATAKANAHIRAGANA = 93, - KEY_MUHENKAN = 94, - KEY_KPJPCOMMA = 95, - KEY_KPENTER = 96, - KEY_RIGHTCTRL = 97, - KEY_KPSLASH = 98, - KEY_SYSRQ = 99, - KEY_RIGHTALT = 100, - KEY_LINEFEED = 101, - KEY_HOME = 102, - KEY_UP = 103, - KEY_PAGEUP = 104, - KEY_LEFT = 105, - KEY_RIGHT = 106, - KEY_END = 107, - KEY_DOWN = 108, - KEY_PAGEDOWN = 109, - KEY_INSERT = 110, - KEY_DELETE = 111, - KEY_MACRO = 112, - KEY_MUTE = 113, - KEY_VOLUMEDOWN = 114, - KEY_VOLUMEUP = 115, - KEY_POWER = 116, - KEY_KPEQUAL = 117, - KEY_KPPLUSMINUS = 118, - KEY_PAUSE = 119, - KEY_SCALE = 120, - KEY_KPCOMMA = 121, - KEY_HANGEUL = 122, - KEY_HANGUEL = KEY_HANGEUL, - KEY_HANJA = 123, - KEY_YEN = 124, - KEY_LEFTMETA = 125, - KEY_RIGHTMETA = 126, - KEY_COMPOSE = 127, - KEY_STOP = 128, - KEY_AGAIN = 129, - KEY_PROPS = 130, - KEY_UNDO = 131, - KEY_FRONT = 132, - KEY_COPY = 133, - KEY_OPEN = 134, - KEY_PASTE = 135, - KEY_FIND = 136, - KEY_CUT = 137, - KEY_HELP = 138, - KEY_MENU = 139, - KEY_CALC = 140, - KEY_SETUP = 141, - KEY_SLEEP = 142, - KEY_WAKEUP = 143, - KEY_FILE = 144, - KEY_SENDFILE = 145, - KEY_DELETEFILE = 146, - KEY_XFER = 147, - KEY_PROG1 = 148, - KEY_PROG2 = 149, - KEY_WWW = 150, - KEY_MSDOS = 151, - KEY_COFFEE = 152, - KEY_SCREENLOCK = KEY_COFFEE, - KEY_DIRECTION = 153, - KEY_CYCLEWINDOWS = 154, - KEY_MAIL = 155, - KEY_BOOKMARKS = 156, - KEY_COMPUTER = 157, - KEY_BACK = 158, - KEY_FORWARD = 159, - KEY_CLOSECD = 160, - KEY_EJECTCD = 161, - KEY_EJECTCLOSECD = 162, - KEY_NEXTSONG = 163, - KEY_PLAYPAUSE = 164, - KEY_PREVIOUSSONG = 165, - KEY_STOPCD = 166, - KEY_RECORD = 167, - KEY_REWIND = 168, - KEY_PHONE = 169, - KEY_ISO = 170, - KEY_CONFIG = 171, - KEY_HOMEPAGE = 172, - KEY_REFRESH = 173, - KEY_EXIT = 174, - KEY_MOVE = 175, - KEY_EDIT = 176, - KEY_SCROLLUP = 177, - KEY_SCROLLDOWN = 178, - KEY_KPLEFTPAREN = 179, - KEY_KPRIGHTPAREN = 180, - KEY_NEW = 181, - KEY_REDO = 182, - KEY_F13 = 183, - KEY_F14 = 184, - KEY_F15 = 185, - KEY_F16 = 186, - KEY_F17 = 187, - KEY_F18 = 188, - KEY_F19 = 189, - KEY_F20 = 190, - KEY_F21 = 191, - KEY_F22 = 192, - KEY_F23 = 193, - KEY_F24 = 194, - KEY_PLAYCD = 200, - KEY_PAUSECD = 201, - KEY_PROG3 = 202, - KEY_PROG4 = 203, - KEY_DASHBOARD = 204, - KEY_SUSPEND = 205, - KEY_CLOSE = 206, - KEY_PLAY = 207, - KEY_FASTFORWARD = 208, - KEY_BASSBOOST = 209, - KEY_PRINT = 210, - KEY_HP = 211, - KEY_CAMERA = 212, - KEY_SOUND = 213, - KEY_QUESTION = 214, - KEY_EMAIL = 215, - KEY_CHAT = 216, - KEY_SEARCH = 217, - KEY_CONNECT = 218, - KEY_FINANCE = 219, - KEY_SPORT = 220, - KEY_SHOP = 221, - KEY_ALTERASE = 222, - KEY_CANCEL = 223, - KEY_BRIGHTNESSDOWN = 224, - KEY_BRIGHTNESSUP = 225, - KEY_MEDIA = 226, - KEY_SWITCHVIDEOMODE = 227, - KEY_KBDILLUMTOGGLE = 228, - KEY_KBDILLUMDOWN = 229, - KEY_KBDILLUMUP = 230, - KEY_SEND = 231, - KEY_REPLY = 232, - KEY_FORWARDMAIL = 233, - KEY_SAVE = 234, - KEY_DOCUMENTS = 235, - KEY_BATTERY = 236, - KEY_BLUETOOTH = 237, - KEY_WLAN = 238, - KEY_UWB = 239, - KEY_UNKNOWN = 240, - KEY_VIDEO_NEXT = 241, - KEY_VIDEO_PREV = 242, - KEY_BRIGHTNESS_CYCLE = 243, - KEY_BRIGHTNESS_AUTO = 244, - KEY_BRIGHTNESS_ZERO = KEY_BRIGHTNESS_AUTO, - KEY_DISPLAY_OFF = 245, - KEY_WWAN = 246, - KEY_WIMAX = KEY_WWAN, - KEY_RFKILL = 247, - KEY_MICMUTE = 248, - KEY_OK = 0x160, - KEY_SELECT = 0x161, - KEY_GOTO = 0x162, - KEY_CLEAR = 0x163, - KEY_POWER2 = 0x164, - KEY_OPTION = 0x165, - KEY_INFO = 0x166, - KEY_TIME = 0x167, - KEY_VENDOR = 0x168, - KEY_ARCHIVE = 0x169, - KEY_PROGRAM = 0x16a, - KEY_CHANNEL = 0x16b, - KEY_FAVORITES = 0x16c, - KEY_EPG = 0x16d, - KEY_PVR = 0x16e, - KEY_MHP = 0x16f, - KEY_LANGUAGE = 0x170, - KEY_TITLE = 0x171, - KEY_SUBTITLE = 0x172, - KEY_ANGLE = 0x173, - KEY_ZOOM = 0x174, - KEY_MODE = 0x175, - KEY_KEYBOARD = 0x176, - KEY_SCREEN = 0x177, - KEY_PC = 0x178, - KEY_TV = 0x179, - KEY_TV2 = 0x17a, - KEY_VCR = 0x17b, - KEY_VCR2 = 0x17c, - KEY_SAT = 0x17d, - KEY_SAT2 = 0x17e, - KEY_CD = 0x17f, - KEY_TAPE = 0x180, - KEY_RADIO = 0x181, - KEY_TUNER = 0x182, - KEY_PLAYER = 0x183, - KEY_TEXT = 0x184, - KEY_DVD = 0x185, - KEY_AUX = 0x186, - KEY_MP3 = 0x187, - KEY_AUDIO = 0x188, - KEY_VIDEO = 0x189, - KEY_DIRECTORY = 0x18a, - KEY_LIST = 0x18b, - KEY_MEMO = 0x18c, - KEY_CALENDAR = 0x18d, - KEY_RED = 0x18e, - KEY_GREEN = 0x18f, - KEY_YELLOW = 0x190, - KEY_BLUE = 0x191, - KEY_CHANNELUP = 0x192, - KEY_CHANNELDOWN = 0x193, - KEY_FIRST = 0x194, - KEY_LAST = 0x195, - KEY_AB = 0x196, - KEY_NEXT = 0x197, - KEY_RESTART = 0x198, - KEY_SLOW = 0x199, - KEY_SHUFFLE = 0x19a, - KEY_BREAK = 0x19b, - KEY_PREVIOUS = 0x19c, - KEY_DIGITS = 0x19d, - KEY_TEEN = 0x19e, - KEY_TWEN = 0x19f, - KEY_VIDEOPHONE = 0x1a0, - KEY_GAMES = 0x1a1, - KEY_ZOOMIN = 0x1a2, - KEY_ZOOMOUT = 0x1a3, - KEY_ZOOMRESET = 0x1a4, - KEY_WORDPROCESSOR = 0x1a5, - KEY_EDITOR = 0x1a6, - KEY_SPREADSHEET = 0x1a7, - KEY_GRAPHICSEDITOR = 0x1a8, - KEY_PRESENTATION = 0x1a9, - KEY_DATABASE = 0x1aa, - KEY_NEWS = 0x1ab, - KEY_VOICEMAIL = 0x1ac, - KEY_ADDRESSBOOK = 0x1ad, - KEY_MESSENGER = 0x1ae, - KEY_DISPLAYTOGGLE = 0x1af, - KEY_BRIGHTNESS_TOGGLE = KEY_DISPLAYTOGGLE, - KEY_SPELLCHECK = 0x1b0, - KEY_LOGOFF = 0x1b1, - KEY_DOLLAR = 0x1b2, - KEY_EURO = 0x1b3, - KEY_FRAMEBACK = 0x1b4, - KEY_FRAMEFORWARD = 0x1b5, - KEY_CONTEXT_MENU = 0x1b6, - KEY_MEDIA_REPEAT = 0x1b7, - KEY_10CHANNELSUP = 0x1b8, - KEY_10CHANNELSDOWN = 0x1b9, - KEY_IMAGES = 0x1ba, - KEY_DEL_EOL = 0x1c0, - KEY_DEL_EOS = 0x1c1, - KEY_INS_LINE = 0x1c2, - KEY_DEL_LINE = 0x1c3, - KEY_FN = 0x1d0, - KEY_FN_ESC = 0x1d1, - KEY_FN_F1 = 0x1d2, - KEY_FN_F2 = 0x1d3, - KEY_FN_F3 = 0x1d4, - KEY_FN_F4 = 0x1d5, - KEY_FN_F5 = 0x1d6, - KEY_FN_F6 = 0x1d7, - KEY_FN_F7 = 0x1d8, - KEY_FN_F8 = 0x1d9, - KEY_FN_F9 = 0x1da, - KEY_FN_F10 = 0x1db, - KEY_FN_F11 = 0x1dc, - KEY_FN_F12 = 0x1dd, - KEY_FN_1 = 0x1de, - KEY_FN_2 = 0x1df, - KEY_FN_D = 0x1e0, - KEY_FN_E = 0x1e1, - KEY_FN_F = 0x1e2, - KEY_FN_S = 0x1e3, - KEY_FN_B = 0x1e4, - KEY_BRL_DOT1 = 0x1f1, - KEY_BRL_DOT2 = 0x1f2, - KEY_BRL_DOT3 = 0x1f3, - KEY_BRL_DOT4 = 0x1f4, - KEY_BRL_DOT5 = 0x1f5, - KEY_BRL_DOT6 = 0x1f6, - KEY_BRL_DOT7 = 0x1f7, - KEY_BRL_DOT8 = 0x1f8, - KEY_BRL_DOT9 = 0x1f9, - KEY_BRL_DOT10 = 0x1fa, - KEY_NUMERIC_0 = 0x200, - KEY_NUMERIC_1 = 0x201, - KEY_NUMERIC_2 = 0x202, - KEY_NUMERIC_3 = 0x203, - KEY_NUMERIC_4 = 0x204, - KEY_NUMERIC_5 = 0x205, - KEY_NUMERIC_6 = 0x206, - KEY_NUMERIC_7 = 0x207, - KEY_NUMERIC_8 = 0x208, - KEY_NUMERIC_9 = 0x209, - KEY_NUMERIC_STAR = 0x20a, - KEY_NUMERIC_POUND = 0x20b, - KEY_CAMERA_FOCUS = 0x210, - KEY_WPS_BUTTON = 0x211, - KEY_TOUCHPAD_TOGGLE = 0x212, - KEY_TOUCHPAD_ON = 0x213, - KEY_TOUCHPAD_OFF = 0x214, - KEY_CAMERA_ZOOMIN = 0x215, - KEY_CAMERA_ZOOMOUT = 0x216, - KEY_CAMERA_UP = 0x217, - KEY_CAMERA_DOWN = 0x218, - KEY_CAMERA_LEFT = 0x219, - KEY_CAMERA_RIGHT = 0x21a, - KEY_ATTENDANT_ON = 0x21b, - KEY_ATTENDANT_OFF = 0x21c, - KEY_ATTENDANT_TOGGLE = 0x21d, - KEY_LIGHTS_TOGGLE = 0x21e, - KEY_ALS_TOGGLE = 0x230, - KEY_BUTTONCONFIG = 0x240, - KEY_TASKMANAGER = 0x241, - KEY_JOURNAL = 0x242, - KEY_CONTROLPANEL = 0x243, - KEY_APPSELECT = 0x244, - KEY_SCREENSAVER = 0x245, - KEY_VOICECOMMAND = 0x246, - KEY_BRIGHTNESS_MIN = 0x250, - KEY_BRIGHTNESS_MAX = 0x251, - KEY_KBDINPUTASSIST_PREV = 0x260, - KEY_KBDINPUTASSIST_NEXT = 0x261, - KEY_KBDINPUTASSIST_PREVGROUP = 0x262, - KEY_KBDINPUTASSIST_NEXTGROUP = 0x263, - KEY_KBDINPUTASSIST_ACCEPT = 0x264, - KEY_KBDINPUTASSIST_CANCEL = 0x265, - KEY_MIN_INTERESTING = KEY_MUTE, - KEY_MAX = 0x2ff, - KEY_CNT = (KEY_MAX+1), -}; -#endif diff --git a/linux-input-keycodes.c b/linux-input-keycodes.c deleted file mode 100644 index b9d2499..0000000 --- a/linux-input-keycodes.c +++ /dev/null @@ -1,428 +0,0 @@ -/* AUTOGENERATED: DO NOT EDIT */ - -#include "linux-input.h" -#include "linux-input-keycodes.h" - -struct linux_input_keycode linux_input_keycodes[] = { - { "KEY_RESERVED", KEY_RESERVED, false, NULL }, - { "KEY_ESC", KEY_ESC, false, NULL }, - { "KEY_1", KEY_1, false, NULL }, - { "KEY_2", KEY_2, false, NULL }, - { "KEY_3", KEY_3, false, NULL }, - { "KEY_4", KEY_4, false, NULL }, - { "KEY_5", KEY_5, false, NULL }, - { "KEY_6", KEY_6, false, NULL }, - { "KEY_7", KEY_7, false, NULL }, - { "KEY_8", KEY_8, false, NULL }, - { "KEY_9", KEY_9, false, NULL }, - { "KEY_0", KEY_0, false, NULL }, - { "KEY_MINUS", KEY_MINUS, false, NULL }, - { "KEY_EQUAL", KEY_EQUAL, false, NULL }, - { "KEY_BACKSPACE", KEY_BACKSPACE, false, NULL }, - { "KEY_TAB", KEY_TAB, false, NULL }, - { "KEY_Q", KEY_Q, false, NULL }, - { "KEY_W", KEY_W, false, NULL }, - { "KEY_E", KEY_E, false, NULL }, - { "KEY_R", KEY_R, false, NULL }, - { "KEY_T", KEY_T, false, NULL }, - { "KEY_Y", KEY_Y, false, NULL }, - { "KEY_U", KEY_U, false, NULL }, - { "KEY_I", KEY_I, false, NULL }, - { "KEY_O", KEY_O, false, NULL }, - { "KEY_P", KEY_P, false, NULL }, - { "KEY_LEFTBRACE", KEY_LEFTBRACE, false, NULL }, - { "KEY_RIGHTBRACE", KEY_RIGHTBRACE, false, NULL }, - { "KEY_ENTER", KEY_ENTER, false, NULL }, - { "KEY_LEFTCTRL", KEY_LEFTCTRL, false, NULL }, - { "KEY_A", KEY_A, false, NULL }, - { "KEY_S", KEY_S, false, NULL }, - { "KEY_D", KEY_D, false, NULL }, - { "KEY_F", KEY_F, false, NULL }, - { "KEY_G", KEY_G, false, NULL }, - { "KEY_H", KEY_H, false, NULL }, - { "KEY_J", KEY_J, false, NULL }, - { "KEY_K", KEY_K, false, NULL }, - { "KEY_L", KEY_L, false, NULL }, - { "KEY_SEMICOLON", KEY_SEMICOLON, false, NULL }, - { "KEY_APOSTROPHE", KEY_APOSTROPHE, false, NULL }, - { "KEY_GRAVE", KEY_GRAVE, false, NULL }, - { "KEY_LEFTSHIFT", KEY_LEFTSHIFT, false, NULL }, - { "KEY_BACKSLASH", KEY_BACKSLASH, false, NULL }, - { "KEY_Z", KEY_Z, false, NULL }, - { "KEY_X", KEY_X, false, NULL }, - { "KEY_C", KEY_C, false, NULL }, - { "KEY_V", KEY_V, false, NULL }, - { "KEY_B", KEY_B, false, NULL }, - { "KEY_N", KEY_N, false, NULL }, - { "KEY_M", KEY_M, false, NULL }, - { "KEY_COMMA", KEY_COMMA, false, NULL }, - { "KEY_DOT", KEY_DOT, false, NULL }, - { "KEY_SLASH", KEY_SLASH, false, NULL }, - { "KEY_RIGHTSHIFT", KEY_RIGHTSHIFT, false, NULL }, - { "KEY_KPASTERISK", KEY_KPASTERISK, false, NULL }, - { "KEY_LEFTALT", KEY_LEFTALT, false, NULL }, - { "KEY_SPACE", KEY_SPACE, false, NULL }, - { "KEY_CAPSLOCK", KEY_CAPSLOCK, false, NULL }, - { "KEY_F1", KEY_F1, false, NULL }, - { "KEY_F2", KEY_F2, false, NULL }, - { "KEY_F3", KEY_F3, false, NULL }, - { "KEY_F4", KEY_F4, false, NULL }, - { "KEY_F5", KEY_F5, false, NULL }, - { "KEY_F6", KEY_F6, false, NULL }, - { "KEY_F7", KEY_F7, false, NULL }, - { "KEY_F8", KEY_F8, false, NULL }, - { "KEY_F9", KEY_F9, false, NULL }, - { "KEY_F10", KEY_F10, false, NULL }, - { "KEY_NUMLOCK", KEY_NUMLOCK, false, NULL }, - { "KEY_SCROLLLOCK", KEY_SCROLLLOCK, false, NULL }, - { "KEY_KP7", KEY_KP7, false, NULL }, - { "KEY_KP8", KEY_KP8, false, NULL }, - { "KEY_KP9", KEY_KP9, false, NULL }, - { "KEY_KPMINUS", KEY_KPMINUS, false, NULL }, - { "KEY_KP4", KEY_KP4, false, NULL }, - { "KEY_KP5", KEY_KP5, false, NULL }, - { "KEY_KP6", KEY_KP6, false, NULL }, - { "KEY_KPPLUS", KEY_KPPLUS, false, NULL }, - { "KEY_KP1", KEY_KP1, false, NULL }, - { "KEY_KP2", KEY_KP2, false, NULL }, - { "KEY_KP3", KEY_KP3, false, NULL }, - { "KEY_KP0", KEY_KP0, false, NULL }, - { "KEY_KPDOT", KEY_KPDOT, false, NULL }, - { "KEY_ZENKAKUHANKAKU", KEY_ZENKAKUHANKAKU, false, NULL }, - { "KEY_102ND", KEY_102ND, false, NULL }, - { "KEY_F11", KEY_F11, false, NULL }, - { "KEY_F12", KEY_F12, false, NULL }, - { "KEY_RO", KEY_RO, false, NULL }, - { "KEY_KATAKANA", KEY_KATAKANA, false, NULL }, - { "KEY_HIRAGANA", KEY_HIRAGANA, false, NULL }, - { "KEY_HENKAN", KEY_HENKAN, false, NULL }, - { "KEY_KATAKANAHIRAGANA", KEY_KATAKANAHIRAGANA, false, NULL }, - { "KEY_MUHENKAN", KEY_MUHENKAN, false, NULL }, - { "KEY_KPJPCOMMA", KEY_KPJPCOMMA, false, NULL }, - { "KEY_KPENTER", KEY_KPENTER, false, NULL }, - { "KEY_RIGHTCTRL", KEY_RIGHTCTRL, false, NULL }, - { "KEY_KPSLASH", KEY_KPSLASH, false, NULL }, - { "KEY_SYSRQ", KEY_SYSRQ, false, NULL }, - { "KEY_RIGHTALT", KEY_RIGHTALT, false, NULL }, - { "KEY_LINEFEED", KEY_LINEFEED, false, NULL }, - { "KEY_HOME", KEY_HOME, false, NULL }, - { "KEY_UP", KEY_UP, false, NULL }, - { "KEY_PAGEUP", KEY_PAGEUP, false, NULL }, - { "KEY_LEFT", KEY_LEFT, false, NULL }, - { "KEY_RIGHT", KEY_RIGHT, false, NULL }, - { "KEY_END", KEY_END, false, NULL }, - { "KEY_DOWN", KEY_DOWN, false, NULL }, - { "KEY_PAGEDOWN", KEY_PAGEDOWN, false, NULL }, - { "KEY_INSERT", KEY_INSERT, false, NULL }, - { "KEY_DELETE", KEY_DELETE, false, NULL }, - { "KEY_MACRO", KEY_MACRO, false, NULL }, - { "KEY_MUTE", KEY_MUTE, false, NULL }, - { "KEY_VOLUMEDOWN", KEY_VOLUMEDOWN, false, NULL }, - { "KEY_VOLUMEUP", KEY_VOLUMEUP, false, NULL }, - { "KEY_POWER", KEY_POWER, false, NULL }, - { "KEY_KPEQUAL", KEY_KPEQUAL, false, NULL }, - { "KEY_KPPLUSMINUS", KEY_KPPLUSMINUS, false, NULL }, - { "KEY_PAUSE", KEY_PAUSE, false, NULL }, - { "KEY_SCALE", KEY_SCALE, false, NULL }, - { "KEY_KPCOMMA", KEY_KPCOMMA, false, NULL }, - { "KEY_HANGEUL", KEY_HANGEUL, false, NULL }, - { "KEY_HANGUEL", KEY_HANGUEL, true, NULL }, - { "KEY_HANJA", KEY_HANJA, false, NULL }, - { "KEY_YEN", KEY_YEN, false, NULL }, - { "KEY_LEFTMETA", KEY_LEFTMETA, false, NULL }, - { "KEY_RIGHTMETA", KEY_RIGHTMETA, false, NULL }, - { "KEY_COMPOSE", KEY_COMPOSE, false, NULL }, - { "KEY_STOP", KEY_STOP, false, NULL }, - { "KEY_AGAIN", KEY_AGAIN, false, NULL }, - { "KEY_PROPS", KEY_PROPS, false, NULL }, - { "KEY_UNDO", KEY_UNDO, false, NULL }, - { "KEY_FRONT", KEY_FRONT, false, NULL }, - { "KEY_COPY", KEY_COPY, false, NULL }, - { "KEY_OPEN", KEY_OPEN, false, NULL }, - { "KEY_PASTE", KEY_PASTE, false, NULL }, - { "KEY_FIND", KEY_FIND, false, NULL }, - { "KEY_CUT", KEY_CUT, false, NULL }, - { "KEY_HELP", KEY_HELP, false, NULL }, - { "KEY_MENU", KEY_MENU, false, NULL }, - { "KEY_CALC", KEY_CALC, false, NULL }, - { "KEY_SETUP", KEY_SETUP, false, NULL }, - { "KEY_SLEEP", KEY_SLEEP, false, NULL }, - { "KEY_WAKEUP", KEY_WAKEUP, false, NULL }, - { "KEY_FILE", KEY_FILE, false, NULL }, - { "KEY_SENDFILE", KEY_SENDFILE, false, NULL }, - { "KEY_DELETEFILE", KEY_DELETEFILE, false, NULL }, - { "KEY_XFER", KEY_XFER, false, NULL }, - { "KEY_PROG1", KEY_PROG1, false, NULL }, - { "KEY_PROG2", KEY_PROG2, false, NULL }, - { "KEY_WWW", KEY_WWW, false, NULL }, - { "KEY_MSDOS", KEY_MSDOS, false, NULL }, - { "KEY_COFFEE", KEY_COFFEE, false, NULL }, - { "KEY_SCREENLOCK", KEY_SCREENLOCK, true, NULL }, - { "KEY_DIRECTION", KEY_DIRECTION, false, NULL }, - { "KEY_CYCLEWINDOWS", KEY_CYCLEWINDOWS, false, NULL }, - { "KEY_MAIL", KEY_MAIL, false, NULL }, - { "KEY_BOOKMARKS", KEY_BOOKMARKS, false, NULL }, - { "KEY_COMPUTER", KEY_COMPUTER, false, NULL }, - { "KEY_BACK", KEY_BACK, false, NULL }, - { "KEY_FORWARD", KEY_FORWARD, false, NULL }, - { "KEY_CLOSECD", KEY_CLOSECD, false, NULL }, - { "KEY_EJECTCD", KEY_EJECTCD, false, NULL }, - { "KEY_EJECTCLOSECD", KEY_EJECTCLOSECD, false, NULL }, - { "KEY_NEXTSONG", KEY_NEXTSONG, false, NULL }, - { "KEY_PLAYPAUSE", KEY_PLAYPAUSE, false, NULL }, - { "KEY_PREVIOUSSONG", KEY_PREVIOUSSONG, false, NULL }, - { "KEY_STOPCD", KEY_STOPCD, false, NULL }, - { "KEY_RECORD", KEY_RECORD, false, NULL }, - { "KEY_REWIND", KEY_REWIND, false, NULL }, - { "KEY_PHONE", KEY_PHONE, false, NULL }, - { "KEY_ISO", KEY_ISO, false, NULL }, - { "KEY_CONFIG", KEY_CONFIG, false, NULL }, - { "KEY_HOMEPAGE", KEY_HOMEPAGE, false, NULL }, - { "KEY_REFRESH", KEY_REFRESH, false, NULL }, - { "KEY_EXIT", KEY_EXIT, false, NULL }, - { "KEY_MOVE", KEY_MOVE, false, NULL }, - { "KEY_EDIT", KEY_EDIT, false, NULL }, - { "KEY_SCROLLUP", KEY_SCROLLUP, false, NULL }, - { "KEY_SCROLLDOWN", KEY_SCROLLDOWN, false, NULL }, - { "KEY_KPLEFTPAREN", KEY_KPLEFTPAREN, false, NULL }, - { "KEY_KPRIGHTPAREN", KEY_KPRIGHTPAREN, false, NULL }, - { "KEY_NEW", KEY_NEW, false, NULL }, - { "KEY_REDO", KEY_REDO, false, NULL }, - { "KEY_F13", KEY_F13, false, NULL }, - { "KEY_F14", KEY_F14, false, NULL }, - { "KEY_F15", KEY_F15, false, NULL }, - { "KEY_F16", KEY_F16, false, NULL }, - { "KEY_F17", KEY_F17, false, NULL }, - { "KEY_F18", KEY_F18, false, NULL }, - { "KEY_F19", KEY_F19, false, NULL }, - { "KEY_F20", KEY_F20, false, NULL }, - { "KEY_F21", KEY_F21, false, NULL }, - { "KEY_F22", KEY_F22, false, NULL }, - { "KEY_F23", KEY_F23, false, NULL }, - { "KEY_F24", KEY_F24, false, NULL }, - { "KEY_PLAYCD", KEY_PLAYCD, false, NULL }, - { "KEY_PAUSECD", KEY_PAUSECD, false, NULL }, - { "KEY_PROG3", KEY_PROG3, false, NULL }, - { "KEY_PROG4", KEY_PROG4, false, NULL }, - { "KEY_DASHBOARD", KEY_DASHBOARD, false, NULL }, - { "KEY_SUSPEND", KEY_SUSPEND, false, NULL }, - { "KEY_CLOSE", KEY_CLOSE, false, NULL }, - { "KEY_PLAY", KEY_PLAY, false, NULL }, - { "KEY_FASTFORWARD", KEY_FASTFORWARD, false, NULL }, - { "KEY_BASSBOOST", KEY_BASSBOOST, false, NULL }, - { "KEY_PRINT", KEY_PRINT, false, NULL }, - { "KEY_HP", KEY_HP, false, NULL }, - { "KEY_CAMERA", KEY_CAMERA, false, NULL }, - { "KEY_SOUND", KEY_SOUND, false, NULL }, - { "KEY_QUESTION", KEY_QUESTION, false, NULL }, - { "KEY_EMAIL", KEY_EMAIL, false, NULL }, - { "KEY_CHAT", KEY_CHAT, false, NULL }, - { "KEY_SEARCH", KEY_SEARCH, false, NULL }, - { "KEY_CONNECT", KEY_CONNECT, false, NULL }, - { "KEY_FINANCE", KEY_FINANCE, false, NULL }, - { "KEY_SPORT", KEY_SPORT, false, NULL }, - { "KEY_SHOP", KEY_SHOP, false, NULL }, - { "KEY_ALTERASE", KEY_ALTERASE, false, NULL }, - { "KEY_CANCEL", KEY_CANCEL, false, NULL }, - { "KEY_BRIGHTNESSDOWN", KEY_BRIGHTNESSDOWN, false, NULL }, - { "KEY_BRIGHTNESSUP", KEY_BRIGHTNESSUP, false, NULL }, - { "KEY_MEDIA", KEY_MEDIA, false, NULL }, - { "KEY_SWITCHVIDEOMODE", KEY_SWITCHVIDEOMODE, false, NULL }, - { "KEY_KBDILLUMTOGGLE", KEY_KBDILLUMTOGGLE, false, NULL }, - { "KEY_KBDILLUMDOWN", KEY_KBDILLUMDOWN, false, NULL }, - { "KEY_KBDILLUMUP", KEY_KBDILLUMUP, false, NULL }, - { "KEY_SEND", KEY_SEND, false, NULL }, - { "KEY_REPLY", KEY_REPLY, false, NULL }, - { "KEY_FORWARDMAIL", KEY_FORWARDMAIL, false, NULL }, - { "KEY_SAVE", KEY_SAVE, false, NULL }, - { "KEY_DOCUMENTS", KEY_DOCUMENTS, false, NULL }, - { "KEY_BATTERY", KEY_BATTERY, false, NULL }, - { "KEY_BLUETOOTH", KEY_BLUETOOTH, false, NULL }, - { "KEY_WLAN", KEY_WLAN, false, NULL }, - { "KEY_UWB", KEY_UWB, false, NULL }, - { "KEY_UNKNOWN", KEY_UNKNOWN, false, NULL }, - { "KEY_VIDEO_NEXT", KEY_VIDEO_NEXT, false, NULL }, - { "KEY_VIDEO_PREV", KEY_VIDEO_PREV, false, NULL }, - { "KEY_BRIGHTNESS_CYCLE", KEY_BRIGHTNESS_CYCLE, false, NULL }, - { "KEY_BRIGHTNESS_AUTO", KEY_BRIGHTNESS_AUTO, false, NULL }, - { "KEY_BRIGHTNESS_ZERO", KEY_BRIGHTNESS_ZERO, true, NULL }, - { "KEY_DISPLAY_OFF", KEY_DISPLAY_OFF, false, NULL }, - { "KEY_WWAN", KEY_WWAN, false, NULL }, - { "KEY_WIMAX", KEY_WIMAX, true, NULL }, - { "KEY_RFKILL", KEY_RFKILL, false, NULL }, - { "KEY_MICMUTE", KEY_MICMUTE, false, NULL }, - { "KEY_OK", KEY_OK, false, NULL }, - { "KEY_SELECT", KEY_SELECT, false, NULL }, - { "KEY_GOTO", KEY_GOTO, false, NULL }, - { "KEY_CLEAR", KEY_CLEAR, false, NULL }, - { "KEY_POWER2", KEY_POWER2, false, NULL }, - { "KEY_OPTION", KEY_OPTION, false, NULL }, - { "KEY_INFO", KEY_INFO, false, NULL }, - { "KEY_TIME", KEY_TIME, false, NULL }, - { "KEY_VENDOR", KEY_VENDOR, false, NULL }, - { "KEY_ARCHIVE", KEY_ARCHIVE, false, NULL }, - { "KEY_PROGRAM", KEY_PROGRAM, false, NULL }, - { "KEY_CHANNEL", KEY_CHANNEL, false, NULL }, - { "KEY_FAVORITES", KEY_FAVORITES, false, NULL }, - { "KEY_EPG", KEY_EPG, false, NULL }, - { "KEY_PVR", KEY_PVR, false, NULL }, - { "KEY_MHP", KEY_MHP, false, NULL }, - { "KEY_LANGUAGE", KEY_LANGUAGE, false, NULL }, - { "KEY_TITLE", KEY_TITLE, false, NULL }, - { "KEY_SUBTITLE", KEY_SUBTITLE, false, NULL }, - { "KEY_ANGLE", KEY_ANGLE, false, NULL }, - { "KEY_ZOOM", KEY_ZOOM, false, NULL }, - { "KEY_MODE", KEY_MODE, false, NULL }, - { "KEY_KEYBOARD", KEY_KEYBOARD, false, NULL }, - { "KEY_SCREEN", KEY_SCREEN, false, NULL }, - { "KEY_PC", KEY_PC, false, NULL }, - { "KEY_TV", KEY_TV, false, NULL }, - { "KEY_TV2", KEY_TV2, false, NULL }, - { "KEY_VCR", KEY_VCR, false, NULL }, - { "KEY_VCR2", KEY_VCR2, false, NULL }, - { "KEY_SAT", KEY_SAT, false, NULL }, - { "KEY_SAT2", KEY_SAT2, false, NULL }, - { "KEY_CD", KEY_CD, false, NULL }, - { "KEY_TAPE", KEY_TAPE, false, NULL }, - { "KEY_RADIO", KEY_RADIO, false, NULL }, - { "KEY_TUNER", KEY_TUNER, false, NULL }, - { "KEY_PLAYER", KEY_PLAYER, false, NULL }, - { "KEY_TEXT", KEY_TEXT, false, NULL }, - { "KEY_DVD", KEY_DVD, false, NULL }, - { "KEY_AUX", KEY_AUX, false, NULL }, - { "KEY_MP3", KEY_MP3, false, NULL }, - { "KEY_AUDIO", KEY_AUDIO, false, NULL }, - { "KEY_VIDEO", KEY_VIDEO, false, NULL }, - { "KEY_DIRECTORY", KEY_DIRECTORY, false, NULL }, - { "KEY_LIST", KEY_LIST, false, NULL }, - { "KEY_MEMO", KEY_MEMO, false, NULL }, - { "KEY_CALENDAR", KEY_CALENDAR, false, NULL }, - { "KEY_RED", KEY_RED, false, NULL }, - { "KEY_GREEN", KEY_GREEN, false, NULL }, - { "KEY_YELLOW", KEY_YELLOW, false, NULL }, - { "KEY_BLUE", KEY_BLUE, false, NULL }, - { "KEY_CHANNELUP", KEY_CHANNELUP, false, NULL }, - { "KEY_CHANNELDOWN", KEY_CHANNELDOWN, false, NULL }, - { "KEY_FIRST", KEY_FIRST, false, NULL }, - { "KEY_LAST", KEY_LAST, false, NULL }, - { "KEY_AB", KEY_AB, false, NULL }, - { "KEY_NEXT", KEY_NEXT, false, NULL }, - { "KEY_RESTART", KEY_RESTART, false, NULL }, - { "KEY_SLOW", KEY_SLOW, false, NULL }, - { "KEY_SHUFFLE", KEY_SHUFFLE, false, NULL }, - { "KEY_BREAK", KEY_BREAK, false, NULL }, - { "KEY_PREVIOUS", KEY_PREVIOUS, false, NULL }, - { "KEY_DIGITS", KEY_DIGITS, false, NULL }, - { "KEY_TEEN", KEY_TEEN, false, NULL }, - { "KEY_TWEN", KEY_TWEN, false, NULL }, - { "KEY_VIDEOPHONE", KEY_VIDEOPHONE, false, NULL }, - { "KEY_GAMES", KEY_GAMES, false, NULL }, - { "KEY_ZOOMIN", KEY_ZOOMIN, false, NULL }, - { "KEY_ZOOMOUT", KEY_ZOOMOUT, false, NULL }, - { "KEY_ZOOMRESET", KEY_ZOOMRESET, false, NULL }, - { "KEY_WORDPROCESSOR", KEY_WORDPROCESSOR, false, NULL }, - { "KEY_EDITOR", KEY_EDITOR, false, NULL }, - { "KEY_SPREADSHEET", KEY_SPREADSHEET, false, NULL }, - { "KEY_GRAPHICSEDITOR", KEY_GRAPHICSEDITOR, false, NULL }, - { "KEY_PRESENTATION", KEY_PRESENTATION, false, NULL }, - { "KEY_DATABASE", KEY_DATABASE, false, NULL }, - { "KEY_NEWS", KEY_NEWS, false, NULL }, - { "KEY_VOICEMAIL", KEY_VOICEMAIL, false, NULL }, - { "KEY_ADDRESSBOOK", KEY_ADDRESSBOOK, false, NULL }, - { "KEY_MESSENGER", KEY_MESSENGER, false, NULL }, - { "KEY_DISPLAYTOGGLE", KEY_DISPLAYTOGGLE, false, NULL }, - { "KEY_BRIGHTNESS_TOGGLE", KEY_BRIGHTNESS_TOGGLE, true, NULL }, - { "KEY_SPELLCHECK", KEY_SPELLCHECK, false, NULL }, - { "KEY_LOGOFF", KEY_LOGOFF, false, NULL }, - { "KEY_DOLLAR", KEY_DOLLAR, false, NULL }, - { "KEY_EURO", KEY_EURO, false, NULL }, - { "KEY_FRAMEBACK", KEY_FRAMEBACK, false, NULL }, - { "KEY_FRAMEFORWARD", KEY_FRAMEFORWARD, false, NULL }, - { "KEY_CONTEXT_MENU", KEY_CONTEXT_MENU, false, NULL }, - { "KEY_MEDIA_REPEAT", KEY_MEDIA_REPEAT, false, NULL }, - { "KEY_10CHANNELSUP", KEY_10CHANNELSUP, false, NULL }, - { "KEY_10CHANNELSDOWN", KEY_10CHANNELSDOWN, false, NULL }, - { "KEY_IMAGES", KEY_IMAGES, false, NULL }, - { "KEY_DEL_EOL", KEY_DEL_EOL, false, NULL }, - { "KEY_DEL_EOS", KEY_DEL_EOS, false, NULL }, - { "KEY_INS_LINE", KEY_INS_LINE, false, NULL }, - { "KEY_DEL_LINE", KEY_DEL_LINE, false, NULL }, - { "KEY_FN", KEY_FN, false, NULL }, - { "KEY_FN_ESC", KEY_FN_ESC, false, NULL }, - { "KEY_FN_F1", KEY_FN_F1, false, NULL }, - { "KEY_FN_F2", KEY_FN_F2, false, NULL }, - { "KEY_FN_F3", KEY_FN_F3, false, NULL }, - { "KEY_FN_F4", KEY_FN_F4, false, NULL }, - { "KEY_FN_F5", KEY_FN_F5, false, NULL }, - { "KEY_FN_F6", KEY_FN_F6, false, NULL }, - { "KEY_FN_F7", KEY_FN_F7, false, NULL }, - { "KEY_FN_F8", KEY_FN_F8, false, NULL }, - { "KEY_FN_F9", KEY_FN_F9, false, NULL }, - { "KEY_FN_F10", KEY_FN_F10, false, NULL }, - { "KEY_FN_F11", KEY_FN_F11, false, NULL }, - { "KEY_FN_F12", KEY_FN_F12, false, NULL }, - { "KEY_FN_1", KEY_FN_1, false, NULL }, - { "KEY_FN_2", KEY_FN_2, false, NULL }, - { "KEY_FN_D", KEY_FN_D, false, NULL }, - { "KEY_FN_E", KEY_FN_E, false, NULL }, - { "KEY_FN_F", KEY_FN_F, false, NULL }, - { "KEY_FN_S", KEY_FN_S, false, NULL }, - { "KEY_FN_B", KEY_FN_B, false, NULL }, - { "KEY_BRL_DOT1", KEY_BRL_DOT1, false, NULL }, - { "KEY_BRL_DOT2", KEY_BRL_DOT2, false, NULL }, - { "KEY_BRL_DOT3", KEY_BRL_DOT3, false, NULL }, - { "KEY_BRL_DOT4", KEY_BRL_DOT4, false, NULL }, - { "KEY_BRL_DOT5", KEY_BRL_DOT5, false, NULL }, - { "KEY_BRL_DOT6", KEY_BRL_DOT6, false, NULL }, - { "KEY_BRL_DOT7", KEY_BRL_DOT7, false, NULL }, - { "KEY_BRL_DOT8", KEY_BRL_DOT8, false, NULL }, - { "KEY_BRL_DOT9", KEY_BRL_DOT9, false, NULL }, - { "KEY_BRL_DOT10", KEY_BRL_DOT10, false, NULL }, - { "KEY_NUMERIC_0", KEY_NUMERIC_0, false, NULL }, - { "KEY_NUMERIC_1", KEY_NUMERIC_1, false, NULL }, - { "KEY_NUMERIC_2", KEY_NUMERIC_2, false, NULL }, - { "KEY_NUMERIC_3", KEY_NUMERIC_3, false, NULL }, - { "KEY_NUMERIC_4", KEY_NUMERIC_4, false, NULL }, - { "KEY_NUMERIC_5", KEY_NUMERIC_5, false, NULL }, - { "KEY_NUMERIC_6", KEY_NUMERIC_6, false, NULL }, - { "KEY_NUMERIC_7", KEY_NUMERIC_7, false, NULL }, - { "KEY_NUMERIC_8", KEY_NUMERIC_8, false, NULL }, - { "KEY_NUMERIC_9", KEY_NUMERIC_9, false, NULL }, - { "KEY_NUMERIC_STAR", KEY_NUMERIC_STAR, false, NULL }, - { "KEY_NUMERIC_POUND", KEY_NUMERIC_POUND, false, NULL }, - { "KEY_CAMERA_FOCUS", KEY_CAMERA_FOCUS, false, NULL }, - { "KEY_WPS_BUTTON", KEY_WPS_BUTTON, false, NULL }, - { "KEY_TOUCHPAD_TOGGLE", KEY_TOUCHPAD_TOGGLE, false, NULL }, - { "KEY_TOUCHPAD_ON", KEY_TOUCHPAD_ON, false, NULL }, - { "KEY_TOUCHPAD_OFF", KEY_TOUCHPAD_OFF, false, NULL }, - { "KEY_CAMERA_ZOOMIN", KEY_CAMERA_ZOOMIN, false, NULL }, - { "KEY_CAMERA_ZOOMOUT", KEY_CAMERA_ZOOMOUT, false, NULL }, - { "KEY_CAMERA_UP", KEY_CAMERA_UP, false, NULL }, - { "KEY_CAMERA_DOWN", KEY_CAMERA_DOWN, false, NULL }, - { "KEY_CAMERA_LEFT", KEY_CAMERA_LEFT, false, NULL }, - { "KEY_CAMERA_RIGHT", KEY_CAMERA_RIGHT, false, NULL }, - { "KEY_ATTENDANT_ON", KEY_ATTENDANT_ON, false, NULL }, - { "KEY_ATTENDANT_OFF", KEY_ATTENDANT_OFF, false, NULL }, - { "KEY_ATTENDANT_TOGGLE", KEY_ATTENDANT_TOGGLE, false, NULL }, - { "KEY_LIGHTS_TOGGLE", KEY_LIGHTS_TOGGLE, false, NULL }, - { "KEY_ALS_TOGGLE", KEY_ALS_TOGGLE, false, NULL }, - { "KEY_BUTTONCONFIG", KEY_BUTTONCONFIG, false, NULL }, - { "KEY_TASKMANAGER", KEY_TASKMANAGER, false, NULL }, - { "KEY_JOURNAL", KEY_JOURNAL, false, NULL }, - { "KEY_CONTROLPANEL", KEY_CONTROLPANEL, false, NULL }, - { "KEY_APPSELECT", KEY_APPSELECT, false, NULL }, - { "KEY_SCREENSAVER", KEY_SCREENSAVER, false, NULL }, - { "KEY_VOICECOMMAND", KEY_VOICECOMMAND, false, NULL }, - { "KEY_BRIGHTNESS_MIN", KEY_BRIGHTNESS_MIN, false, NULL }, - { "KEY_BRIGHTNESS_MAX", KEY_BRIGHTNESS_MAX, false, NULL }, - { "KEY_KBDINPUTASSIST_PREV", KEY_KBDINPUTASSIST_PREV, false, NULL }, - { "KEY_KBDINPUTASSIST_NEXT", KEY_KBDINPUTASSIST_NEXT, false, NULL }, - { "KEY_KBDINPUTASSIST_PREVGROUP", KEY_KBDINPUTASSIST_PREVGROUP, false, NULL }, - { "KEY_KBDINPUTASSIST_NEXTGROUP", KEY_KBDINPUTASSIST_NEXTGROUP, false, NULL }, - { "KEY_KBDINPUTASSIST_ACCEPT", KEY_KBDINPUTASSIST_ACCEPT, false, NULL }, - { "KEY_KBDINPUTASSIST_CANCEL", KEY_KBDINPUTASSIST_CANCEL, false, NULL }, - { "KEY_MIN_INTERESTING", KEY_MIN_INTERESTING, true, NULL }, - { "KEY_MAX", KEY_MAX, false, NULL }, - { "KEY_CNT", KEY_CNT, false, NULL }, - { NULL, 0, false, NULL } -}; diff --git a/linux-input-keycodes.h b/linux-input-keycodes.h index d0b6f8c..6a332bd 100644 --- a/linux-input-keycodes.h +++ b/linux-input-keycodes.h @@ -1,20 +1,422 @@ -#ifndef foolinuxinputkeycodesfoo -#define foolinuxinputkeycodesfoo - /* AUTOGENERATED: DO NOT EDIT */ - -#include -#include -#include -#include "linux-input.h" - -struct linux_input_keycode { - const char *name; - uint32_t value; - bool alias; - void *cairo_surface; -}; - -extern struct linux_input_keycode linux_input_keycodes[]; - -#endif + { "KEY_RESERVED", KEY_RESERVED, false, NULL }, + { "KEY_ESC", KEY_ESC, false, NULL }, + { "KEY_1", KEY_1, false, NULL }, + { "KEY_2", KEY_2, false, NULL }, + { "KEY_3", KEY_3, false, NULL }, + { "KEY_4", KEY_4, false, NULL }, + { "KEY_5", KEY_5, false, NULL }, + { "KEY_6", KEY_6, false, NULL }, + { "KEY_7", KEY_7, false, NULL }, + { "KEY_8", KEY_8, false, NULL }, + { "KEY_9", KEY_9, false, NULL }, + { "KEY_0", KEY_0, false, NULL }, + { "KEY_MINUS", KEY_MINUS, false, NULL }, + { "KEY_EQUAL", KEY_EQUAL, false, NULL }, + { "KEY_BACKSPACE", KEY_BACKSPACE, false, NULL }, + { "KEY_TAB", KEY_TAB, false, NULL }, + { "KEY_Q", KEY_Q, false, NULL }, + { "KEY_W", KEY_W, false, NULL }, + { "KEY_E", KEY_E, false, NULL }, + { "KEY_R", KEY_R, false, NULL }, + { "KEY_T", KEY_T, false, NULL }, + { "KEY_Y", KEY_Y, false, NULL }, + { "KEY_U", KEY_U, false, NULL }, + { "KEY_I", KEY_I, false, NULL }, + { "KEY_O", KEY_O, false, NULL }, + { "KEY_P", KEY_P, false, NULL }, + { "KEY_LEFTBRACE", KEY_LEFTBRACE, false, NULL }, + { "KEY_RIGHTBRACE", KEY_RIGHTBRACE, false, NULL }, + { "KEY_ENTER", KEY_ENTER, false, NULL }, + { "KEY_LEFTCTRL", KEY_LEFTCTRL, false, NULL }, + { "KEY_A", KEY_A, false, NULL }, + { "KEY_S", KEY_S, false, NULL }, + { "KEY_D", KEY_D, false, NULL }, + { "KEY_F", KEY_F, false, NULL }, + { "KEY_G", KEY_G, false, NULL }, + { "KEY_H", KEY_H, false, NULL }, + { "KEY_J", KEY_J, false, NULL }, + { "KEY_K", KEY_K, false, NULL }, + { "KEY_L", KEY_L, false, NULL }, + { "KEY_SEMICOLON", KEY_SEMICOLON, false, NULL }, + { "KEY_APOSTROPHE", KEY_APOSTROPHE, false, NULL }, + { "KEY_GRAVE", KEY_GRAVE, false, NULL }, + { "KEY_LEFTSHIFT", KEY_LEFTSHIFT, false, NULL }, + { "KEY_BACKSLASH", KEY_BACKSLASH, false, NULL }, + { "KEY_Z", KEY_Z, false, NULL }, + { "KEY_X", KEY_X, false, NULL }, + { "KEY_C", KEY_C, false, NULL }, + { "KEY_V", KEY_V, false, NULL }, + { "KEY_B", KEY_B, false, NULL }, + { "KEY_N", KEY_N, false, NULL }, + { "KEY_M", KEY_M, false, NULL }, + { "KEY_COMMA", KEY_COMMA, false, NULL }, + { "KEY_DOT", KEY_DOT, false, NULL }, + { "KEY_SLASH", KEY_SLASH, false, NULL }, + { "KEY_RIGHTSHIFT", KEY_RIGHTSHIFT, false, NULL }, + { "KEY_KPASTERISK", KEY_KPASTERISK, false, NULL }, + { "KEY_LEFTALT", KEY_LEFTALT, false, NULL }, + { "KEY_SPACE", KEY_SPACE, false, NULL }, + { "KEY_CAPSLOCK", KEY_CAPSLOCK, false, NULL }, + { "KEY_F1", KEY_F1, false, NULL }, + { "KEY_F2", KEY_F2, false, NULL }, + { "KEY_F3", KEY_F3, false, NULL }, + { "KEY_F4", KEY_F4, false, NULL }, + { "KEY_F5", KEY_F5, false, NULL }, + { "KEY_F6", KEY_F6, false, NULL }, + { "KEY_F7", KEY_F7, false, NULL }, + { "KEY_F8", KEY_F8, false, NULL }, + { "KEY_F9", KEY_F9, false, NULL }, + { "KEY_F10", KEY_F10, false, NULL }, + { "KEY_NUMLOCK", KEY_NUMLOCK, false, NULL }, + { "KEY_SCROLLLOCK", KEY_SCROLLLOCK, false, NULL }, + { "KEY_KP7", KEY_KP7, false, NULL }, + { "KEY_KP8", KEY_KP8, false, NULL }, + { "KEY_KP9", KEY_KP9, false, NULL }, + { "KEY_KPMINUS", KEY_KPMINUS, false, NULL }, + { "KEY_KP4", KEY_KP4, false, NULL }, + { "KEY_KP5", KEY_KP5, false, NULL }, + { "KEY_KP6", KEY_KP6, false, NULL }, + { "KEY_KPPLUS", KEY_KPPLUS, false, NULL }, + { "KEY_KP1", KEY_KP1, false, NULL }, + { "KEY_KP2", KEY_KP2, false, NULL }, + { "KEY_KP3", KEY_KP3, false, NULL }, + { "KEY_KP0", KEY_KP0, false, NULL }, + { "KEY_KPDOT", KEY_KPDOT, false, NULL }, + { "KEY_ZENKAKUHANKAKU", KEY_ZENKAKUHANKAKU, false, NULL }, + { "KEY_102ND", KEY_102ND, false, NULL }, + { "KEY_F11", KEY_F11, false, NULL }, + { "KEY_F12", KEY_F12, false, NULL }, + { "KEY_RO", KEY_RO, false, NULL }, + { "KEY_KATAKANA", KEY_KATAKANA, false, NULL }, + { "KEY_HIRAGANA", KEY_HIRAGANA, false, NULL }, + { "KEY_HENKAN", KEY_HENKAN, false, NULL }, + { "KEY_KATAKANAHIRAGANA", KEY_KATAKANAHIRAGANA, false, NULL }, + { "KEY_MUHENKAN", KEY_MUHENKAN, false, NULL }, + { "KEY_KPJPCOMMA", KEY_KPJPCOMMA, false, NULL }, + { "KEY_KPENTER", KEY_KPENTER, false, NULL }, + { "KEY_RIGHTCTRL", KEY_RIGHTCTRL, false, NULL }, + { "KEY_KPSLASH", KEY_KPSLASH, false, NULL }, + { "KEY_SYSRQ", KEY_SYSRQ, false, NULL }, + { "KEY_RIGHTALT", KEY_RIGHTALT, false, NULL }, + { "KEY_LINEFEED", KEY_LINEFEED, false, NULL }, + { "KEY_HOME", KEY_HOME, false, NULL }, + { "KEY_UP", KEY_UP, false, NULL }, + { "KEY_PAGEUP", KEY_PAGEUP, false, NULL }, + { "KEY_LEFT", KEY_LEFT, false, NULL }, + { "KEY_RIGHT", KEY_RIGHT, false, NULL }, + { "KEY_END", KEY_END, false, NULL }, + { "KEY_DOWN", KEY_DOWN, false, NULL }, + { "KEY_PAGEDOWN", KEY_PAGEDOWN, false, NULL }, + { "KEY_INSERT", KEY_INSERT, false, NULL }, + { "KEY_DELETE", KEY_DELETE, false, NULL }, + { "KEY_MACRO", KEY_MACRO, false, NULL }, + { "KEY_MUTE", KEY_MUTE, false, NULL }, + { "KEY_VOLUMEDOWN", KEY_VOLUMEDOWN, false, NULL }, + { "KEY_VOLUMEUP", KEY_VOLUMEUP, false, NULL }, + { "KEY_POWER", KEY_POWER, false, NULL }, + { "KEY_KPEQUAL", KEY_KPEQUAL, false, NULL }, + { "KEY_KPPLUSMINUS", KEY_KPPLUSMINUS, false, NULL }, + { "KEY_PAUSE", KEY_PAUSE, false, NULL }, + { "KEY_SCALE", KEY_SCALE, false, NULL }, + { "KEY_KPCOMMA", KEY_KPCOMMA, false, NULL }, + { "KEY_HANGEUL", KEY_HANGEUL, false, NULL }, + { "KEY_HANGUEL", KEY_HANGUEL, true, NULL }, + { "KEY_HANJA", KEY_HANJA, false, NULL }, + { "KEY_YEN", KEY_YEN, false, NULL }, + { "KEY_LEFTMETA", KEY_LEFTMETA, false, NULL }, + { "KEY_RIGHTMETA", KEY_RIGHTMETA, false, NULL }, + { "KEY_COMPOSE", KEY_COMPOSE, false, NULL }, + { "KEY_STOP", KEY_STOP, false, NULL }, + { "KEY_AGAIN", KEY_AGAIN, false, NULL }, + { "KEY_PROPS", KEY_PROPS, false, NULL }, + { "KEY_UNDO", KEY_UNDO, false, NULL }, + { "KEY_FRONT", KEY_FRONT, false, NULL }, + { "KEY_COPY", KEY_COPY, false, NULL }, + { "KEY_OPEN", KEY_OPEN, false, NULL }, + { "KEY_PASTE", KEY_PASTE, false, NULL }, + { "KEY_FIND", KEY_FIND, false, NULL }, + { "KEY_CUT", KEY_CUT, false, NULL }, + { "KEY_HELP", KEY_HELP, false, NULL }, + { "KEY_MENU", KEY_MENU, false, NULL }, + { "KEY_CALC", KEY_CALC, false, NULL }, + { "KEY_SETUP", KEY_SETUP, false, NULL }, + { "KEY_SLEEP", KEY_SLEEP, false, NULL }, + { "KEY_WAKEUP", KEY_WAKEUP, false, NULL }, + { "KEY_FILE", KEY_FILE, false, NULL }, + { "KEY_SENDFILE", KEY_SENDFILE, false, NULL }, + { "KEY_DELETEFILE", KEY_DELETEFILE, false, NULL }, + { "KEY_XFER", KEY_XFER, false, NULL }, + { "KEY_PROG1", KEY_PROG1, false, NULL }, + { "KEY_PROG2", KEY_PROG2, false, NULL }, + { "KEY_WWW", KEY_WWW, false, NULL }, + { "KEY_MSDOS", KEY_MSDOS, false, NULL }, + { "KEY_COFFEE", KEY_COFFEE, false, NULL }, + { "KEY_SCREENLOCK", KEY_SCREENLOCK, true, NULL }, + { "KEY_DIRECTION", KEY_DIRECTION, false, NULL }, + { "KEY_CYCLEWINDOWS", KEY_CYCLEWINDOWS, false, NULL }, + { "KEY_MAIL", KEY_MAIL, false, NULL }, + { "KEY_BOOKMARKS", KEY_BOOKMARKS, false, NULL }, + { "KEY_COMPUTER", KEY_COMPUTER, false, NULL }, + { "KEY_BACK", KEY_BACK, false, NULL }, + { "KEY_FORWARD", KEY_FORWARD, false, NULL }, + { "KEY_CLOSECD", KEY_CLOSECD, false, NULL }, + { "KEY_EJECTCD", KEY_EJECTCD, false, NULL }, + { "KEY_EJECTCLOSECD", KEY_EJECTCLOSECD, false, NULL }, + { "KEY_NEXTSONG", KEY_NEXTSONG, false, NULL }, + { "KEY_PLAYPAUSE", KEY_PLAYPAUSE, false, NULL }, + { "KEY_PREVIOUSSONG", KEY_PREVIOUSSONG, false, NULL }, + { "KEY_STOPCD", KEY_STOPCD, false, NULL }, + { "KEY_RECORD", KEY_RECORD, false, NULL }, + { "KEY_REWIND", KEY_REWIND, false, NULL }, + { "KEY_PHONE", KEY_PHONE, false, NULL }, + { "KEY_ISO", KEY_ISO, false, NULL }, + { "KEY_CONFIG", KEY_CONFIG, false, NULL }, + { "KEY_HOMEPAGE", KEY_HOMEPAGE, false, NULL }, + { "KEY_REFRESH", KEY_REFRESH, false, NULL }, + { "KEY_EXIT", KEY_EXIT, false, NULL }, + { "KEY_MOVE", KEY_MOVE, false, NULL }, + { "KEY_EDIT", KEY_EDIT, false, NULL }, + { "KEY_SCROLLUP", KEY_SCROLLUP, false, NULL }, + { "KEY_SCROLLDOWN", KEY_SCROLLDOWN, false, NULL }, + { "KEY_KPLEFTPAREN", KEY_KPLEFTPAREN, false, NULL }, + { "KEY_KPRIGHTPAREN", KEY_KPRIGHTPAREN, false, NULL }, + { "KEY_NEW", KEY_NEW, false, NULL }, + { "KEY_REDO", KEY_REDO, false, NULL }, + { "KEY_F13", KEY_F13, false, NULL }, + { "KEY_F14", KEY_F14, false, NULL }, + { "KEY_F15", KEY_F15, false, NULL }, + { "KEY_F16", KEY_F16, false, NULL }, + { "KEY_F17", KEY_F17, false, NULL }, + { "KEY_F18", KEY_F18, false, NULL }, + { "KEY_F19", KEY_F19, false, NULL }, + { "KEY_F20", KEY_F20, false, NULL }, + { "KEY_F21", KEY_F21, false, NULL }, + { "KEY_F22", KEY_F22, false, NULL }, + { "KEY_F23", KEY_F23, false, NULL }, + { "KEY_F24", KEY_F24, false, NULL }, + { "KEY_PLAYCD", KEY_PLAYCD, false, NULL }, + { "KEY_PAUSECD", KEY_PAUSECD, false, NULL }, + { "KEY_PROG3", KEY_PROG3, false, NULL }, + { "KEY_PROG4", KEY_PROG4, false, NULL }, + { "KEY_DASHBOARD", KEY_DASHBOARD, false, NULL }, + { "KEY_SUSPEND", KEY_SUSPEND, false, NULL }, + { "KEY_CLOSE", KEY_CLOSE, false, NULL }, + { "KEY_PLAY", KEY_PLAY, false, NULL }, + { "KEY_FASTFORWARD", KEY_FASTFORWARD, false, NULL }, + { "KEY_BASSBOOST", KEY_BASSBOOST, false, NULL }, + { "KEY_PRINT", KEY_PRINT, false, NULL }, + { "KEY_HP", KEY_HP, false, NULL }, + { "KEY_CAMERA", KEY_CAMERA, false, NULL }, + { "KEY_SOUND", KEY_SOUND, false, NULL }, + { "KEY_QUESTION", KEY_QUESTION, false, NULL }, + { "KEY_EMAIL", KEY_EMAIL, false, NULL }, + { "KEY_CHAT", KEY_CHAT, false, NULL }, + { "KEY_SEARCH", KEY_SEARCH, false, NULL }, + { "KEY_CONNECT", KEY_CONNECT, false, NULL }, + { "KEY_FINANCE", KEY_FINANCE, false, NULL }, + { "KEY_SPORT", KEY_SPORT, false, NULL }, + { "KEY_SHOP", KEY_SHOP, false, NULL }, + { "KEY_ALTERASE", KEY_ALTERASE, false, NULL }, + { "KEY_CANCEL", KEY_CANCEL, false, NULL }, + { "KEY_BRIGHTNESSDOWN", KEY_BRIGHTNESSDOWN, false, NULL }, + { "KEY_BRIGHTNESSUP", KEY_BRIGHTNESSUP, false, NULL }, + { "KEY_MEDIA", KEY_MEDIA, false, NULL }, + { "KEY_SWITCHVIDEOMODE", KEY_SWITCHVIDEOMODE, false, NULL }, + { "KEY_KBDILLUMTOGGLE", KEY_KBDILLUMTOGGLE, false, NULL }, + { "KEY_KBDILLUMDOWN", KEY_KBDILLUMDOWN, false, NULL }, + { "KEY_KBDILLUMUP", KEY_KBDILLUMUP, false, NULL }, + { "KEY_SEND", KEY_SEND, false, NULL }, + { "KEY_REPLY", KEY_REPLY, false, NULL }, + { "KEY_FORWARDMAIL", KEY_FORWARDMAIL, false, NULL }, + { "KEY_SAVE", KEY_SAVE, false, NULL }, + { "KEY_DOCUMENTS", KEY_DOCUMENTS, false, NULL }, + { "KEY_BATTERY", KEY_BATTERY, false, NULL }, + { "KEY_BLUETOOTH", KEY_BLUETOOTH, false, NULL }, + { "KEY_WLAN", KEY_WLAN, false, NULL }, + { "KEY_UWB", KEY_UWB, false, NULL }, + { "KEY_UNKNOWN", KEY_UNKNOWN, false, NULL }, + { "KEY_VIDEO_NEXT", KEY_VIDEO_NEXT, false, NULL }, + { "KEY_VIDEO_PREV", KEY_VIDEO_PREV, false, NULL }, + { "KEY_BRIGHTNESS_CYCLE", KEY_BRIGHTNESS_CYCLE, false, NULL }, + { "KEY_BRIGHTNESS_AUTO", KEY_BRIGHTNESS_AUTO, false, NULL }, + { "KEY_BRIGHTNESS_ZERO", KEY_BRIGHTNESS_ZERO, true, NULL }, + { "KEY_DISPLAY_OFF", KEY_DISPLAY_OFF, false, NULL }, + { "KEY_WWAN", KEY_WWAN, false, NULL }, + { "KEY_WIMAX", KEY_WIMAX, true, NULL }, + { "KEY_RFKILL", KEY_RFKILL, false, NULL }, + { "KEY_MICMUTE", KEY_MICMUTE, false, NULL }, + { "KEY_OK", KEY_OK, false, NULL }, + { "KEY_SELECT", KEY_SELECT, false, NULL }, + { "KEY_GOTO", KEY_GOTO, false, NULL }, + { "KEY_CLEAR", KEY_CLEAR, false, NULL }, + { "KEY_POWER2", KEY_POWER2, false, NULL }, + { "KEY_OPTION", KEY_OPTION, false, NULL }, + { "KEY_INFO", KEY_INFO, false, NULL }, + { "KEY_TIME", KEY_TIME, false, NULL }, + { "KEY_VENDOR", KEY_VENDOR, false, NULL }, + { "KEY_ARCHIVE", KEY_ARCHIVE, false, NULL }, + { "KEY_PROGRAM", KEY_PROGRAM, false, NULL }, + { "KEY_CHANNEL", KEY_CHANNEL, false, NULL }, + { "KEY_FAVORITES", KEY_FAVORITES, false, NULL }, + { "KEY_EPG", KEY_EPG, false, NULL }, + { "KEY_PVR", KEY_PVR, false, NULL }, + { "KEY_MHP", KEY_MHP, false, NULL }, + { "KEY_LANGUAGE", KEY_LANGUAGE, false, NULL }, + { "KEY_TITLE", KEY_TITLE, false, NULL }, + { "KEY_SUBTITLE", KEY_SUBTITLE, false, NULL }, + { "KEY_ANGLE", KEY_ANGLE, false, NULL }, + { "KEY_ZOOM", KEY_ZOOM, false, NULL }, + { "KEY_MODE", KEY_MODE, false, NULL }, + { "KEY_KEYBOARD", KEY_KEYBOARD, false, NULL }, + { "KEY_SCREEN", KEY_SCREEN, false, NULL }, + { "KEY_PC", KEY_PC, false, NULL }, + { "KEY_TV", KEY_TV, false, NULL }, + { "KEY_TV2", KEY_TV2, false, NULL }, + { "KEY_VCR", KEY_VCR, false, NULL }, + { "KEY_VCR2", KEY_VCR2, false, NULL }, + { "KEY_SAT", KEY_SAT, false, NULL }, + { "KEY_SAT2", KEY_SAT2, false, NULL }, + { "KEY_CD", KEY_CD, false, NULL }, + { "KEY_TAPE", KEY_TAPE, false, NULL }, + { "KEY_RADIO", KEY_RADIO, false, NULL }, + { "KEY_TUNER", KEY_TUNER, false, NULL }, + { "KEY_PLAYER", KEY_PLAYER, false, NULL }, + { "KEY_TEXT", KEY_TEXT, false, NULL }, + { "KEY_DVD", KEY_DVD, false, NULL }, + { "KEY_AUX", KEY_AUX, false, NULL }, + { "KEY_MP3", KEY_MP3, false, NULL }, + { "KEY_AUDIO", KEY_AUDIO, false, NULL }, + { "KEY_VIDEO", KEY_VIDEO, false, NULL }, + { "KEY_DIRECTORY", KEY_DIRECTORY, false, NULL }, + { "KEY_LIST", KEY_LIST, false, NULL }, + { "KEY_MEMO", KEY_MEMO, false, NULL }, + { "KEY_CALENDAR", KEY_CALENDAR, false, NULL }, + { "KEY_RED", KEY_RED, false, NULL }, + { "KEY_GREEN", KEY_GREEN, false, NULL }, + { "KEY_YELLOW", KEY_YELLOW, false, NULL }, + { "KEY_BLUE", KEY_BLUE, false, NULL }, + { "KEY_CHANNELUP", KEY_CHANNELUP, false, NULL }, + { "KEY_CHANNELDOWN", KEY_CHANNELDOWN, false, NULL }, + { "KEY_FIRST", KEY_FIRST, false, NULL }, + { "KEY_LAST", KEY_LAST, false, NULL }, + { "KEY_AB", KEY_AB, false, NULL }, + { "KEY_NEXT", KEY_NEXT, false, NULL }, + { "KEY_RESTART", KEY_RESTART, false, NULL }, + { "KEY_SLOW", KEY_SLOW, false, NULL }, + { "KEY_SHUFFLE", KEY_SHUFFLE, false, NULL }, + { "KEY_BREAK", KEY_BREAK, false, NULL }, + { "KEY_PREVIOUS", KEY_PREVIOUS, false, NULL }, + { "KEY_DIGITS", KEY_DIGITS, false, NULL }, + { "KEY_TEEN", KEY_TEEN, false, NULL }, + { "KEY_TWEN", KEY_TWEN, false, NULL }, + { "KEY_VIDEOPHONE", KEY_VIDEOPHONE, false, NULL }, + { "KEY_GAMES", KEY_GAMES, false, NULL }, + { "KEY_ZOOMIN", KEY_ZOOMIN, false, NULL }, + { "KEY_ZOOMOUT", KEY_ZOOMOUT, false, NULL }, + { "KEY_ZOOMRESET", KEY_ZOOMRESET, false, NULL }, + { "KEY_WORDPROCESSOR", KEY_WORDPROCESSOR, false, NULL }, + { "KEY_EDITOR", KEY_EDITOR, false, NULL }, + { "KEY_SPREADSHEET", KEY_SPREADSHEET, false, NULL }, + { "KEY_GRAPHICSEDITOR", KEY_GRAPHICSEDITOR, false, NULL }, + { "KEY_PRESENTATION", KEY_PRESENTATION, false, NULL }, + { "KEY_DATABASE", KEY_DATABASE, false, NULL }, + { "KEY_NEWS", KEY_NEWS, false, NULL }, + { "KEY_VOICEMAIL", KEY_VOICEMAIL, false, NULL }, + { "KEY_ADDRESSBOOK", KEY_ADDRESSBOOK, false, NULL }, + { "KEY_MESSENGER", KEY_MESSENGER, false, NULL }, + { "KEY_DISPLAYTOGGLE", KEY_DISPLAYTOGGLE, false, NULL }, + { "KEY_BRIGHTNESS_TOGGLE", KEY_BRIGHTNESS_TOGGLE, true, NULL }, + { "KEY_SPELLCHECK", KEY_SPELLCHECK, false, NULL }, + { "KEY_LOGOFF", KEY_LOGOFF, false, NULL }, + { "KEY_DOLLAR", KEY_DOLLAR, false, NULL }, + { "KEY_EURO", KEY_EURO, false, NULL }, + { "KEY_FRAMEBACK", KEY_FRAMEBACK, false, NULL }, + { "KEY_FRAMEFORWARD", KEY_FRAMEFORWARD, false, NULL }, + { "KEY_CONTEXT_MENU", KEY_CONTEXT_MENU, false, NULL }, + { "KEY_MEDIA_REPEAT", KEY_MEDIA_REPEAT, false, NULL }, + { "KEY_10CHANNELSUP", KEY_10CHANNELSUP, false, NULL }, + { "KEY_10CHANNELSDOWN", KEY_10CHANNELSDOWN, false, NULL }, + { "KEY_IMAGES", KEY_IMAGES, false, NULL }, + { "KEY_DEL_EOL", KEY_DEL_EOL, false, NULL }, + { "KEY_DEL_EOS", KEY_DEL_EOS, false, NULL }, + { "KEY_INS_LINE", KEY_INS_LINE, false, NULL }, + { "KEY_DEL_LINE", KEY_DEL_LINE, false, NULL }, + { "KEY_FN", KEY_FN, false, NULL }, + { "KEY_FN_ESC", KEY_FN_ESC, false, NULL }, + { "KEY_FN_F1", KEY_FN_F1, false, NULL }, + { "KEY_FN_F2", KEY_FN_F2, false, NULL }, + { "KEY_FN_F3", KEY_FN_F3, false, NULL }, + { "KEY_FN_F4", KEY_FN_F4, false, NULL }, + { "KEY_FN_F5", KEY_FN_F5, false, NULL }, + { "KEY_FN_F6", KEY_FN_F6, false, NULL }, + { "KEY_FN_F7", KEY_FN_F7, false, NULL }, + { "KEY_FN_F8", KEY_FN_F8, false, NULL }, + { "KEY_FN_F9", KEY_FN_F9, false, NULL }, + { "KEY_FN_F10", KEY_FN_F10, false, NULL }, + { "KEY_FN_F11", KEY_FN_F11, false, NULL }, + { "KEY_FN_F12", KEY_FN_F12, false, NULL }, + { "KEY_FN_1", KEY_FN_1, false, NULL }, + { "KEY_FN_2", KEY_FN_2, false, NULL }, + { "KEY_FN_D", KEY_FN_D, false, NULL }, + { "KEY_FN_E", KEY_FN_E, false, NULL }, + { "KEY_FN_F", KEY_FN_F, false, NULL }, + { "KEY_FN_S", KEY_FN_S, false, NULL }, + { "KEY_FN_B", KEY_FN_B, false, NULL }, + { "KEY_BRL_DOT1", KEY_BRL_DOT1, false, NULL }, + { "KEY_BRL_DOT2", KEY_BRL_DOT2, false, NULL }, + { "KEY_BRL_DOT3", KEY_BRL_DOT3, false, NULL }, + { "KEY_BRL_DOT4", KEY_BRL_DOT4, false, NULL }, + { "KEY_BRL_DOT5", KEY_BRL_DOT5, false, NULL }, + { "KEY_BRL_DOT6", KEY_BRL_DOT6, false, NULL }, + { "KEY_BRL_DOT7", KEY_BRL_DOT7, false, NULL }, + { "KEY_BRL_DOT8", KEY_BRL_DOT8, false, NULL }, + { "KEY_BRL_DOT9", KEY_BRL_DOT9, false, NULL }, + { "KEY_BRL_DOT10", KEY_BRL_DOT10, false, NULL }, + { "KEY_NUMERIC_0", KEY_NUMERIC_0, false, NULL }, + { "KEY_NUMERIC_1", KEY_NUMERIC_1, false, NULL }, + { "KEY_NUMERIC_2", KEY_NUMERIC_2, false, NULL }, + { "KEY_NUMERIC_3", KEY_NUMERIC_3, false, NULL }, + { "KEY_NUMERIC_4", KEY_NUMERIC_4, false, NULL }, + { "KEY_NUMERIC_5", KEY_NUMERIC_5, false, NULL }, + { "KEY_NUMERIC_6", KEY_NUMERIC_6, false, NULL }, + { "KEY_NUMERIC_7", KEY_NUMERIC_7, false, NULL }, + { "KEY_NUMERIC_8", KEY_NUMERIC_8, false, NULL }, + { "KEY_NUMERIC_9", KEY_NUMERIC_9, false, NULL }, + { "KEY_NUMERIC_STAR", KEY_NUMERIC_STAR, false, NULL }, + { "KEY_NUMERIC_POUND", KEY_NUMERIC_POUND, false, NULL }, + { "KEY_CAMERA_FOCUS", KEY_CAMERA_FOCUS, false, NULL }, + { "KEY_WPS_BUTTON", KEY_WPS_BUTTON, false, NULL }, + { "KEY_TOUCHPAD_TOGGLE", KEY_TOUCHPAD_TOGGLE, false, NULL }, + { "KEY_TOUCHPAD_ON", KEY_TOUCHPAD_ON, false, NULL }, + { "KEY_TOUCHPAD_OFF", KEY_TOUCHPAD_OFF, false, NULL }, + { "KEY_CAMERA_ZOOMIN", KEY_CAMERA_ZOOMIN, false, NULL }, + { "KEY_CAMERA_ZOOMOUT", KEY_CAMERA_ZOOMOUT, false, NULL }, + { "KEY_CAMERA_UP", KEY_CAMERA_UP, false, NULL }, + { "KEY_CAMERA_DOWN", KEY_CAMERA_DOWN, false, NULL }, + { "KEY_CAMERA_LEFT", KEY_CAMERA_LEFT, false, NULL }, + { "KEY_CAMERA_RIGHT", KEY_CAMERA_RIGHT, false, NULL }, + { "KEY_ATTENDANT_ON", KEY_ATTENDANT_ON, false, NULL }, + { "KEY_ATTENDANT_OFF", KEY_ATTENDANT_OFF, false, NULL }, + { "KEY_ATTENDANT_TOGGLE", KEY_ATTENDANT_TOGGLE, false, NULL }, + { "KEY_LIGHTS_TOGGLE", KEY_LIGHTS_TOGGLE, false, NULL }, + { "KEY_ALS_TOGGLE", KEY_ALS_TOGGLE, false, NULL }, + { "KEY_BUTTONCONFIG", KEY_BUTTONCONFIG, false, NULL }, + { "KEY_TASKMANAGER", KEY_TASKMANAGER, false, NULL }, + { "KEY_JOURNAL", KEY_JOURNAL, false, NULL }, + { "KEY_CONTROLPANEL", KEY_CONTROLPANEL, false, NULL }, + { "KEY_APPSELECT", KEY_APPSELECT, false, NULL }, + { "KEY_SCREENSAVER", KEY_SCREENSAVER, false, NULL }, + { "KEY_VOICECOMMAND", KEY_VOICECOMMAND, false, NULL }, + { "KEY_BRIGHTNESS_MIN", KEY_BRIGHTNESS_MIN, false, NULL }, + { "KEY_BRIGHTNESS_MAX", KEY_BRIGHTNESS_MAX, false, NULL }, + { "KEY_KBDINPUTASSIST_PREV", KEY_KBDINPUTASSIST_PREV, false, NULL }, + { "KEY_KBDINPUTASSIST_NEXT", KEY_KBDINPUTASSIST_NEXT, false, NULL }, + { "KEY_KBDINPUTASSIST_PREVGROUP", KEY_KBDINPUTASSIST_PREVGROUP, false, NULL }, + { "KEY_KBDINPUTASSIST_NEXTGROUP", KEY_KBDINPUTASSIST_NEXTGROUP, false, NULL }, + { "KEY_KBDINPUTASSIST_ACCEPT", KEY_KBDINPUTASSIST_ACCEPT, false, NULL }, + { "KEY_KBDINPUTASSIST_CANCEL", KEY_KBDINPUTASSIST_CANCEL, false, NULL }, + { "KEY_MIN_INTERESTING", KEY_MIN_INTERESTING, true, NULL }, + { "KEY_MAX", KEY_MAX, false, NULL }, + { "KEY_CNT", KEY_CNT, false, NULL }, + { NULL, 0, false, NULL } diff --git a/rcm-client-main.c b/rcm-client-main.c index f7a70c6..ddf5f92 100644 --- a/rcm-client-main.c +++ b/rcm-client-main.c @@ -73,22 +73,23 @@ on_signal(GDBusObjectManagerClient *manager, GVariant *parameters, gpointer user_data) { - bool pressed; + gchar *protocol; + guint64 scancode; gchar *keycode; g_print("Signal %s received for obj %s\n", signal_name, g_dbus_object_get_object_path(G_DBUS_OBJECT(object_proxy))); - if (!strcmp(signal_name, "KeyReleased")) - pressed = false; - else if (!strcmp(signal_name, "KeyPressed")) - pressed = true; - else - return; - - g_variant_get(parameters, "(s)", &keycode); - rcng_client_receive_keypress(G_DBUS_OBJECT(object_proxy), keycode, pressed); - g_free(keycode); + if (!strcmp(signal_name, "KeyReleased")) { + g_variant_get(parameters, "(s)", &keycode); + rcng_client_receive_key_released(G_DBUS_OBJECT(object_proxy), keycode); + g_free(keycode); + } else if (!strcmp(signal_name, "KeyPressed")) { + g_variant_get(parameters, "(sts)", &protocol, &scancode, &keycode); + rcng_client_receive_key_pressed(G_DBUS_OBJECT(object_proxy), protocol, scancode, keycode); + g_free(protocol); + g_free(keycode); + } } static void diff --git a/rcm-client-receive.c b/rcm-client-receive.c index 61fc991..0720535 100644 --- a/rcm-client-receive.c +++ b/rcm-client-receive.c @@ -11,8 +11,6 @@ #include "rcm-client-main.h" #include "rcm-client-receive.h" -#include "linux-input-keycodes.h" - #define WINDOW_WIDTH 300 #define WINDOW_HEIGHT 300 @@ -793,7 +791,38 @@ on_notebook_page_change(GtkNotebook *notebook, GtkWidget *page, guint new_page_n g_print("Page change: %i -> %u\n", own_page_num, new_page_num); } -void rcng_client_receive_keypress(GDBusObject *obj, const gchar *keycode, bool pressed) +void rcng_client_receive_key_pressed(GDBusObject *obj, const gchar *protocol, + guint64 scancode, const gchar *keycode) +{ + GList *l; + unsigned affected = 0; + + /* FIXME: Use object path, this is just test code */ + if (!state.active || state.editing) + return; + + for (l = state.remotes; l; l = l->next) { + struct remote *remote = l->data; + GList *button; + + for (button = remote->buttons; button; button = button->next) { + struct rcbutton *rcb = button->data; + + if (rcb->type != RCBUTTON_TYPE_NORMAL) + continue; + + if (strcmp(keycode, rcb->name)) + continue; + + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(rcb->button), true); + affected++; + } + } + + g_print("Key %s:0x%08" PRIx64 ":%s pressed (%u affected)\n", protocol, scancode, keycode, affected); +} + +void rcng_client_receive_key_released(GDBusObject *obj, const gchar *keycode) { GList *l; unsigned affected = 0; @@ -815,12 +844,12 @@ void rcng_client_receive_keypress(GDBusObject *obj, const gchar *keycode, bool p if (strcmp(keycode, rcb->name)) continue; - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(rcb->button), pressed); + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(rcb->button), false); affected++; } } - g_print("Key %s %s (%u affected)\n", keycode, pressed ? "pressed" : "released", affected); + g_print("Key %s released (%u affected)\n", keycode, affected); } static struct remote * diff --git a/rcm-client-receive.h b/rcm-client-receive.h index 7bfe764..f0f0967 100644 --- a/rcm-client-receive.h +++ b/rcm-client-receive.h @@ -1,5 +1,6 @@ void rcng_client_receive_destroy_ui(); void rcng_client_receive_init_ui(GDBusObject *new_hw); -void rcng_client_receive_keypress(GDBusObject *obj, const gchar *keycode, bool pressed); +void rcng_client_receive_key_pressed(GDBusObject *obj, const gchar *protocol, guint64 scancode, const gchar *keycode); +void rcng_client_receive_key_released(GDBusObject *obj, const gchar *keycode); diff --git a/rcm-server-evdev.c b/rcm-server-evdev.c new file mode 100644 index 0000000..9423806 --- /dev/null +++ b/rcm-server-evdev.c @@ -0,0 +1,127 @@ +#define _GNU_SOURCE +#include +#include +#include +#include +#include +#include +#include + +#include "utils.h" +#include "shared.h" +#include "rcm-server-main.h" +#include "rcm-server-evdev.h" +#include "rcm-server-keymap.h" + +struct rc_scancode { + __u16 protocol; + __u16 reserved[3]; + __u64 scancode; +}; + +#define INPUT_KEYMAP_BY_INDEX (1 << 0) +struct rc_keymap_entry { + __u8 flags; + __u8 len; + __u16 index; + __u32 keycode; + union { + struct rc_scancode rc; + __u8 scancode[32]; + } u; + char end[]; +}; +#define RKE_SIZE (sizeof(struct rc_scancode)) + +static int +evdev_clear_keymap(struct device *device) +{ + struct rc_keymap_entry rke; + unsigned count = 0; + int r = 0; + + printf("Clearing keymap..."); + while (true) { + memset(&rke, 0, sizeof(rke)); + rke.len = RKE_SIZE; + rke.index = 0; + rke.flags = INPUT_KEYMAP_BY_INDEX; + if (ioctl(device->evdev_fd, EVIOCGKEYCODE_V2, &rke)) { + printf("done (%u entries removed)\n", count); + break; + } + + /* + printf(" Clearing 0x%08llX (0x%02X) to 0x%02X\n", + rke.u.rc.scancode, rke.u.rc.protocol, rke.keycode); + */ + + rke.keycode = KEY_RESERVED; + if (ioctl(device->evdev_fd, EVIOCSKEYCODE_V2, &rke)) { + r = -errno; + printf("failed (%s)\n", strerror(errno)); + break; + } + count++; + } + + return r; +} + +static void +set_keycode_new(struct device *device, __u16 protocol, __u64 scancode, __u32 keycode) +{ + struct rc_keymap_entry rke; + + memset(&rke, 0, sizeof(rke)); + rke.len = RKE_SIZE; + rke.u.rc.protocol = protocol; + rke.u.rc.scancode = scancode; + rke.keycode = keycode; + + printf("Setting keycode (new ioctl) 0x%08llX (0x%02X) to 0x%02X\n", + rke.u.rc.scancode, rke.u.rc.protocol, rke.keycode); + + if (ioctl(device->evdev_fd, EVIOCSKEYCODE_V2, &rke)) { + printf("Unable to call SETKEYCODE2 ioctl\n"); + exit(EXIT_FAILURE); + } +} + +static int +evdev_set_keymap(struct device *device, struct keymap *keymap) +{ + unsigned i; + + printf("\tSetting up keymap: %s\n", keymap->name); + + for (i = 0; i < keymap->keycode_count; i++) + set_keycode_new(device, + keymap->keycodes[i].protocol, + keymap->keycodes[i].scancode, + keymap->keycodes[i].lik->value); + + printf("\tDone: %u entries added\n", i); + return 0; +} + +int +evdev_setup(struct device *device) +{ + int r; + struct keymap *keymap; + + if (!device || device->evdev_fd < 0) + return -EINVAL; + + printf("Performing evdev setup for device %s\n", device->path); + r = evdev_clear_keymap(device); + if (r < 0) + return r; + + list_for_each_entry(keymap, &device->keymaps, list) + r = evdev_set_keymap(device, keymap); + + return r; +} + diff --git a/rcm-server-evdev.h b/rcm-server-evdev.h new file mode 100644 index 0000000..7cdf6c1 --- /dev/null +++ b/rcm-server-evdev.h @@ -0,0 +1,7 @@ +#ifndef foorcmserverevdevhfoo +#define foorcmserverevdevhfoo + +int evdev_setup(struct device *device); + +#endif + diff --git a/rcm-server-keymap.c b/rcm-server-keymap.c index 04dd1a4..15b7fe8 100644 --- a/rcm-server-keymap.c +++ b/rcm-server-keymap.c @@ -14,7 +14,7 @@ #include #include "utils.h" -#include "linux-input-keycodes.h" +#include "shared.h" #include "rcm-server-main.h" #include "rcm-server-keymap.h" @@ -202,13 +202,15 @@ keymap_parse(FILE *fp, char **line, size_t *buf_size, struct keymap *keymap, char *keycode; char *end; uint64_t scancode; + unsigned protocol_numeric; + struct linux_input_keycode *lik; protocol = strtok(tmp, " :"); scanstr = strtok(NULL, " :"); keycode = strtok(NULL, " :"); end = strtok(NULL, " :"); - if (!protocol || !scancode || !keycode || end) { + if (!protocol || !scanstr || !keycode || end) { fprintf(stderr, "Invalid map directive\n"); return -ENOMEM; } @@ -219,21 +221,28 @@ keymap_parse(FILE *fp, char **line, size_t *buf_size, struct keymap *keymap, return r; } - for (i = 0; linux_input_keycodes[i].name; i++) { - if (!strcmp(keycode, linux_input_keycodes[i].name)) + for (i = 0; rc_protocols[i]; i++) { + if (!strcasecmp(protocol, rc_protocols[i])) break; } - if (!linux_input_keycodes[i].name || linux_input_keycodes[i].value < 1) { + if (!rc_protocols[i]) { + fprintf(stderr, "Invalid protocol value\n"); + return -EINVAL; + } + + protocol_numeric = i; + + lik = get_linux_keycode_by_name(keycode); + if (!lik || lik->value < 1) { fprintf(stderr, "Invalid keycode name: %s\n", keycode); return -EINVAL; } if (keymap) { - /* FIXME: leaks */ - keymap->keycodes[keycode_count].protocol = strdup(protocol); + keymap->keycodes[keycode_count].protocol = protocol_numeric; keymap->keycodes[keycode_count].scancode = scancode; - keymap->keycodes[keycode_count].keycode = strdup(keycode); + keymap->keycodes[keycode_count].lik = lik; } keycode_count++; } else { @@ -248,12 +257,21 @@ keymap_parse(FILE *fp, char **line, size_t *buf_size, struct keymap *keymap, if (!strcasecmp(tmp, "Blank")) keymap->layout[layout_count] = NULL; else { - for (i = 0; i < keycode_count; i++) - if (!strcasecmp(tmp, keymap->keycodes[i].keycode)) + struct linux_input_keycode *lik; + + lik = get_linux_keycode_by_name(tmp); + if (!lik) { + fprintf(stderr, "Invalid keycode: %s\n", tmp); + return -EINVAL; + } + + for (i = 0; i < keycode_count; i++) { + if (keymap->keycodes[i].lik == lik) break; + } if (i >= keycode_count) { - fprintf(stderr, "Invalid button keycode: %s\n", tmp); + fprintf(stderr, "Keycode '%s' not in keymap\n", tmp); return -EINVAL; } @@ -490,16 +508,16 @@ keymap_write(struct keymap *keymap) fprintf(file, "[Keymap]\n"); for (i = 0; i < keymap->keycode_count; i++) { fprintf(file, "Map=%s:0x%08" PRIx64 ":%s\n", - keymap->keycodes[i].protocol, + rc_protocols[keymap->keycodes[i].protocol], keymap->keycodes[i].scancode, - keymap->keycodes[i].keycode); + keymap->keycodes[i].lik->name); } fprintf(file, "\n"); fprintf(file, "[Layout]\n"); for (i = 0; i < (keymap->rows * keymap->cols); i++) { if (keymap->layout[i]) - fprintf(file, "Button=%s\n", keymap->layout[i]->keycode); + fprintf(file, "Button=%s\n", keymap->layout[i]->lik->name); else fprintf(file, "Button=Blank\n"); } diff --git a/rcm-server-keymap.h b/rcm-server-keymap.h index a68a1fd..a33632c 100644 --- a/rcm-server-keymap.h +++ b/rcm-server-keymap.h @@ -2,9 +2,9 @@ #define foorcmserverkeymaphfoo struct keycode { - char *protocol; + unsigned protocol; uint64_t scancode; - char *keycode; + struct linux_input_keycode *lik; }; struct keymap { diff --git a/rcm-server-main.c b/rcm-server-main.c index 290ebdc..8dc5a6b 100644 --- a/rcm-server-main.c +++ b/rcm-server-main.c @@ -14,9 +14,9 @@ #include "utils.h" #include "shared.h" -#include "linux-input-keycodes.h" #include "rcm-server-main.h" #include "rcm-server-keymap.h" +#include "rcm-server-evdev.h" static struct device * find_device_by_path(struct manager *mgr, const char *path) @@ -156,9 +156,9 @@ method_getkeymap(sd_bus_message *m, void *userdata, sd_bus_error *error) for (i = 0; i < keymap->keycode_count; i++) { r = sd_bus_message_append(reply, "a{sv}", 3, - "protocol", "s", keymap->keycodes[i].protocol, + "protocol", "s", rc_protocols[keymap->keycodes[i].protocol], "scancode", "t", keymap->keycodes[i].scancode, - "keycode", "s", keymap->keycodes[i].keycode); + "keycode", "s", keymap->keycodes[i].lik->name); if (r < 0) goto out; } @@ -179,7 +179,7 @@ method_getkeymap(sd_bus_message *m, void *userdata, sd_bus_error *error) else r = sd_bus_message_append(reply, "a{sv}", 2, "type", "s", "button", - "keycode", "s", keymap->layout[i]->keycode); + "keycode", "s", keymap->layout[i]->lik->name); if (r < 0) goto out; } @@ -264,9 +264,12 @@ method_setkeymap_parse_dbus_msg(sd_bus_message *m, struct keymap *keymap, while ((r = sd_bus_message_enter_container(m, 'a', "{sv}")) > 0) { const char *protocol = NULL; + unsigned protocol_numeric; uint64_t scancode; bool scancode_found = false; - const char *keycode = NULL; + struct linux_input_keycode *lik = NULL; + const char *keycode; + unsigned i; while ((r = sd_bus_message_enter_container(m, SD_BUS_TYPE_DICT_ENTRY, "sv")) > 0) { const char *name; @@ -304,6 +307,18 @@ method_setkeymap_parse_dbus_msg(sd_bus_message *m, struct keymap *keymap, if (r < 0) return r; + for (i = 0; rc_protocols[i]; i++) { + if (!strcmp(rc_protocols[i], protocol)) + break; + } + + if (!rc_protocols[i]) { + printf("Invalid protocol name (%s)\n", protocol); + return -EINVAL; + } + + protocol_numeric = i; + } else if (!strcmp(name, "scancode")) { if (type != SD_BUS_TYPE_UINT64) { printf("Invalid type for scancode (%c)\n", type); @@ -327,7 +342,7 @@ method_setkeymap_parse_dbus_msg(sd_bus_message *m, struct keymap *keymap, return -EINVAL; } - if (keycode) { + if (lik) { printf("Keycode specified more than once\n"); return -EINVAL; } @@ -336,6 +351,12 @@ method_setkeymap_parse_dbus_msg(sd_bus_message *m, struct keymap *keymap, if (r < 0) return r; + lik = get_linux_keycode_by_name(keycode); + if (!lik) { + printf("Invalid keycode name (%s)\n", keycode); + return -EINVAL; + } + } else { r = sd_bus_message_skip(m, contents); if (r < 0) @@ -364,19 +385,15 @@ method_setkeymap_parse_dbus_msg(sd_bus_message *m, struct keymap *keymap, return -EINVAL; } - if (!keycode) { + if (!lik) { printf("Keycode entry without keycode\n"); return -EINVAL; } if (keymap) { - keymap->keycodes[keycode_count].protocol = strdup(protocol); + keymap->keycodes[keycode_count].protocol = protocol_numeric; keymap->keycodes[keycode_count].scancode = scancode; - keymap->keycodes[keycode_count].keycode = strdup(keycode); - - if (!keymap->keycodes[keycode_count].protocol || - !keymap->keycodes[keycode_count].keycode) - return -ENOMEM; + keymap->keycodes[keycode_count].lik = lik; } keycode_count++; @@ -400,12 +417,13 @@ method_setkeymap_parse_dbus_msg(sd_bus_message *m, struct keymap *keymap, while ((r = sd_bus_message_enter_container(m, 'a', "{sv}")) > 0) { bool blank = false; bool button = false; - const char *keycode = NULL; + struct linux_input_keycode *lik = NULL; while ((r = sd_bus_message_enter_container(m, SD_BUS_TYPE_DICT_ENTRY, "sv")) > 0) { const char *name; const char *contents; const char *button_type; + const char *keycode; char type; r = sd_bus_message_read_basic(m, SD_BUS_TYPE_STRING, &name); @@ -454,7 +472,7 @@ method_setkeymap_parse_dbus_msg(sd_bus_message *m, struct keymap *keymap, return -EINVAL; } - if (keycode) { + if (lik) { printf("Multiple keycodes specified in layout\n"); return -EINVAL; } @@ -463,6 +481,12 @@ method_setkeymap_parse_dbus_msg(sd_bus_message *m, struct keymap *keymap, if (r < 0) return r; + lik = get_linux_keycode_by_name(keycode); + if (!lik) { + printf("Invalid keycode name in layout (%s)\n", keycode); + return -EINVAL; + } + } else { r = sd_bus_message_skip(m, contents); if (r < 0) @@ -482,7 +506,7 @@ method_setkeymap_parse_dbus_msg(sd_bus_message *m, struct keymap *keymap, return r; if ((!blank && !button) || (blank && button) || - (button && !keycode) || (blank && keycode)) { + (button && !lik) || (blank && lik)) { printf("Invalid layout specification\n"); return -EINVAL; } @@ -492,12 +516,12 @@ method_setkeymap_parse_dbus_msg(sd_bus_message *m, struct keymap *keymap, keymap->layout[layout_count] = NULL; else { for (i = 0; i < keycode_count; i++) { - if (!strcasecmp(keycode, keymap->keycodes[i].keycode)) + if (keymap->keycodes[i].lik == lik) break; } if (i >= keycode_count) { - printf("Invalid keycode in layout: '%s'\n", keycode); + printf("Invalid keycode in layout: '%s'\n", lik->name); return -EINVAL; } @@ -627,7 +651,7 @@ static const sd_bus_vtable device_vtable[] = { SD_BUS_METHOD("ListKeymaps", NULL, "as", method_listkeymaps, SD_BUS_VTABLE_UNPRIVILEGED), SD_BUS_METHOD("GetKeymap", "s", "ssqqaa{sv}aa{sv}", method_getkeymap, SD_BUS_VTABLE_UNPRIVILEGED), SD_BUS_METHOD("SetKeymap", "sssqqaa{sv}aa{sv}", NULL, method_setkeymap, SD_BUS_VTABLE_UNPRIVILEGED), - SD_BUS_SIGNAL("KeyPressed", "s", 0), + SD_BUS_SIGNAL("KeyPressed", "sts", 0), SD_BUS_SIGNAL("KeyReleased", "s", 0), SD_BUS_VTABLE_END }; @@ -765,11 +789,18 @@ evdev_read(sd_event_source *s, int fd, uint32_t revents, void *userdata) printf(" scancode 0x%08x", scancode); printf("\n"); - if (keycode != KEY_RESERVED) + /* FIXME: protocol needs kernel support */ + if (pressed && scancode_recv) sd_bus_emit_signal(device->mgr->bus, device->path, "org.gnome.RemoteControlManager.Device", - pressed ? "KeyPressed" : "KeyReleased", + "KeyPressed", + "sts", "nec", scancode, keycode_str); + else if (!pressed && keycode != KEY_RESERVED) + sd_bus_emit_signal(device->mgr->bus, + device->path, + "org.gnome.RemoteControlManager.Device", + "KeyReleased", "s", keycode_str); } @@ -867,6 +898,8 @@ add_device(struct manager *mgr, struct udev_device *udev) continue; } + evdev_setup(device); + if (sd_event_add_io(mgr->event, &device->evdev_ev, device->evdev_fd, EPOLLIN, evdev_read, device) < 0) { printf("Failed to add event source for evdev device %s: %s\n", diff --git a/shared.c b/shared.c new file mode 100644 index 0000000..a1ce931 --- /dev/null +++ b/shared.c @@ -0,0 +1,45 @@ +#include +#include + +#include "shared.h" + +const char *rc_protocols[] = { + "Unknown", + "Other", + "RC5", + "RC5X", + "RC5 StreamZap", + "JVC", + "Sony12", + "Sony15", + "Sony20", + "NEC", + "Sanyo", + "MCE Keyboard", + "RC6-0-16", + "RC6-6A-20", + "RC6-6A-24", + "RC6-6A-32", + "RC6-MCE", + "Sharp", + "XMP", + NULL +}; + +struct linux_input_keycode linux_input_keycodes[] = { +#include "linux-input-keycodes.h" +}; + +struct linux_input_keycode * +get_linux_keycode_by_name(const char *name) +{ + unsigned i; + + for (i = 0; linux_input_keycodes[i].name; i++) { + if (!strcasecmp(name, linux_input_keycodes[i].name)) + return &linux_input_keycodes[i]; + } + + return NULL; +} + diff --git a/shared.h b/shared.h index 28eed39..dda43ff 100644 --- a/shared.h +++ b/shared.h @@ -1,8 +1,25 @@ -#ifndef foosharedfooh +#ifndef foosharedhfoo #define foosharedhfoo +#include +#include +#include +#include "linux-input.h" + #define REMOTE_LAYOUT_MAX_WIDTH 1000 #define REMOTE_LAYOUT_MAX_HEIGHT 1000 -#endif +extern const char *rc_protocols[]; + +struct linux_input_keycode { + const char *name; + uint32_t value; + bool alias; + void *cairo_surface; +}; +extern struct linux_input_keycode linux_input_keycodes[]; + +struct linux_input_keycode *get_linux_keycode_by_name(const char *name); + +#endif diff --git a/tools/generate-input-keycodes.sh b/tools/generate-input-keycodes.sh index 988940d..bdae3d1 100755 --- a/tools/generate-input-keycodes.sh +++ b/tools/generate-input-keycodes.sh @@ -5,7 +5,6 @@ set -e INPUT_HEADER="/usr/include/linux/input.h" LOCAL_INPUT_HEADER="linux-input.h" OUTPUT_MAPH="linux-input-keycodes.h" -OUTPUT_MAPC="linux-input-keycodes.c" SKIP="KEY_MIN_INTERESTING KEY_MAX KEY_CNT" if [ ! -e "$LOCAL_INPUT_HEADER" ]; then @@ -18,35 +17,7 @@ if [ ! -e "$LOCAL_INPUT_HEADER" ]; then fi cat > "$OUTPUT_MAPH" < -#include -#include -#include "$LOCAL_INPUT_HEADER" - -struct linux_input_keycode { - const char *name; - uint32_t value; - bool alias; - void *cairo_surface; -}; - -extern struct linux_input_keycode linux_input_keycodes[]; - -#endif -EOF - -cat > "$OUTPUT_MAPC" << EOF /* AUTOGENERATED: DO NOT EDIT */ - -#include "$LOCAL_INPUT_HEADER" -#include "$OUTPUT_MAPH" - -struct linux_input_keycode linux_input_keycodes[] = { EOF cat "$LOCAL_INPUT_HEADER" | grep "^#define[[:space:]]*KEY_" | while read DEF NAME VALUE COMMENTS; do @@ -62,12 +33,11 @@ cat "$LOCAL_INPUT_HEADER" | grep "^#define[[:space:]]*KEY_" | while read DEF NAM ALIAS="false" fi - echo " { \"$NAME\", $NAME, $ALIAS, NULL }," >> "$OUTPUT_MAPC" + echo " { \"$NAME\", $NAME, $ALIAS, NULL }," >> "$OUTPUT_MAPH" done -cat >> "$OUTPUT_MAPC" << EOF +cat >> "$OUTPUT_MAPH" << EOF { NULL, 0, false, NULL } -}; EOF exit 0 -- cgit v1.2.3