[PATCH evtest 1/2] Remove custom event names

Daniel Drake dsd at laptop.org
Thu Jul 14 09:52:40 PDT 2011


As suggested by Dmitry Torokhov, drop the textual name of the individual
state bits. We already have the name of the constant - use that instead.
Also mark the name lookup tables as static const data.
---
 evtest.c |  676 +++++++++++++++++++++++++++++++-------------------------------
 1 files changed, 339 insertions(+), 337 deletions(-)

diff --git a/evtest.c b/evtest.c
index 58b4147..5cc8505 100644
--- a/evtest.c
+++ b/evtest.c
@@ -67,407 +67,409 @@
 #define SYN_MT_REPORT 2
 #endif
 
-char *events[EV_MAX + 1] = {
+#define NAME_ELEMENT(element) [element] = #element
+
+static const char * const events[EV_MAX + 1] = {
 	[0 ... EV_MAX] = NULL,
-	[EV_SYN] = "Sync",			[EV_KEY] = "Key",
-	[EV_REL] = "Relative",			[EV_ABS] = "Absolute",
-	[EV_MSC] = "Misc",			[EV_LED] = "LED",
-	[EV_SND] = "Sound",			[EV_REP] = "Repeat",
-	[EV_FF] = "ForceFeedback",		[EV_PWR] = "Power",
-	[EV_FF_STATUS] = "ForceFeedbackStatus",	[EV_SW] = "Switch",
+	NAME_ELEMENT(EV_SYN),			NAME_ELEMENT(EV_KEY),
+	NAME_ELEMENT(EV_REL),			NAME_ELEMENT(EV_ABS),
+	NAME_ELEMENT(EV_MSC),			NAME_ELEMENT(EV_LED),
+	NAME_ELEMENT(EV_SND),			NAME_ELEMENT(EV_REP),
+	NAME_ELEMENT(EV_FF),			NAME_ELEMENT(EV_PWR),
+	NAME_ELEMENT(EV_FF_STATUS),		NAME_ELEMENT(EV_SW),
 };
 
-char *keys[KEY_MAX + 1] = {
+static const char * const keys[KEY_MAX + 1] = {
 	[0 ... KEY_MAX] = NULL,
-	[KEY_RESERVED] = "Reserved",		[KEY_ESC] = "Esc",
-	[KEY_1] = "1",				[KEY_2] = "2",
-	[KEY_3] = "3",				[KEY_4] = "4",
-	[KEY_5] = "5",				[KEY_6] = "6",
-	[KEY_7] = "7",				[KEY_8] = "8",
-	[KEY_9] = "9",				[KEY_0] = "0",
-	[KEY_MINUS] = "Minus",			[KEY_EQUAL] = "Equal",
-	[KEY_BACKSPACE] = "Backspace",		[KEY_TAB] = "Tab",
-	[KEY_Q] = "Q",				[KEY_W] = "W",
-	[KEY_E] = "E",				[KEY_R] = "R",
-	[KEY_T] = "T",				[KEY_Y] = "Y",
-	[KEY_U] = "U",				[KEY_I] = "I",
-	[KEY_O] = "O",				[KEY_P] = "P",
-	[KEY_LEFTBRACE] = "LeftBrace",		[KEY_RIGHTBRACE] = "RightBrace",
-	[KEY_ENTER] = "Enter",			[KEY_LEFTCTRL] = "LeftControl",
-	[KEY_A] = "A",				[KEY_S] = "S",
-	[KEY_D] = "D",				[KEY_F] = "F",
-	[KEY_G] = "G",				[KEY_H] = "H",
-	[KEY_J] = "J",				[KEY_K] = "K",
-	[KEY_L] = "L",				[KEY_SEMICOLON] = "Semicolon",
-	[KEY_APOSTROPHE] = "Apostrophe",	[KEY_GRAVE] = "Grave",
-	[KEY_LEFTSHIFT] = "LeftShift",		[KEY_BACKSLASH] = "BackSlash",
-	[KEY_Z] = "Z",				[KEY_X] = "X",
-	[KEY_C] = "C",				[KEY_V] = "V",
-	[KEY_B] = "B",				[KEY_N] = "N",
-	[KEY_M] = "M",				[KEY_COMMA] = "Comma",
-	[KEY_DOT] = "Dot",			[KEY_SLASH] = "Slash",
-	[KEY_RIGHTSHIFT] = "RightShift",	[KEY_KPASTERISK] = "KPAsterisk",
-	[KEY_LEFTALT] = "LeftAlt",		[KEY_SPACE] = "Space",
-	[KEY_CAPSLOCK] = "CapsLock",		[KEY_F1] = "F1",
-	[KEY_F2] = "F2",			[KEY_F3] = "F3",
-	[KEY_F4] = "F4",			[KEY_F5] = "F5",
-	[KEY_F6] = "F6",			[KEY_F7] = "F7",
-	[KEY_F8] = "F8",			[KEY_F9] = "F9",
-	[KEY_F10] = "F10",			[KEY_NUMLOCK] = "NumLock",
-	[KEY_SCROLLLOCK] = "ScrollLock",	[KEY_KP7] = "KP7",
-	[KEY_KP8] = "KP8",			[KEY_KP9] = "KP9",
-	[KEY_KPMINUS] = "KPMinus",		[KEY_KP4] = "KP4",
-	[KEY_KP5] = "KP5",			[KEY_KP6] = "KP6",
-	[KEY_KPPLUS] = "KPPlus",		[KEY_KP1] = "KP1",
-	[KEY_KP2] = "KP2",			[KEY_KP3] = "KP3",
-	[KEY_KP0] = "KP0",			[KEY_KPDOT] = "KPDot",
-	[KEY_ZENKAKUHANKAKU] = "Zenkaku/Hankaku", [KEY_102ND] = "102nd",
-	[KEY_F11] = "F11",			[KEY_F12] = "F12",
-	[KEY_RO] = "RO",			[KEY_KATAKANA] = "Katakana",
-	[KEY_HIRAGANA] = "HIRAGANA",		[KEY_HENKAN] = "Henkan",
-	[KEY_KATAKANAHIRAGANA] = "Katakana/Hiragana", [KEY_MUHENKAN] = "Muhenkan",
-	[KEY_KPJPCOMMA] = "KPJpComma",		[KEY_KPENTER] = "KPEnter",
-	[KEY_RIGHTCTRL] = "RightCtrl",		[KEY_KPSLASH] = "KPSlash",
-	[KEY_SYSRQ] = "SysRq",			[KEY_RIGHTALT] = "RightAlt",
-	[KEY_LINEFEED] = "LineFeed",		[KEY_HOME] = "Home",
-	[KEY_UP] = "Up",			[KEY_PAGEUP] = "PageUp",
-	[KEY_LEFT] = "Left",			[KEY_RIGHT] = "Right",
-	[KEY_END] = "End",			[KEY_DOWN] = "Down",
-	[KEY_PAGEDOWN] = "PageDown",		[KEY_INSERT] = "Insert",
-	[KEY_DELETE] = "Delete",		[KEY_MACRO] = "Macro",
-	[KEY_MUTE] = "Mute",			[KEY_VOLUMEDOWN] = "VolumeDown",
-	[KEY_VOLUMEUP] = "VolumeUp",		[KEY_POWER] = "Power",
-	[KEY_KPEQUAL] = "KPEqual",		[KEY_KPPLUSMINUS] = "KPPlusMinus",
-	[KEY_PAUSE] = "Pause",			[KEY_KPCOMMA] = "KPComma",
-	[KEY_HANGUEL] = "Hanguel",		[KEY_HANJA] = "Hanja",
-	[KEY_YEN] = "Yen",			[KEY_LEFTMETA] = "LeftMeta",
-	[KEY_RIGHTMETA] = "RightMeta",		[KEY_COMPOSE] = "Compose",
-	[KEY_STOP] = "Stop",			[KEY_AGAIN] = "Again",
-	[KEY_PROPS] = "Props",			[KEY_UNDO] = "Undo",
-	[KEY_FRONT] = "Front",			[KEY_COPY] = "Copy",
-	[KEY_OPEN] = "Open",			[KEY_PASTE] = "Paste",
-	[KEY_FIND] = "Find",			[KEY_CUT] = "Cut",
-	[KEY_HELP] = "Help",			[KEY_MENU] = "Menu",
-	[KEY_CALC] = "Calc",			[KEY_SETUP] = "Setup",
-	[KEY_SLEEP] = "Sleep",			[KEY_WAKEUP] = "WakeUp",
-	[KEY_FILE] = "File",			[KEY_SENDFILE] = "SendFile",
-	[KEY_DELETEFILE] = "DeleteFile",	[KEY_XFER] = "X-fer",
-	[KEY_PROG1] = "Prog1",			[KEY_PROG2] = "Prog2",
-	[KEY_WWW] = "WWW",			[KEY_MSDOS] = "MSDOS",
-	[KEY_COFFEE] = "Coffee",		[KEY_DIRECTION] = "Direction",
-	[KEY_CYCLEWINDOWS] = "CycleWindows",	[KEY_MAIL] = "Mail",
-	[KEY_BOOKMARKS] = "Bookmarks",		[KEY_COMPUTER] = "Computer",
-	[KEY_BACK] = "Back",			[KEY_FORWARD] = "Forward",
-	[KEY_CLOSECD] = "CloseCD",		[KEY_EJECTCD] = "EjectCD",
-	[KEY_EJECTCLOSECD] = "EjectCloseCD",	[KEY_NEXTSONG] = "NextSong",
-	[KEY_PLAYPAUSE] = "PlayPause",		[KEY_PREVIOUSSONG] = "PreviousSong",
-	[KEY_STOPCD] = "StopCD",		[KEY_RECORD] = "Record",
-	[KEY_REWIND] = "Rewind",		[KEY_PHONE] = "Phone",
-	[KEY_ISO] = "ISOKey",			[KEY_CONFIG] = "Config",
-	[KEY_HOMEPAGE] = "HomePage",		[KEY_REFRESH] = "Refresh",
-	[KEY_EXIT] = "Exit",			[KEY_MOVE] = "Move",
-	[KEY_EDIT] = "Edit",			[KEY_SCROLLUP] = "ScrollUp",
-	[KEY_SCROLLDOWN] = "ScrollDown",	[KEY_KPLEFTPAREN] = "KPLeftParenthesis",
-	[KEY_KPRIGHTPAREN] = "KPRightParenthesis", [KEY_F13] = "F13",
-	[KEY_F14] = "F14",			[KEY_F15] = "F15",
-	[KEY_F16] = "F16",			[KEY_F17] = "F17",
-	[KEY_F18] = "F18",			[KEY_F19] = "F19",
-	[KEY_F20] = "F20",			[KEY_F21] = "F21",
-	[KEY_F22] = "F22",			[KEY_F23] = "F23",
-	[KEY_F24] = "F24",			[KEY_PLAYCD] = "PlayCD",
-	[KEY_PAUSECD] = "PauseCD",		[KEY_PROG3] = "Prog3",
-	[KEY_PROG4] = "Prog4",			[KEY_SUSPEND] = "Suspend",
-	[KEY_CLOSE] = "Close",			[KEY_PLAY] = "Play",
-	[KEY_FASTFORWARD] = "Fast Forward",	[KEY_BASSBOOST] = "Bass Boost",
-	[KEY_PRINT] = "Print",			[KEY_HP] = "HP",
-	[KEY_CAMERA] = "Camera",		[KEY_SOUND] = "Sound",
-	[KEY_QUESTION] = "Question",		[KEY_EMAIL] = "Email",
-	[KEY_CHAT] = "Chat",			[KEY_SEARCH] = "Search",
-	[KEY_CONNECT] = "Connect",		[KEY_FINANCE] = "Finance",
-	[KEY_SPORT] = "Sport",			[KEY_SHOP] = "Shop",
-	[KEY_ALTERASE] = "Alternate Erase",	[KEY_CANCEL] = "Cancel",
-	[KEY_BRIGHTNESSDOWN] = "Brightness down", [KEY_BRIGHTNESSUP] = "Brightness up",
-	[KEY_MEDIA] = "Media",			[KEY_UNKNOWN] = "Unknown",
-	[KEY_OK] = "Ok",
-	[KEY_SELECT] = "Select",		[KEY_GOTO] = "Goto",
-	[KEY_CLEAR] = "Clear",			[KEY_POWER2] = "Power2",
-	[KEY_OPTION] = "Option",		[KEY_INFO] = "Info",
-	[KEY_TIME] = "Time",			[KEY_VENDOR] = "Vendor",
-	[KEY_ARCHIVE] = "Archive",		[KEY_PROGRAM] = "Program",
-	[KEY_CHANNEL] = "Channel",		[KEY_FAVORITES] = "Favorites",
-	[KEY_EPG] = "EPG",			[KEY_PVR] = "PVR",
-	[KEY_MHP] = "MHP",			[KEY_LANGUAGE] = "Language",
-	[KEY_TITLE] = "Title",			[KEY_SUBTITLE] = "Subtitle",
-	[KEY_ANGLE] = "Angle",			[KEY_ZOOM] = "Zoom",
-	[KEY_MODE] = "Mode",			[KEY_KEYBOARD] = "Keyboard",
-	[KEY_SCREEN] = "Screen",		[KEY_PC] = "PC",
-	[KEY_TV] = "TV",			[KEY_TV2] = "TV2",
-	[KEY_VCR] = "VCR",			[KEY_VCR2] = "VCR2",
-	[KEY_SAT] = "Sat",			[KEY_SAT2] = "Sat2",
-	[KEY_CD] = "CD",			[KEY_TAPE] = "Tape",
-	[KEY_RADIO] = "Radio",			[KEY_TUNER] = "Tuner",
-	[KEY_PLAYER] = "Player",		[KEY_TEXT] = "Text",
-	[KEY_DVD] = "DVD",			[KEY_AUX] = "Aux",
-	[KEY_MP3] = "MP3",			[KEY_AUDIO] = "Audio",
-	[KEY_VIDEO] = "Video",			[KEY_DIRECTORY] = "Directory",
-	[KEY_LIST] = "List",			[KEY_MEMO] = "Memo",
-	[KEY_CALENDAR] = "Calendar",		[KEY_RED] = "Red",
-	[KEY_GREEN] = "Green",			[KEY_YELLOW] = "Yellow",
-	[KEY_BLUE] = "Blue",			[KEY_CHANNELUP] = "ChannelUp",
-	[KEY_CHANNELDOWN] = "ChannelDown",	[KEY_FIRST] = "First",
-	[KEY_LAST] = "Last",			[KEY_AB] = "AB",
-	[KEY_NEXT] = "Next",			[KEY_RESTART] = "Restart",
-	[KEY_SLOW] = "Slow",			[KEY_SHUFFLE] = "Shuffle",
-	[KEY_BREAK] = "Break",			[KEY_PREVIOUS] = "Previous",
-	[KEY_DIGITS] = "Digits",		[KEY_TEEN] = "TEEN",
-	[KEY_TWEN] = "TWEN",			[KEY_DEL_EOL] = "Delete EOL",
-	[KEY_DEL_EOS] = "Delete EOS",		[KEY_INS_LINE] = "Insert line",
-	[KEY_DEL_LINE] = "Delete line",
-	[KEY_VIDEOPHONE] = "Videophone",	[KEY_GAMES] = "Games",
-	[KEY_ZOOMIN] = "Zoom In",		[KEY_ZOOMOUT] = "Zoom Out",
-	[KEY_ZOOMRESET] = "Zoom Reset",		[KEY_WORDPROCESSOR] = "Word Processor",
-	[KEY_EDITOR] = "Editor",		[KEY_SPREADSHEET] = "Spreadsheet",
-	[KEY_GRAPHICSEDITOR] = "Graphics Editor", [KEY_PRESENTATION] = "Presentation",
-	[KEY_DATABASE] = "Database",		[KEY_NEWS] = "News",
-	[KEY_VOICEMAIL] = "Voicemail",		[KEY_ADDRESSBOOK] = "Addressbook",
-	[KEY_MESSENGER] = "Messenger",		[KEY_DISPLAYTOGGLE] = "Display Toggle",
-	[KEY_SPELLCHECK] = "Spellcheck",	[KEY_LOGOFF] = "Log Off",
-	[KEY_DOLLAR] = "Dollar",		[KEY_EURO] = "Euro",
-	[KEY_FRAMEBACK] = "Frame Back",	 [KEY_FRAMEFORWARD] = "Frame Forward",
-	[KEY_CONTEXT_MENU] = "Context Menu",	[KEY_MEDIA_REPEAT] = "Media Repeat",
-	[KEY_DEL_EOL] = "Delete EOL",		[KEY_DEL_EOS] = "Delete EOS",
-	[KEY_INS_LINE] = "Insert Line",	 [KEY_DEL_LINE] = "Delete Line",
-	[KEY_FN] = "Fn",			[KEY_FN_ESC] = "Fn Esc",
-	[KEY_FN_F1] = "Fn F1",			[KEY_FN_F2] = "Fn F2",
-	[KEY_FN_F3] = "Fn F3",			[KEY_FN_F4] = "Fn F4",
-	[KEY_FN_F5] = "Fn F5",			[KEY_FN_F6] = "Fn F6",
-	[KEY_FN_F7] = "Fn F7",			[KEY_FN_F8] = "Fn F8",
-	[KEY_FN_F9] = "Fn F9",			[KEY_FN_F10] = "Fn F10",
-	[KEY_FN_F11] = "Fn F11",		[KEY_FN_F12] = "Fn F12",
-	[KEY_FN_1] = "Fn 1",			[KEY_FN_2] = "Fn 2",
-	[KEY_FN_D] = "Fn D",			[KEY_FN_E] = "Fn E",
-	[KEY_FN_F] = "Fn F",			[KEY_FN_S] = "Fn S",
-	[KEY_FN_B] = "Fn B",
-	[KEY_BRL_DOT1] = "Braille Dot 1",	[KEY_BRL_DOT2] = "Braille Dot 2",
-	[KEY_BRL_DOT3] = "Braille Dot 3",	[KEY_BRL_DOT4] = "Braille Dot 4",
-	[KEY_BRL_DOT5] = "Braille Dot 5",	[KEY_BRL_DOT6] = "Braille Dot 6",
-	[KEY_BRL_DOT7] = "Braille Dot 7",	[KEY_BRL_DOT8] = "Braille Dot 8",
-	[KEY_BRL_DOT9] = "Braille Dot 9",	[KEY_BRL_DOT10] = "Braille Dot 10",
-	[KEY_NUMERIC_0] = "Numeric 0",		[KEY_NUMERIC_1] = "Numeric 1",
-	[KEY_NUMERIC_2] = "Numeric 2",		[KEY_NUMERIC_3] = "Numeric 3",
-	[KEY_NUMERIC_4] = "Numeric 4",		[KEY_NUMERIC_5] = "Numeric 5",
-	[KEY_NUMERIC_6] = "Numeric 6",		[KEY_NUMERIC_7] = "Numeric 7",
-	[KEY_NUMERIC_8] = "Numeric 8",		[KEY_NUMERIC_9] = "Numeric 9",
-	[KEY_NUMERIC_STAR] = "Numeric *",	[KEY_NUMERIC_POUND] = "Numeric #",
-	[KEY_BATTERY] = "Battery",
-	[KEY_BLUETOOTH] = "Bluetooth",		[KEY_BRIGHTNESS_CYCLE] = "Brightness Cycle",
-	[KEY_BRIGHTNESS_ZERO] = "Brightness Zero", [KEY_DASHBOARD] = "Dashboard",
-	[KEY_DISPLAY_OFF] = "Display Off",	[KEY_DOCUMENTS] = "Documents",
-	[KEY_FORWARDMAIL] = "Forward Mail",	[KEY_NEW]  = "New",
-	[KEY_KBDILLUMDOWN] = "Kbd Illum Down",	[KEY_KBDILLUMUP] = "Kbd Illum Up",
-	[KEY_KBDILLUMTOGGLE] = "Kbd Illum Toggle", [KEY_REDO] = "Redo",
-	[KEY_REPLY] = "Reply",			[KEY_SAVE] = "Save",
-	[KEY_SCALE] = "Scale",			[KEY_SEND] = "Send",
-	[KEY_SCREENLOCK] = "Screen Lock",	[KEY_SWITCHVIDEOMODE] = "Switch Video Mode",
-	[KEY_UWB] = "UWB",			[KEY_VIDEO_NEXT] = "Video Next",
-	[KEY_VIDEO_PREV] = "Video Prev",	[KEY_WIMAX] = "WIMAX",
-	[KEY_WLAN] = "WLAN",
+	NAME_ELEMENT(KEY_RESERVED),		NAME_ELEMENT(KEY_ESC),
+	NAME_ELEMENT(KEY_1),			NAME_ELEMENT(KEY_2),
+	NAME_ELEMENT(KEY_3),			NAME_ELEMENT(KEY_4),
+	NAME_ELEMENT(KEY_5),			NAME_ELEMENT(KEY_6),
+	NAME_ELEMENT(KEY_7),			NAME_ELEMENT(KEY_8),
+	NAME_ELEMENT(KEY_9),			NAME_ELEMENT(KEY_0),
+	NAME_ELEMENT(KEY_MINUS),		NAME_ELEMENT(KEY_EQUAL),
+	NAME_ELEMENT(KEY_BACKSPACE),		NAME_ELEMENT(KEY_TAB),
+	NAME_ELEMENT(KEY_Q),			NAME_ELEMENT(KEY_W),
+	NAME_ELEMENT(KEY_E),			NAME_ELEMENT(KEY_R),
+	NAME_ELEMENT(KEY_T),			NAME_ELEMENT(KEY_Y),
+	NAME_ELEMENT(KEY_U),			NAME_ELEMENT(KEY_I),
+	NAME_ELEMENT(KEY_O),			NAME_ELEMENT(KEY_P),
+	NAME_ELEMENT(KEY_LEFTBRACE),		NAME_ELEMENT(KEY_RIGHTBRACE),
+	NAME_ELEMENT(KEY_ENTER),		NAME_ELEMENT(KEY_LEFTCTRL),
+	NAME_ELEMENT(KEY_A),			NAME_ELEMENT(KEY_S),
+	NAME_ELEMENT(KEY_D),			NAME_ELEMENT(KEY_F),
+	NAME_ELEMENT(KEY_G),			NAME_ELEMENT(KEY_H),
+	NAME_ELEMENT(KEY_J),			NAME_ELEMENT(KEY_K),
+	NAME_ELEMENT(KEY_L),			NAME_ELEMENT(KEY_SEMICOLON),
+	NAME_ELEMENT(KEY_APOSTROPHE),		NAME_ELEMENT(KEY_GRAVE),
+	NAME_ELEMENT(KEY_LEFTSHIFT),		NAME_ELEMENT(KEY_BACKSLASH),
+	NAME_ELEMENT(KEY_Z),			NAME_ELEMENT(KEY_X),
+	NAME_ELEMENT(KEY_C),			NAME_ELEMENT(KEY_V),
+	NAME_ELEMENT(KEY_B),			NAME_ELEMENT(KEY_N),
+	NAME_ELEMENT(KEY_M),			NAME_ELEMENT(KEY_COMMA),
+	NAME_ELEMENT(KEY_DOT),			NAME_ELEMENT(KEY_SLASH),
+	NAME_ELEMENT(KEY_RIGHTSHIFT),		NAME_ELEMENT(KEY_KPASTERISK),
+	NAME_ELEMENT(KEY_LEFTALT),		NAME_ELEMENT(KEY_SPACE),
+	NAME_ELEMENT(KEY_CAPSLOCK),		NAME_ELEMENT(KEY_F1),
+	NAME_ELEMENT(KEY_F2),			NAME_ELEMENT(KEY_F3),
+	NAME_ELEMENT(KEY_F4),			NAME_ELEMENT(KEY_F5),
+	NAME_ELEMENT(KEY_F6),			NAME_ELEMENT(KEY_F7),
+	NAME_ELEMENT(KEY_F8),			NAME_ELEMENT(KEY_F9),
+	NAME_ELEMENT(KEY_F10),			NAME_ELEMENT(KEY_NUMLOCK),
+	NAME_ELEMENT(KEY_SCROLLLOCK),		NAME_ELEMENT(KEY_KP7),
+	NAME_ELEMENT(KEY_KP8),			NAME_ELEMENT(KEY_KP9),
+	NAME_ELEMENT(KEY_KPMINUS),		NAME_ELEMENT(KEY_KP4),
+	NAME_ELEMENT(KEY_KP5),			NAME_ELEMENT(KEY_KP6),
+	NAME_ELEMENT(KEY_KPPLUS),		NAME_ELEMENT(KEY_KP1),
+	NAME_ELEMENT(KEY_KP2),			NAME_ELEMENT(KEY_KP3),
+	NAME_ELEMENT(KEY_KP0),			NAME_ELEMENT(KEY_KPDOT),
+	NAME_ELEMENT(KEY_ZENKAKUHANKAKU), 	NAME_ELEMENT(KEY_102ND),
+	NAME_ELEMENT(KEY_F11),			NAME_ELEMENT(KEY_F12),
+	NAME_ELEMENT(KEY_RO),			NAME_ELEMENT(KEY_KATAKANA),
+	NAME_ELEMENT(KEY_HIRAGANA),		NAME_ELEMENT(KEY_HENKAN),
+	NAME_ELEMENT(KEY_KATAKANAHIRAGANA),	NAME_ELEMENT(KEY_MUHENKAN),
+	NAME_ELEMENT(KEY_KPJPCOMMA),		NAME_ELEMENT(KEY_KPENTER),
+	NAME_ELEMENT(KEY_RIGHTCTRL),		NAME_ELEMENT(KEY_KPSLASH),
+	NAME_ELEMENT(KEY_SYSRQ),		NAME_ELEMENT(KEY_RIGHTALT),
+	NAME_ELEMENT(KEY_LINEFEED),		NAME_ELEMENT(KEY_HOME),
+	NAME_ELEMENT(KEY_UP),			NAME_ELEMENT(KEY_PAGEUP),
+	NAME_ELEMENT(KEY_LEFT),			NAME_ELEMENT(KEY_RIGHT),
+	NAME_ELEMENT(KEY_END),			NAME_ELEMENT(KEY_DOWN),
+	NAME_ELEMENT(KEY_PAGEDOWN),		NAME_ELEMENT(KEY_INSERT),
+	NAME_ELEMENT(KEY_DELETE),		NAME_ELEMENT(KEY_MACRO),
+	NAME_ELEMENT(KEY_MUTE),			NAME_ELEMENT(KEY_VOLUMEDOWN),
+	NAME_ELEMENT(KEY_VOLUMEUP),		NAME_ELEMENT(KEY_POWER),
+	NAME_ELEMENT(KEY_KPEQUAL),		NAME_ELEMENT(KEY_KPPLUSMINUS),
+	NAME_ELEMENT(KEY_PAUSE),		NAME_ELEMENT(KEY_KPCOMMA),
+	NAME_ELEMENT(KEY_HANGUEL),		NAME_ELEMENT(KEY_HANJA),
+	NAME_ELEMENT(KEY_YEN),			NAME_ELEMENT(KEY_LEFTMETA),
+	NAME_ELEMENT(KEY_RIGHTMETA),		NAME_ELEMENT(KEY_COMPOSE),
+	NAME_ELEMENT(KEY_STOP),			NAME_ELEMENT(KEY_AGAIN),
+	NAME_ELEMENT(KEY_PROPS),		NAME_ELEMENT(KEY_UNDO),
+	NAME_ELEMENT(KEY_FRONT),		NAME_ELEMENT(KEY_COPY),
+	NAME_ELEMENT(KEY_OPEN),			NAME_ELEMENT(KEY_PASTE),
+	NAME_ELEMENT(KEY_FIND),			NAME_ELEMENT(KEY_CUT),
+	NAME_ELEMENT(KEY_HELP),			NAME_ELEMENT(KEY_MENU),
+	NAME_ELEMENT(KEY_CALC),			NAME_ELEMENT(KEY_SETUP),
+	NAME_ELEMENT(KEY_SLEEP),		NAME_ELEMENT(KEY_WAKEUP),
+	NAME_ELEMENT(KEY_FILE),			NAME_ELEMENT(KEY_SENDFILE),
+	NAME_ELEMENT(KEY_DELETEFILE),		NAME_ELEMENT(KEY_XFER),
+	NAME_ELEMENT(KEY_PROG1),		NAME_ELEMENT(KEY_PROG2),
+	NAME_ELEMENT(KEY_WWW),			NAME_ELEMENT(KEY_MSDOS),
+	NAME_ELEMENT(KEY_COFFEE),		NAME_ELEMENT(KEY_DIRECTION),
+	NAME_ELEMENT(KEY_CYCLEWINDOWS),		NAME_ELEMENT(KEY_MAIL),
+	NAME_ELEMENT(KEY_BOOKMARKS),		NAME_ELEMENT(KEY_COMPUTER),
+	NAME_ELEMENT(KEY_BACK),			NAME_ELEMENT(KEY_FORWARD),
+	NAME_ELEMENT(KEY_CLOSECD),		NAME_ELEMENT(KEY_EJECTCD),
+	NAME_ELEMENT(KEY_EJECTCLOSECD),		NAME_ELEMENT(KEY_NEXTSONG),
+	NAME_ELEMENT(KEY_PLAYPAUSE),		NAME_ELEMENT(KEY_PREVIOUSSONG),
+	NAME_ELEMENT(KEY_STOPCD),		NAME_ELEMENT(KEY_RECORD),
+	NAME_ELEMENT(KEY_REWIND),		NAME_ELEMENT(KEY_PHONE),
+	NAME_ELEMENT(KEY_ISO),			NAME_ELEMENT(KEY_CONFIG),
+	NAME_ELEMENT(KEY_HOMEPAGE),		NAME_ELEMENT(KEY_REFRESH),
+	NAME_ELEMENT(KEY_EXIT),			NAME_ELEMENT(KEY_MOVE),
+	NAME_ELEMENT(KEY_EDIT),			NAME_ELEMENT(KEY_SCROLLUP),
+	NAME_ELEMENT(KEY_SCROLLDOWN),		NAME_ELEMENT(KEY_KPLEFTPAREN),
+	NAME_ELEMENT(KEY_KPRIGHTPAREN), 	NAME_ELEMENT(KEY_F13),
+	NAME_ELEMENT(KEY_F14),			NAME_ELEMENT(KEY_F15),
+	NAME_ELEMENT(KEY_F16),			NAME_ELEMENT(KEY_F17),
+	NAME_ELEMENT(KEY_F18),			NAME_ELEMENT(KEY_F19),
+	NAME_ELEMENT(KEY_F20),			NAME_ELEMENT(KEY_F21),
+	NAME_ELEMENT(KEY_F22),			NAME_ELEMENT(KEY_F23),
+	NAME_ELEMENT(KEY_F24),			NAME_ELEMENT(KEY_PLAYCD),
+	NAME_ELEMENT(KEY_PAUSECD),		NAME_ELEMENT(KEY_PROG3),
+	NAME_ELEMENT(KEY_PROG4),		NAME_ELEMENT(KEY_SUSPEND),
+	NAME_ELEMENT(KEY_CLOSE),		NAME_ELEMENT(KEY_PLAY),
+	NAME_ELEMENT(KEY_FASTFORWARD),		NAME_ELEMENT(KEY_BASSBOOST),
+	NAME_ELEMENT(KEY_PRINT),		NAME_ELEMENT(KEY_HP),
+	NAME_ELEMENT(KEY_CAMERA),		NAME_ELEMENT(KEY_SOUND),
+	NAME_ELEMENT(KEY_QUESTION),		NAME_ELEMENT(KEY_EMAIL),
+	NAME_ELEMENT(KEY_CHAT),			NAME_ELEMENT(KEY_SEARCH),
+	NAME_ELEMENT(KEY_CONNECT),		NAME_ELEMENT(KEY_FINANCE),
+	NAME_ELEMENT(KEY_SPORT),		NAME_ELEMENT(KEY_SHOP),
+	NAME_ELEMENT(KEY_ALTERASE),		NAME_ELEMENT(KEY_CANCEL),
+	NAME_ELEMENT(KEY_BRIGHTNESSDOWN),	NAME_ELEMENT(KEY_BRIGHTNESSUP),
+	NAME_ELEMENT(KEY_MEDIA),		NAME_ELEMENT(KEY_UNKNOWN),
+	NAME_ELEMENT(KEY_OK),
+	NAME_ELEMENT(KEY_SELECT),		NAME_ELEMENT(KEY_GOTO),
+	NAME_ELEMENT(KEY_CLEAR),		NAME_ELEMENT(KEY_POWER2),
+	NAME_ELEMENT(KEY_OPTION),		NAME_ELEMENT(KEY_INFO),
+	NAME_ELEMENT(KEY_TIME),			NAME_ELEMENT(KEY_VENDOR),
+	NAME_ELEMENT(KEY_ARCHIVE),		NAME_ELEMENT(KEY_PROGRAM),
+	NAME_ELEMENT(KEY_CHANNEL),		NAME_ELEMENT(KEY_FAVORITES),
+	NAME_ELEMENT(KEY_EPG),			NAME_ELEMENT(KEY_PVR),
+	NAME_ELEMENT(KEY_MHP),			NAME_ELEMENT(KEY_LANGUAGE),
+	NAME_ELEMENT(KEY_TITLE),		NAME_ELEMENT(KEY_SUBTITLE),
+	NAME_ELEMENT(KEY_ANGLE),		NAME_ELEMENT(KEY_ZOOM),
+	NAME_ELEMENT(KEY_MODE),			NAME_ELEMENT(KEY_KEYBOARD),
+	NAME_ELEMENT(KEY_SCREEN),		NAME_ELEMENT(KEY_PC),
+	NAME_ELEMENT(KEY_TV),			NAME_ELEMENT(KEY_TV2),
+	NAME_ELEMENT(KEY_VCR),			NAME_ELEMENT(KEY_VCR2),
+	NAME_ELEMENT(KEY_SAT),			NAME_ELEMENT(KEY_SAT2),
+	NAME_ELEMENT(KEY_CD),			NAME_ELEMENT(KEY_TAPE),
+	NAME_ELEMENT(KEY_RADIO),		NAME_ELEMENT(KEY_TUNER),
+	NAME_ELEMENT(KEY_PLAYER),		NAME_ELEMENT(KEY_TEXT),
+	NAME_ELEMENT(KEY_DVD),			NAME_ELEMENT(KEY_AUX),
+	NAME_ELEMENT(KEY_MP3),			NAME_ELEMENT(KEY_AUDIO),
+	NAME_ELEMENT(KEY_VIDEO),		NAME_ELEMENT(KEY_DIRECTORY),
+	NAME_ELEMENT(KEY_LIST),			NAME_ELEMENT(KEY_MEMO),
+	NAME_ELEMENT(KEY_CALENDAR),		NAME_ELEMENT(KEY_RED),
+	NAME_ELEMENT(KEY_GREEN),		NAME_ELEMENT(KEY_YELLOW),
+	NAME_ELEMENT(KEY_BLUE),			NAME_ELEMENT(KEY_CHANNELUP),
+	NAME_ELEMENT(KEY_CHANNELDOWN),		NAME_ELEMENT(KEY_FIRST),
+	NAME_ELEMENT(KEY_LAST),			NAME_ELEMENT(KEY_AB),
+	NAME_ELEMENT(KEY_NEXT),			NAME_ELEMENT(KEY_RESTART),
+	NAME_ELEMENT(KEY_SLOW),			NAME_ELEMENT(KEY_SHUFFLE),
+	NAME_ELEMENT(KEY_BREAK),		NAME_ELEMENT(KEY_PREVIOUS),
+	NAME_ELEMENT(KEY_DIGITS),		NAME_ELEMENT(KEY_TEEN),
+	NAME_ELEMENT(KEY_TWEN),			NAME_ELEMENT(KEY_DEL_EOL),
+	NAME_ELEMENT(KEY_DEL_EOS),		NAME_ELEMENT(KEY_INS_LINE),
+	NAME_ELEMENT(KEY_DEL_LINE),
+	NAME_ELEMENT(KEY_VIDEOPHONE),		NAME_ELEMENT(KEY_GAMES),
+	NAME_ELEMENT(KEY_ZOOMIN),		NAME_ELEMENT(KEY_ZOOMOUT),
+	NAME_ELEMENT(KEY_ZOOMRESET),		NAME_ELEMENT(KEY_WORDPROCESSOR),
+	NAME_ELEMENT(KEY_EDITOR),		NAME_ELEMENT(KEY_SPREADSHEET),
+	NAME_ELEMENT(KEY_GRAPHICSEDITOR), 	NAME_ELEMENT(KEY_PRESENTATION),
+	NAME_ELEMENT(KEY_DATABASE),		NAME_ELEMENT(KEY_NEWS),
+	NAME_ELEMENT(KEY_VOICEMAIL),		NAME_ELEMENT(KEY_ADDRESSBOOK),
+	NAME_ELEMENT(KEY_MESSENGER),		NAME_ELEMENT(KEY_DISPLAYTOGGLE),
+	NAME_ELEMENT(KEY_SPELLCHECK),		NAME_ELEMENT(KEY_LOGOFF),
+	NAME_ELEMENT(KEY_DOLLAR),		NAME_ELEMENT(KEY_EURO),
+	NAME_ELEMENT(KEY_FRAMEBACK),	 	NAME_ELEMENT(KEY_FRAMEFORWARD),
+	NAME_ELEMENT(KEY_CONTEXT_MENU),		NAME_ELEMENT(KEY_MEDIA_REPEAT),
+	NAME_ELEMENT(KEY_DEL_EOL),		NAME_ELEMENT(KEY_DEL_EOS),
+	NAME_ELEMENT(KEY_INS_LINE),	 	NAME_ELEMENT(KEY_DEL_LINE),
+	NAME_ELEMENT(KEY_FN),			NAME_ELEMENT(KEY_FN_ESC),
+	NAME_ELEMENT(KEY_FN_F1),		NAME_ELEMENT(KEY_FN_F2),
+	NAME_ELEMENT(KEY_FN_F3),		NAME_ELEMENT(KEY_FN_F4),
+	NAME_ELEMENT(KEY_FN_F5),		NAME_ELEMENT(KEY_FN_F6),
+	NAME_ELEMENT(KEY_FN_F7),		NAME_ELEMENT(KEY_FN_F8),
+	NAME_ELEMENT(KEY_FN_F9),		NAME_ELEMENT(KEY_FN_F10),
+	NAME_ELEMENT(KEY_FN_F11),		NAME_ELEMENT(KEY_FN_F12),
+	NAME_ELEMENT(KEY_FN_1),			NAME_ELEMENT(KEY_FN_2),
+	NAME_ELEMENT(KEY_FN_D),			NAME_ELEMENT(KEY_FN_E),
+	NAME_ELEMENT(KEY_FN_F),			NAME_ELEMENT(KEY_FN_S),
+	NAME_ELEMENT(KEY_FN_B),
+	NAME_ELEMENT(KEY_BRL_DOT1),		NAME_ELEMENT(KEY_BRL_DOT2),
+	NAME_ELEMENT(KEY_BRL_DOT3),		NAME_ELEMENT(KEY_BRL_DOT4),
+	NAME_ELEMENT(KEY_BRL_DOT5),		NAME_ELEMENT(KEY_BRL_DOT6),
+	NAME_ELEMENT(KEY_BRL_DOT7),		NAME_ELEMENT(KEY_BRL_DOT8),
+	NAME_ELEMENT(KEY_BRL_DOT9),		NAME_ELEMENT(KEY_BRL_DOT10),
+	NAME_ELEMENT(KEY_NUMERIC_0),		NAME_ELEMENT(KEY_NUMERIC_1),
+	NAME_ELEMENT(KEY_NUMERIC_2),		NAME_ELEMENT(KEY_NUMERIC_3),
+	NAME_ELEMENT(KEY_NUMERIC_4),		NAME_ELEMENT(KEY_NUMERIC_5),
+	NAME_ELEMENT(KEY_NUMERIC_6),		NAME_ELEMENT(KEY_NUMERIC_7),
+	NAME_ELEMENT(KEY_NUMERIC_8),		NAME_ELEMENT(KEY_NUMERIC_9),
+	NAME_ELEMENT(KEY_NUMERIC_STAR),		NAME_ELEMENT(KEY_NUMERIC_POUND),
+	NAME_ELEMENT(KEY_BATTERY),
+	NAME_ELEMENT(KEY_BLUETOOTH),		NAME_ELEMENT(KEY_BRIGHTNESS_CYCLE),
+	NAME_ELEMENT(KEY_BRIGHTNESS_ZERO), 	NAME_ELEMENT(KEY_DASHBOARD),
+	NAME_ELEMENT(KEY_DISPLAY_OFF),		NAME_ELEMENT(KEY_DOCUMENTS),
+	NAME_ELEMENT(KEY_FORWARDMAIL),		NAME_ELEMENT(KEY_NEW),
+	NAME_ELEMENT(KEY_KBDILLUMDOWN),		NAME_ELEMENT(KEY_KBDILLUMUP),
+	NAME_ELEMENT(KEY_KBDILLUMTOGGLE), 	NAME_ELEMENT(KEY_REDO),
+	NAME_ELEMENT(KEY_REPLY),		NAME_ELEMENT(KEY_SAVE),
+	NAME_ELEMENT(KEY_SCALE),		NAME_ELEMENT(KEY_SEND),
+	NAME_ELEMENT(KEY_SCREENLOCK),		NAME_ELEMENT(KEY_SWITCHVIDEOMODE),
+	NAME_ELEMENT(KEY_UWB),			NAME_ELEMENT(KEY_VIDEO_NEXT),
+	NAME_ELEMENT(KEY_VIDEO_PREV),		NAME_ELEMENT(KEY_WIMAX),
+	NAME_ELEMENT(KEY_WLAN),
 #ifdef KEY_RFKILL
-	[KEY_RFKILL] = "RF kill",
+	NAME_ELEMENT(KEY_RFKILL),
 #endif
 #ifdef KEY_WPS_BUTTON
-	[KEY_WPS_BUTTON] = "WPS Button",
+	NAME_ELEMENT(KEY_WPS_BUTTON),
 #endif
 #ifdef KEY_TOUCHPAD_TOGGLE
-	[KEY_TOUCHPAD_TOGGLE] = "Touchpad Toggle",
-	[KEY_TOUCHPAD_ON] = "Touchpad On",
-	[KEY_TOUCHPAD_OFF] = "Touchpad Off",
+	NAME_ELEMENT(KEY_TOUCHPAD_TOGGLE),
+	NAME_ELEMENT(KEY_TOUCHPAD_ON),
+	NAME_ELEMENT(KEY_TOUCHPAD_OFF),
 #endif
 
-	[BTN_0] = "Btn0",			[BTN_1] = "Btn1",
-	[BTN_2] = "Btn2",			[BTN_3] = "Btn3",
-	[BTN_4] = "Btn4",			[BTN_5] = "Btn5",
-	[BTN_6] = "Btn6",			[BTN_7] = "Btn7",
-	[BTN_8] = "Btn8",			[BTN_9] = "Btn9",
-	[BTN_LEFT] = "LeftBtn",			[BTN_RIGHT] = "RightBtn",
-	[BTN_MIDDLE] = "MiddleBtn",		[BTN_SIDE] = "SideBtn",
-	[BTN_EXTRA] = "ExtraBtn",		[BTN_FORWARD] = "ForwardBtn",
-	[BTN_BACK] = "BackBtn",			[BTN_TASK] = "TaskBtn",
-	[BTN_TRIGGER] = "Trigger",		[BTN_THUMB] = "ThumbBtn",
-	[BTN_THUMB2] = "ThumbBtn2",		[BTN_TOP] = "TopBtn",
-	[BTN_TOP2] = "TopBtn2",			[BTN_PINKIE] = "PinkieBtn",
-	[BTN_BASE] = "BaseBtn",			[BTN_BASE2] = "BaseBtn2",
-	[BTN_BASE3] = "BaseBtn3",		[BTN_BASE4] = "BaseBtn4",
-	[BTN_BASE5] = "BaseBtn5",		[BTN_BASE6] = "BaseBtn6",
-	[BTN_DEAD] = "BtnDead",			[BTN_A] = "BtnA",
-	[BTN_B] = "BtnB",			[BTN_C] = "BtnC",
-	[BTN_X] = "BtnX",			[BTN_Y] = "BtnY",
-	[BTN_Z] = "BtnZ",			[BTN_TL] = "BtnTL",
-	[BTN_TR] = "BtnTR",			[BTN_TL2] = "BtnTL2",
-	[BTN_TR2] = "BtnTR2",			[BTN_SELECT] = "BtnSelect",
-	[BTN_START] = "BtnStart",		[BTN_MODE] = "BtnMode",
-	[BTN_THUMBL] = "BtnThumbL",		[BTN_THUMBR] = "BtnThumbR",
-	[BTN_TOOL_PEN] = "ToolPen",		[BTN_TOOL_RUBBER] = "ToolRubber",
-	[BTN_TOOL_BRUSH] = "ToolBrush",		[BTN_TOOL_PENCIL] = "ToolPencil",
-	[BTN_TOOL_AIRBRUSH] = "ToolAirbrush",	[BTN_TOOL_FINGER] = "ToolFinger",
-	[BTN_TOOL_MOUSE] = "ToolMouse",		[BTN_TOOL_LENS] = "ToolLens",
-	[BTN_TOUCH] = "Touch",			[BTN_STYLUS] = "Stylus",
-	[BTN_STYLUS2] = "Stylus2",		[BTN_TOOL_DOUBLETAP] = "Tool Doubletap",
-	[BTN_TOOL_TRIPLETAP] = "Tool Tripletap", [BTN_TOOL_QUADTAP] = "Tool Quadtap",
-	[BTN_GEAR_DOWN] = "WheelBtn",
-	[BTN_GEAR_UP] = "Gear up",
+	NAME_ELEMENT(BTN_0),			NAME_ELEMENT(BTN_1),
+	NAME_ELEMENT(BTN_2),			NAME_ELEMENT(BTN_3),
+	NAME_ELEMENT(BTN_4),			NAME_ELEMENT(BTN_5),
+	NAME_ELEMENT(BTN_6),			NAME_ELEMENT(BTN_7),
+	NAME_ELEMENT(BTN_8),			NAME_ELEMENT(BTN_9),
+	NAME_ELEMENT(BTN_LEFT),			NAME_ELEMENT(BTN_RIGHT),
+	NAME_ELEMENT(BTN_MIDDLE),		NAME_ELEMENT(BTN_SIDE),
+	NAME_ELEMENT(BTN_EXTRA),		NAME_ELEMENT(BTN_FORWARD),
+	NAME_ELEMENT(BTN_BACK),			NAME_ELEMENT(BTN_TASK),
+	NAME_ELEMENT(BTN_TRIGGER),		NAME_ELEMENT(BTN_THUMB),
+	NAME_ELEMENT(BTN_THUMB2),		NAME_ELEMENT(BTN_TOP),
+	NAME_ELEMENT(BTN_TOP2),			NAME_ELEMENT(BTN_PINKIE),
+	NAME_ELEMENT(BTN_BASE),			NAME_ELEMENT(BTN_BASE2),
+	NAME_ELEMENT(BTN_BASE3),		NAME_ELEMENT(BTN_BASE4),
+	NAME_ELEMENT(BTN_BASE5),		NAME_ELEMENT(BTN_BASE6),
+	NAME_ELEMENT(BTN_DEAD),			NAME_ELEMENT(BTN_A),
+	NAME_ELEMENT(BTN_B),			NAME_ELEMENT(BTN_C),
+	NAME_ELEMENT(BTN_X),			NAME_ELEMENT(BTN_Y),
+	NAME_ELEMENT(BTN_Z),			NAME_ELEMENT(BTN_TL),
+	NAME_ELEMENT(BTN_TR),			NAME_ELEMENT(BTN_TL2),
+	NAME_ELEMENT(BTN_TR2),			NAME_ELEMENT(BTN_SELECT),
+	NAME_ELEMENT(BTN_START),		NAME_ELEMENT(BTN_MODE),
+	NAME_ELEMENT(BTN_THUMBL),		NAME_ELEMENT(BTN_THUMBR),
+	NAME_ELEMENT(BTN_TOOL_PEN),		NAME_ELEMENT(BTN_TOOL_RUBBER),
+	NAME_ELEMENT(BTN_TOOL_BRUSH),		NAME_ELEMENT(BTN_TOOL_PENCIL),
+	NAME_ELEMENT(BTN_TOOL_AIRBRUSH),	NAME_ELEMENT(BTN_TOOL_FINGER),
+	NAME_ELEMENT(BTN_TOOL_MOUSE),		NAME_ELEMENT(BTN_TOOL_LENS),
+	NAME_ELEMENT(BTN_TOUCH),		NAME_ELEMENT(BTN_STYLUS),
+	NAME_ELEMENT(BTN_STYLUS2),		NAME_ELEMENT(BTN_TOOL_DOUBLETAP),
+	NAME_ELEMENT(BTN_TOOL_TRIPLETAP), 	NAME_ELEMENT(BTN_TOOL_QUADTAP),
+	NAME_ELEMENT(BTN_GEAR_DOWN),
+	NAME_ELEMENT(BTN_GEAR_UP),
 
 #ifdef BTN_TRIGGER_HAPPY
-	[BTN_TRIGGER_HAPPY1] = "Trigger Happy 1",	[BTN_TRIGGER_HAPPY11] = "Trigger Happy 11",
-	[BTN_TRIGGER_HAPPY2] = "Trigger Happy 2",	[BTN_TRIGGER_HAPPY12] = "Trigger Happy 12",
-	[BTN_TRIGGER_HAPPY3] = "Trigger Happy 3",	[BTN_TRIGGER_HAPPY13] = "Trigger Happy 13",
-	[BTN_TRIGGER_HAPPY4] = "Trigger Happy 4",	[BTN_TRIGGER_HAPPY14] = "Trigger Happy 14",
-	[BTN_TRIGGER_HAPPY5] = "Trigger Happy 5",	[BTN_TRIGGER_HAPPY15] = "Trigger Happy 15",
-	[BTN_TRIGGER_HAPPY6] = "Trigger Happy 6",	[BTN_TRIGGER_HAPPY16] = "Trigger Happy 16",
-	[BTN_TRIGGER_HAPPY7] = "Trigger Happy 7",	[BTN_TRIGGER_HAPPY17] = "Trigger Happy 17",
-	[BTN_TRIGGER_HAPPY8] = "Trigger Happy 8",	[BTN_TRIGGER_HAPPY18] = "Trigger Happy 18",
-	[BTN_TRIGGER_HAPPY9] = "Trigger Happy 9",	[BTN_TRIGGER_HAPPY19] = "Trigger Happy 19",
-	[BTN_TRIGGER_HAPPY10] = "Trigger Happy 10",	[BTN_TRIGGER_HAPPY20] = "Trigger Happy 20",
-
-	[BTN_TRIGGER_HAPPY21] = "Trigger Happy 21",	[BTN_TRIGGER_HAPPY31] = "Trigger Happy 31",
-	[BTN_TRIGGER_HAPPY22] = "Trigger Happy 22",	[BTN_TRIGGER_HAPPY32] = "Trigger Happy 32",
-	[BTN_TRIGGER_HAPPY23] = "Trigger Happy 23",	[BTN_TRIGGER_HAPPY33] = "Trigger Happy 33",
-	[BTN_TRIGGER_HAPPY24] = "Trigger Happy 24",	[BTN_TRIGGER_HAPPY34] = "Trigger Happy 34",
-	[BTN_TRIGGER_HAPPY25] = "Trigger Happy 25",	[BTN_TRIGGER_HAPPY35] = "Trigger Happy 35",
-	[BTN_TRIGGER_HAPPY26] = "Trigger Happy 26",	[BTN_TRIGGER_HAPPY36] = "Trigger Happy 36",
-	[BTN_TRIGGER_HAPPY27] = "Trigger Happy 27",	[BTN_TRIGGER_HAPPY37] = "Trigger Happy 37",
-	[BTN_TRIGGER_HAPPY28] = "Trigger Happy 28",	[BTN_TRIGGER_HAPPY38] = "Trigger Happy 38",
-	[BTN_TRIGGER_HAPPY29] = "Trigger Happy 29",	[BTN_TRIGGER_HAPPY39] = "Trigger Happy 39",
-	[BTN_TRIGGER_HAPPY30] = "Trigger Happy 30",	[BTN_TRIGGER_HAPPY40] = "Trigger Happy 40",
+	NAME_ELEMENT(BTN_TRIGGER_HAPPY1),	NAME_ELEMENT(BTN_TRIGGER_HAPPY11),
+	NAME_ELEMENT(BTN_TRIGGER_HAPPY2),	NAME_ELEMENT(BTN_TRIGGER_HAPPY12),
+	NAME_ELEMENT(BTN_TRIGGER_HAPPY3),	NAME_ELEMENT(BTN_TRIGGER_HAPPY13),
+	NAME_ELEMENT(BTN_TRIGGER_HAPPY4),	NAME_ELEMENT(BTN_TRIGGER_HAPPY14),
+	NAME_ELEMENT(BTN_TRIGGER_HAPPY5),	NAME_ELEMENT(BTN_TRIGGER_HAPPY15),
+	NAME_ELEMENT(BTN_TRIGGER_HAPPY6),	NAME_ELEMENT(BTN_TRIGGER_HAPPY16),
+	NAME_ELEMENT(BTN_TRIGGER_HAPPY7),	NAME_ELEMENT(BTN_TRIGGER_HAPPY17),
+	NAME_ELEMENT(BTN_TRIGGER_HAPPY8),	NAME_ELEMENT(BTN_TRIGGER_HAPPY18),
+	NAME_ELEMENT(BTN_TRIGGER_HAPPY9),	NAME_ELEMENT(BTN_TRIGGER_HAPPY19),
+	NAME_ELEMENT(BTN_TRIGGER_HAPPY10),	NAME_ELEMENT(BTN_TRIGGER_HAPPY20),
+
+	NAME_ELEMENT(BTN_TRIGGER_HAPPY21),	NAME_ELEMENT(BTN_TRIGGER_HAPPY31),
+	NAME_ELEMENT(BTN_TRIGGER_HAPPY22),	NAME_ELEMENT(BTN_TRIGGER_HAPPY32),
+	NAME_ELEMENT(BTN_TRIGGER_HAPPY23),	NAME_ELEMENT(BTN_TRIGGER_HAPPY33),
+	NAME_ELEMENT(BTN_TRIGGER_HAPPY24),	NAME_ELEMENT(BTN_TRIGGER_HAPPY34),
+	NAME_ELEMENT(BTN_TRIGGER_HAPPY25),	NAME_ELEMENT(BTN_TRIGGER_HAPPY35),
+	NAME_ELEMENT(BTN_TRIGGER_HAPPY26),	NAME_ELEMENT(BTN_TRIGGER_HAPPY36),
+	NAME_ELEMENT(BTN_TRIGGER_HAPPY27),	NAME_ELEMENT(BTN_TRIGGER_HAPPY37),
+	NAME_ELEMENT(BTN_TRIGGER_HAPPY28),	NAME_ELEMENT(BTN_TRIGGER_HAPPY38),
+	NAME_ELEMENT(BTN_TRIGGER_HAPPY29),	NAME_ELEMENT(BTN_TRIGGER_HAPPY39),
+	NAME_ELEMENT(BTN_TRIGGER_HAPPY30),	NAME_ELEMENT(BTN_TRIGGER_HAPPY40),
 #endif
 };
 
-char *absval[6] = { "Value", "Min  ", "Max  ", "Fuzz ", "Flat ", "Resolution "};
+static const char * const absval[6] = { "Value", "Min  ", "Max  ", "Fuzz ", "Flat ", "Resolution "};
 
-char *relatives[REL_MAX + 1] = {
+static const char * const relatives[REL_MAX + 1] = {
 	[0 ... REL_MAX] = NULL,
-	[REL_X] = "X",			[REL_Y] = "Y",
-	[REL_Z] = "Z",			[REL_RX] = "Rx",
-	[REL_RY] = "Ry",		[REL_RZ] = "Rz",
-	[REL_HWHEEL] = "HWheel",
-	[REL_DIAL] = "Dial",		[REL_WHEEL] = "Wheel",
-	[REL_MISC] = "Misc",
+	NAME_ELEMENT(REL_X),			NAME_ELEMENT(REL_Y),
+	NAME_ELEMENT(REL_Z),			NAME_ELEMENT(REL_RX),
+	NAME_ELEMENT(REL_RY),			NAME_ELEMENT(REL_RZ),
+	NAME_ELEMENT(REL_HWHEEL),
+	NAME_ELEMENT(REL_DIAL),			NAME_ELEMENT(REL_WHEEL),
+	NAME_ELEMENT(REL_MISC),
 };
 
-char *absolutes[ABS_MAX + 1] = {
+static const char * const absolutes[ABS_MAX + 1] = {
 	[0 ... ABS_MAX] = NULL,
-	[ABS_X] = "X",			[ABS_Y] = "Y",
-	[ABS_Z] = "Z",			[ABS_RX] = "Rx",
-	[ABS_RY] = "Ry",		[ABS_RZ] = "Rz",
-	[ABS_THROTTLE] = "Throttle",	[ABS_RUDDER] = "Rudder",
-	[ABS_WHEEL] = "Wheel",		[ABS_GAS] = "Gas",
-	[ABS_BRAKE] = "Brake",		[ABS_HAT0X] = "Hat0X",
-	[ABS_HAT0Y] = "Hat0Y",		[ABS_HAT1X] = "Hat1X",
-	[ABS_HAT1Y] = "Hat1Y",		[ABS_HAT2X] = "Hat2X",
-	[ABS_HAT2Y] = "Hat2Y",		[ABS_HAT3X] = "Hat3X",
-	[ABS_HAT3Y] = "Hat 3Y",		[ABS_PRESSURE] = "Pressure",
-	[ABS_DISTANCE] = "Distance",	[ABS_TILT_X] = "XTilt",
-	[ABS_TILT_Y] = "YTilt",		[ABS_TOOL_WIDTH] = "Tool Width",
-	[ABS_VOLUME] = "Volume",	[ABS_MISC] = "Misc",
+	NAME_ELEMENT(ABS_X),			NAME_ELEMENT(ABS_Y),
+	NAME_ELEMENT(ABS_Z),			NAME_ELEMENT(ABS_RX),
+	NAME_ELEMENT(ABS_RY),			NAME_ELEMENT(ABS_RZ),
+	NAME_ELEMENT(ABS_THROTTLE),		NAME_ELEMENT(ABS_RUDDER),
+	NAME_ELEMENT(ABS_WHEEL),		NAME_ELEMENT(ABS_GAS),
+	NAME_ELEMENT(ABS_BRAKE),		NAME_ELEMENT(ABS_HAT0X),
+	NAME_ELEMENT(ABS_HAT0Y),		NAME_ELEMENT(ABS_HAT1X),
+	NAME_ELEMENT(ABS_HAT1Y),		NAME_ELEMENT(ABS_HAT2X),
+	NAME_ELEMENT(ABS_HAT2Y),		NAME_ELEMENT(ABS_HAT3X),
+	NAME_ELEMENT(ABS_HAT3Y),		NAME_ELEMENT(ABS_PRESSURE),
+	NAME_ELEMENT(ABS_DISTANCE),		NAME_ELEMENT(ABS_TILT_X),
+	NAME_ELEMENT(ABS_TILT_Y),		NAME_ELEMENT(ABS_TOOL_WIDTH),
+	NAME_ELEMENT(ABS_VOLUME),		NAME_ELEMENT(ABS_MISC),
 #ifdef ABS_MT_BLOB_ID
-	[ABS_MT_TOUCH_MAJOR] = "Touch Major",
-	[ABS_MT_TOUCH_MINOR] = "Touch Minor",
-	[ABS_MT_WIDTH_MAJOR] = "Width Major",
-	[ABS_MT_WIDTH_MINOR] = "Width Minor",
-	[ABS_MT_ORIENTATION] = "Orientation",
-	[ABS_MT_POSITION_X] = "Position X",
-	[ABS_MT_POSITION_Y] = "Position Y",
-	[ABS_MT_TOOL_TYPE] = "Tool Type",
-	[ABS_MT_BLOB_ID] = "Blob ID",
+	NAME_ELEMENT(ABS_MT_TOUCH_MAJOR),
+	NAME_ELEMENT(ABS_MT_TOUCH_MINOR),
+	NAME_ELEMENT(ABS_MT_WIDTH_MAJOR),
+	NAME_ELEMENT(ABS_MT_WIDTH_MINOR),
+	NAME_ELEMENT(ABS_MT_ORIENTATION),
+	NAME_ELEMENT(ABS_MT_POSITION_X),
+	NAME_ELEMENT(ABS_MT_POSITION_Y),
+	NAME_ELEMENT(ABS_MT_TOOL_TYPE),
+	NAME_ELEMENT(ABS_MT_BLOB_ID),
 #endif
 #ifdef ABS_MT_TRACKING_ID
-	[ABS_MT_TRACKING_ID] = "Tracking ID",
+	NAME_ELEMENT(ABS_MT_TRACKING_ID),
 #endif
 #ifdef ABS_MT_PRESSURE
-	[ABS_MT_PRESSURE] = "Pressure",
+	NAME_ELEMENT(ABS_MT_PRESSURE),
 #endif
 #ifdef ABS_MT_SLOT
-	[ABS_MT_SLOT] = "Slot",
+	NAME_ELEMENT(ABS_MT_SLOT),
 #endif
 
 };
 
-char *misc[MSC_MAX + 1] = {
+static const char * const misc[MSC_MAX + 1] = {
 	[ 0 ... MSC_MAX] = NULL,
-	[MSC_SERIAL] = "Serial",	[MSC_PULSELED] = "Pulseled",
-	[MSC_GESTURE] = "Gesture",	[MSC_RAW] = "RawData",
-	[MSC_SCAN] = "ScanCode",
+	NAME_ELEMENT(MSC_SERIAL),		NAME_ELEMENT(MSC_PULSELED),
+	NAME_ELEMENT(MSC_GESTURE),		NAME_ELEMENT(MSC_RAW),
+	NAME_ELEMENT(MSC_SCAN),
 };
 
-char *leds[LED_MAX + 1] = {
+static const char * const leds[LED_MAX + 1] = {
 	[0 ... LED_MAX] = NULL,
-	[LED_NUML] = "NumLock",		[LED_CAPSL] = "CapsLock",
-	[LED_SCROLLL] = "ScrollLock",	[LED_COMPOSE] = "Compose",
-	[LED_KANA] = "Kana",		[LED_SLEEP] = "Sleep",
-	[LED_SUSPEND] = "Suspend",	[LED_MUTE] = "Mute",
-	[LED_MISC] = "Misc",
+	NAME_ELEMENT(LED_NUML),			NAME_ELEMENT(LED_CAPSL),
+	NAME_ELEMENT(LED_SCROLLL),		NAME_ELEMENT(LED_COMPOSE),
+	NAME_ELEMENT(LED_KANA),			NAME_ELEMENT(LED_SLEEP),
+	NAME_ELEMENT(LED_SUSPEND),		NAME_ELEMENT(LED_MUTE),
+	NAME_ELEMENT(LED_MISC),
 };
 
-char *repeats[REP_MAX + 1] = {
+static const char * const repeats[REP_MAX + 1] = {
 	[0 ... REP_MAX] = NULL,
-	[REP_DELAY] = "Delay",		[REP_PERIOD] = "Period"
+	NAME_ELEMENT(REP_DELAY),		NAME_ELEMENT(REP_PERIOD)
 };
 
-char *sounds[SND_MAX + 1] = {
+static const char * const sounds[SND_MAX + 1] = {
 	[0 ... SND_MAX] = NULL,
-	[SND_CLICK] = "Click",		[SND_BELL] = "Bell",
-	[SND_TONE] = "Tone"
+	NAME_ELEMENT(SND_CLICK),		NAME_ELEMENT(SND_BELL),
+	NAME_ELEMENT(SND_TONE)
 };
 
-char *syns[3] = {
-	[SYN_REPORT] = "Report Sync",
-	[SYN_CONFIG] = "Config Sync",
+static const char * const syns[3] = {
+	NAME_ELEMENT(SYN_REPORT),
+	NAME_ELEMENT(SYN_CONFIG),
 #ifdef SYN_MT_REPORT
-	[SYN_MT_REPORT] = "MT Sync"
+	NAME_ELEMENT(SYN_MT_REPORT)
 #endif
 };
 
-char *switches[SW_MAX + 1] = {
+static const char * const switches[SW_MAX + 1] = {
 	[0 ... SW_MAX] = NULL,
-	[SW_LID] = "Lid",
-	[SW_TABLET_MODE] = "Tablet Mode",
-	[SW_HEADPHONE_INSERT] = "Headphone Insert",
-	[SW_RFKILL_ALL] = "RFKILL",
-	[SW_MICROPHONE_INSERT] = "Microphone Insert",
-	[SW_DOCK] = "Dock",
-	[SW_LINEOUT_INSERT] = "Lineout Insert",
-	[SW_JACK_PHYSICAL_INSERT] = "Jack Physical Insert",
+	NAME_ELEMENT(SW_LID),
+	NAME_ELEMENT(SW_TABLET_MODE),
+	NAME_ELEMENT(SW_HEADPHONE_INSERT),
+	NAME_ELEMENT(SW_RFKILL_ALL),
+	NAME_ELEMENT(SW_MICROPHONE_INSERT),
+	NAME_ELEMENT(SW_DOCK),
+	NAME_ELEMENT(SW_LINEOUT_INSERT),
+	NAME_ELEMENT(SW_JACK_PHYSICAL_INSERT),
 #ifdef SW_VIDEOOUT_INSERT
-	[SW_VIDEOOUT_INSERT] = "Video Out Insert",
+	NAME_ELEMENT(SW_VIDEOOUT_INSERT),
 #endif
 #ifdef SW_CAMERA_LENS_COVER
-	[SW_CAMERA_LENS_COVER] = "Camera Lens Cover",
-	[SW_KEYPAD_SLIDE] = "Keypad Slide",
-	[SW_FRONT_PROXIMITY] = "Front Proximity Sensor",
+	NAME_ELEMENT(SW_CAMERA_LENS_COVER),
+	NAME_ELEMENT(SW_KEYPAD_SLIDE),
+	NAME_ELEMENT(SW_FRONT_PROXIMITY),
 #endif
 #ifdef SW_ROTATE_LOCK
-	[SW_ROTATE_LOCK] = "Rotate Lock",
+	NAME_ELEMENT(SW_ROTATE_LOCK),
 #endif
 };
 
-char *force[FF_MAX + 1] = {
+static const char * const force[FF_MAX + 1] = {
 	[0 ... FF_MAX] = NULL,
-	[FF_RUMBLE] = "Rumble",		[FF_PERIODIC] = "Periodic",
-	[FF_CONSTANT] = "Constant",	[FF_SPRING] = "Spring",
-	[FF_FRICTION] = "Friction",	[FF_DAMPER] = "Damper",
-	[FF_INERTIA] = "Inertia",	[FF_RAMP] = "Ramp",
-	[FF_SQUARE] = "Square",		[FF_TRIANGLE] = "Triangle",
-	[FF_SINE] = "Sine",		[FF_SAW_UP] = "SawUp",
-	[FF_SAW_DOWN] = "SawDown",	[FF_CUSTOM] = "Custom",
-	[FF_GAIN] = "Gain",		[FF_AUTOCENTER] = "AutoCenter",
+	NAME_ELEMENT(FF_RUMBLE),		NAME_ELEMENT(FF_PERIODIC),
+	NAME_ELEMENT(FF_CONSTANT),		NAME_ELEMENT(FF_SPRING),
+	NAME_ELEMENT(FF_FRICTION),		NAME_ELEMENT(FF_DAMPER),
+	NAME_ELEMENT(FF_INERTIA),		NAME_ELEMENT(FF_RAMP),
+	NAME_ELEMENT(FF_SQUARE),		NAME_ELEMENT(FF_TRIANGLE),
+	NAME_ELEMENT(FF_SINE),			NAME_ELEMENT(FF_SAW_UP),
+	NAME_ELEMENT(FF_SAW_DOWN),		NAME_ELEMENT(FF_CUSTOM),
+	NAME_ELEMENT(FF_GAIN),			NAME_ELEMENT(FF_AUTOCENTER),
 };
 
-char *forcestatus[FF_STATUS_MAX + 1] = {
+static const char * const forcestatus[FF_STATUS_MAX + 1] = {
 	[0 ... FF_STATUS_MAX] = NULL,
-	[FF_STATUS_STOPPED] = "Stopped",	[FF_STATUS_PLAYING] = "Playing",
+	NAME_ELEMENT(FF_STATUS_STOPPED),	NAME_ELEMENT(FF_STATUS_PLAYING),
 };
 
-char **names[EV_MAX + 1] = {
+static const char * const * const names[EV_MAX + 1] = {
 	[0 ... EV_MAX] = NULL,
 	[EV_SYN] = events,			[EV_KEY] = keys,
 	[EV_REL] = relatives,			[EV_ABS] = absolutes,
-- 
1.7.6



More information about the xorg-devel mailing list