allkeydata = {
    "input_prop_labels": {
        0: "INPUT_PROP_POINTER",
        1: "INPUT_PROP_DIRECT",
        2: "INPUT_PROP_BUTTONPAD",
        3: "INPUT_PROP_SEMI_MT",
    },
    "ev_labels": {
        0: "EV_SYN",
        1: "EV_KEY",
        2: "EV_REL",
        3: "EV_ABS",
        4: "EV_MSC",
        5: "EV_SW",
        6: "EV_LED",
        7: "EV_SND",
        8: "EV_REP",
        9: "EV_FF",
        10: "EV_PWR",
        11: "EV_FF_STATUS",
    },
    "syn_labels": {
        0: "SYN_REPORT",
        1: "SYN_CONFIG",
        2: "SYN_MT_REPORT",
        3: "SYN_DROPPED",
    },
    "key_labels": {
        0: "KEY_RESERVED",
        1: "KEY_ESC",
        2: "KEY_1",
        3: "KEY_2",
        4: "KEY_3",
        5: "KEY_4",
        6: "KEY_5",
        7: "KEY_6",
        8: "KEY_7",
        9: "KEY_8",
        10: "KEY_9",
        11: "KEY_0",
        12: "KEY_MINUS",
        13: "KEY_EQUAL",
        14: "KEY_BACKSPACE",
        15: "KEY_TAB",
        16: "KEY_Q",
        17: "KEY_W",
        18: "KEY_E",
        19: "KEY_R",
        20: "KEY_T",
        21: "KEY_Y",
        22: "KEY_U",
        23: "KEY_I",
        24: "KEY_O",
        25: "KEY_P",
        26: "KEY_LEFTBRACE",
        27: "KEY_RIGHTBRACE",
        28: "KEY_ENTER",
        29: "KEY_LEFTCTRL",
        30: "KEY_A",
        31: "KEY_S",
        32: "KEY_D",
        33: "KEY_F",
        34: "KEY_G",
        35: "KEY_H",
        36: "KEY_J",
        37: "KEY_K",
        38: "KEY_L",
        39: "KEY_SEMICOLON",
        40: "KEY_APOSTROPHE",
        41: "KEY_GRAVE",
        42: "KEY_LEFTSHIFT",
        43: "KEY_BACKSLASH",
        44: "KEY_Z",
        45: "KEY_X",
        46: "KEY_C",
        47: "KEY_V",
        48: "KEY_B",
        49: "KEY_N",
        50: "KEY_M",
        51: "KEY_COMMA",
        52: "KEY_DOT",
        53: "KEY_SLASH",
        54: "KEY_RIGHTSHIFT",
        55: "KEY_KPASTERISK",
        56: "KEY_LEFTALT",
        57: "KEY_SPACE",
        58: "KEY_CAPSLOCK",
        59: "KEY_F1",
        60: "KEY_F2",
        61: "KEY_F3",
        62: "KEY_F4",
        63: "KEY_F5",
        64: "KEY_F6",
        65: "KEY_F7",
        66: "KEY_F8",
        67: "KEY_F9",
        68: "KEY_F10",
        69: "KEY_NUMLOCK",
        70: "KEY_SCROLLLOCK",
        71: "KEY_KP7",
        72: "KEY_KP8",
        73: "KEY_KP9",
        74: "KEY_KPMINUS",
        75: "KEY_KP4",
        76: "KEY_KP5",
        77: "KEY_KP6",
        78: "KEY_KPPLUS",
        79: "KEY_KP1",
        80: "KEY_KP2",
        81: "KEY_KP3",
        82: "KEY_KP0",
        83: "KEY_KPDOT",
        84: "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",
        123: "KEY_HANJA",
        124: "KEY_YEN",
        125: "KEY_LEFTMETA",
        126: "KEY_RIGHTMETA",
        127: "KEY_COMPOSE",
        128: "KEY_STOP",
        129: "KEY_AGAIN",
        130: "KEY_PROPS",
        131: "KEY_UNDO",
        132: "KEY_FRONT",
        133: "KEY_COPY",
        134: "KEY_OPEN",
        135: "KEY_PASTE",
        136: "KEY_FIND",
        137: "KEY_CUT",
        138: "KEY_HELP",
        139: "KEY_MENU",
        140: "KEY_CALC",
        141: "KEY_SETUP",
        142: "KEY_SLEEP",
        143: "KEY_WAKEUP",
        144: "KEY_FILE",
        145: "KEY_SENDFILE",
        146: "KEY_DELETEFILE",
        147: "KEY_XFER",
        148: "KEY_PROG1",
        149: "KEY_PROG2",
        150: "KEY_WWW",
        151: "KEY_MSDOS",
        152: "KEY_COFFEE",
        153: "KEY_SCREENLOCK",
        154: "KEY_DIRECTION",
        155: "KEY_CYCLEWINDOWS",
        156: "KEY_MAIL",
        157: "KEY_BOOKMARKS",
        158: "KEY_COMPUTER",
        159: "KEY_BACK",
        160: "KEY_FORWARD",
        161: "KEY_CLOSECD",
        162: "KEY_EJECTCD",
        163: "KEY_EJECTCLOSECD",
        164: "KEY_NEXTSONG",
        165: "KEY_PLAYPAUSE",
        166: "KEY_PREVIOUSSONG",
        167: "KEY_STOPCD",
        168: "KEY_RECORD",
        169: "KEY_REWIND",
        170: "KEY_PHONE",
        171: "KEY_ISO",
        172: "KEY_CONFIG",
        173: "KEY_HOMEPAGE",
        174: "KEY_REFRESH",
        175: "KEY_EXIT",
        176: "KEY_MOVE",
        177: "KEY_EDIT",
        178: "KEY_SCROLLUP",
        179: "KEY_SCROLLDOWN",
        180: "KEY_KPLEFTPAREN",
        181: "KEY_KPRIGHTPAREN",
        182: "KEY_NEW",
        183: "KEY_REDO",
        184: "KEY_F13",
        185: "KEY_F14",
        186: "KEY_F15",
        187: "KEY_F16",
        188: "KEY_F17",
        189: "KEY_F18",
        190: "KEY_F19",
        191: "KEY_F20",
        192: "KEY_F21",
        193: "KEY_F22",
        194: "KEY_F23",
        195: "KEY_F24",
        196: "KEY_PLAYCD",
        197: "KEY_PAUSECD",
        198: "KEY_PROG3",
        199: "KEY_PROG4",
        200: "KEY_DASHBOARD",
        201: "KEY_SUSPEND",
        202: "KEY_CLOSE",
        203: "KEY_PLAY",
        204: "KEY_FASTFORWARD",
        205: "KEY_BASSBOOST",
        206: "KEY_PRINT",
        207: "KEY_HP",
        208: "KEY_CAMERA",
        209: "KEY_SOUND",
        210: "KEY_QUESTION",
        211: "KEY_EMAIL",
        212: "KEY_CHAT",
        213: "KEY_SEARCH",
        214: "KEY_CONNECT",
        215: "KEY_FINANCE",
        216: "KEY_SPORT",
        217: "KEY_SHOP",
        218: "KEY_ALTERASE",
        219: "KEY_CANCEL",
        220: "KEY_BRIGHTNESSDOWN",
        221: "KEY_BRIGHTNESSUP",
        222: "KEY_MEDIA",
        223: "KEY_SWITCHVIDEOMODE",
        224: "KEY_KBDILLUMTOGGLE",
        225: "KEY_KBDILLUMDOWN",
        226: "KEY_KBDILLUMUP",
        227: "KEY_SEND",
        228: "KEY_REPLY",
        229: "KEY_FORWARDMAIL",
        230: "KEY_SAVE",
        231: "KEY_DOCUMENTS",
        232: "KEY_BATTERY",
        233: "KEY_BLUETOOTH",
        234: "KEY_WLAN",
        235: "KEY_UWB",
        236: "KEY_UNKNOWN",
        237: "KEY_VIDEO_NEXT",
        238: "KEY_VIDEO_PREV",
        239: "KEY_BRIGHTNESS_CYCLE",
        240: "KEY_BRIGHTNESS_ZERO",
        241: "KEY_DISPLAY_OFF",
        242: "KEY_WIMAX",
        243: "KEY_RFKILL",
        244: "BTN_0",
        245: "BTN_1",
        246: "BTN_2",
        247: "BTN_3",
        248: "BTN_4",
        249: "BTN_5",
        250: "BTN_6",
        251: "BTN_7",
        252: "BTN_8",
        253: "BTN_9",
        254: "BTN_LEFT",
        255: "BTN_RIGHT",
        256: "BTN_MIDDLE",
        257: "BTN_SIDE",
        258: "BTN_EXTRA",
        259: "BTN_FORWARD",
        260: "BTN_BACK",
        261: "BTN_TASK",
        262: "BTN_JOYSTICK",
        263: "BTN_TRIGGER",
        264: "BTN_THUMB",
        265: "BTN_THUMB2",
        266: "BTN_TOP",
        267: "BTN_TOP2",
        268: "BTN_PINKIE",
        269: "BTN_BASE",
        270: "BTN_BASE2",
        271: "BTN_BASE3",
        272: "BTN_BASE4",
        273: "BTN_BASE5",
        274: "BTN_BASE6",
        275: "BTN_DEAD",
        276: "BTN_A",
        277: "BTN_B",
        278: "BTN_C",
        279: "BTN_X",
        280: "BTN_Y",
        281: "BTN_Z",
        282: "BTN_TL",
        283: "BTN_TR",
        284: "BTN_TL2",
        285: "BTN_TR2",
        286: "BTN_SELECT",
        287: "BTN_START",
        288: "BTN_MODE",
        289: "BTN_THUMBL",
        290: "BTN_THUMBR",
        291: "BTN_TOOL_PEN",
        292: "BTN_TOOL_RUBBER",
        293: "BTN_TOOL_BRUSH",
        294: "BTN_TOOL_PENCIL",
        295: "BTN_TOOL_AIRBRUSH",
        296: "BTN_TOOL_FINGER",
        297: "BTN_TOOL_MOUSE",
        298: "BTN_TOOL_LENS",
        299: "BTN_TOUCH",
        300: "BTN_STYLUS",
        301: "BTN_STYLUS2",
        302: "BTN_TOOL_DOUBLETAP",
        303: "BTN_TOOL_TRIPLETAP",
        304: "BTN_TOOL_QUADTAP",
        305: "BTN_GEAR_DOWN",
        306: "BTN_GEAR_UP",
        307: "KEY_OK",
        308: "KEY_SELECT",
        309: "KEY_GOTO",
        310: "KEY_CLEAR",
        311: "KEY_POWER2",
        312: "KEY_OPTION",
        313: "KEY_INFO",
        314: "KEY_TIME",
        315: "KEY_VENDOR",
        316: "KEY_ARCHIVE",
        317: "KEY_PROGRAM",
        318: "KEY_CHANNEL",
        319: "KEY_FAVORITES",
        320: "KEY_EPG",
        321: "KEY_PVR",
        322: "KEY_MHP",
        323: "KEY_LANGUAGE",
        324: "KEY_TITLE",
        325: "KEY_SUBTITLE",
        326: "KEY_ANGLE",
        327: "KEY_ZOOM",
        328: "KEY_MODE",
        329: "KEY_KEYBOARD",
        330: "KEY_SCREEN",
        331: "KEY_PC",
        332: "KEY_TV",
        333: "KEY_TV2",
        334: "KEY_VCR",
        335: "KEY_VCR2",
        336: "KEY_SAT",
        337: "KEY_SAT2",
        338: "KEY_CD",
        339: "KEY_TAPE",
        340: "KEY_RADIO",
        341: "KEY_TUNER",
        342: "KEY_PLAYER",
        343: "KEY_TEXT",
        344: "KEY_DVD",
        345: "KEY_AUX",
        346: "KEY_MP3",
        347: "KEY_AUDIO",
        348: "KEY_VIDEO",
        349: "KEY_DIRECTORY",
        350: "KEY_LIST",
        351: "KEY_MEMO",
        352: "KEY_CALENDAR",
        353: "KEY_RED",
        354: "KEY_GREEN",
        355: "KEY_YELLOW",
        356: "KEY_BLUE",
        357: "KEY_CHANNELUP",
        358: "KEY_CHANNELDOWN",
        359: "KEY_FIRST",
        360: "KEY_LAST",
        361: "KEY_AB",
        362: "KEY_NEXT",
        363: "KEY_RESTART",
        364: "KEY_SLOW",
        365: "KEY_SHUFFLE",
        366: "KEY_BREAK",
        367: "KEY_PREVIOUS",
        368: "KEY_DIGITS",
        369: "KEY_TEEN",
        370: "KEY_TWEN",
        371: "KEY_VIDEOPHONE",
        372: "KEY_GAMES",
        373: "KEY_ZOOMIN",
        374: "KEY_ZOOMOUT",
        375: "KEY_ZOOMRESET",
        376: "KEY_WORDPROCESSOR",
        377: "KEY_EDITOR",
        378: "KEY_SPREADSHEET",
        379: "KEY_GRAPHICSEDITOR",
        380: "KEY_PRESENTATION",
        381: "KEY_DATABASE",
        382: "KEY_NEWS",
        383: "KEY_VOICEMAIL",
        384: "KEY_ADDRESSBOOK",
        385: "KEY_MESSENGER",
        386: "KEY_DISPLAYTOGGLE",
        387: "KEY_SPELLCHECK",
        388: "KEY_LOGOFF",
        389: "KEY_DOLLAR",
        390: "KEY_EURO",
        391: "KEY_FRAMEBACK",
        392: "KEY_FRAMEFORWARD",
        393: "KEY_CONTEXT_MENU",
        394: "KEY_MEDIA_REPEAT",
        395: "KEY_10CHANNELSUP",
        396: "KEY_10CHANNELSDOWN",
        397: "KEY_IMAGES",
        398: "KEY_DEL_EOL",
        399: "KEY_DEL_EOS",
        400: "KEY_INS_LINE",
        401: "KEY_DEL_LINE",
        402: "KEY_FN",
        403: "KEY_FN_ESC",
        404: "KEY_FN_F1",
        405: "KEY_FN_F2",
        406: "KEY_FN_F3",
        407: "KEY_FN_F4",
        408: "KEY_FN_F5",
        409: "KEY_FN_F6",
        410: "KEY_FN_F7",
        411: "KEY_FN_F8",
        412: "KEY_FN_F9",
        413: "KEY_FN_F10",
        414: "KEY_FN_F11",
        415: "KEY_FN_F12",
        416: "KEY_FN_1",
        417: "KEY_FN_2",
        418: "KEY_FN_D",
        419: "KEY_FN_E",
        420: "KEY_FN_F",
        421: "KEY_FN_S",
        422: "KEY_FN_B",
        423: "KEY_BRL_DOT1",
        424: "KEY_BRL_DOT2",
        425: "KEY_BRL_DOT3",
        426: "KEY_BRL_DOT4",
        427: "KEY_BRL_DOT5",
        428: "KEY_BRL_DOT6",
        429: "KEY_BRL_DOT7",
        430: "KEY_BRL_DOT8",
        431: "KEY_BRL_DOT9",
        432: "KEY_BRL_DOT10",
        433: "KEY_NUMERIC_0",
        434: "KEY_NUMERIC_1",
        435: "KEY_NUMERIC_2",
        436: "KEY_NUMERIC_3",
        437: "KEY_NUMERIC_4",
        438: "KEY_NUMERIC_5",
        439: "KEY_NUMERIC_6",
        440: "KEY_NUMERIC_7",
        441: "KEY_NUMERIC_8",
        442: "KEY_NUMERIC_9",
        443: "KEY_NUMERIC_STAR",
        444: "KEY_NUMERIC_POUND",
        445: "KEY_CAMERA_FOCUS",
        446: "KEY_WPS_BUTTON",
        447: "KEY_TOUCHPAD_TOGGLE",
        448: "KEY_TOUCHPAD_ON",
        449: "KEY_TOUCHPAD_OFF",
        450: "KEY_CAMERA_ZOOMIN",
        451: "KEY_CAMERA_ZOOMOUT",
        452: "KEY_CAMERA_UP",
        453: "KEY_CAMERA_DOWN",
        454: "KEY_CAMERA_LEFT",
        455: "KEY_CAMERA_RIGHT",
        456: "BTN_TRIGGER_HAPPY1",
        457: "BTN_TRIGGER_HAPPY2",
        458: "BTN_TRIGGER_HAPPY3",
        459: "BTN_TRIGGER_HAPPY4",
        460: "BTN_TRIGGER_HAPPY5",
        461: "BTN_TRIGGER_HAPPY6",
        462: "BTN_TRIGGER_HAPPY7",
        463: "BTN_TRIGGER_HAPPY8",
        464: "BTN_TRIGGER_HAPPY9",
        465: "BTN_TRIGGER_HAPPY10",
        466: "BTN_TRIGGER_HAPPY11",
        467: "BTN_TRIGGER_HAPPY12",
        468: "BTN_TRIGGER_HAPPY13",
        469: "BTN_TRIGGER_HAPPY14",
        470: "BTN_TRIGGER_HAPPY15",
        471: "BTN_TRIGGER_HAPPY16",
        472: "BTN_TRIGGER_HAPPY17",
        473: "BTN_TRIGGER_HAPPY18",
        474: "BTN_TRIGGER_HAPPY19",
        475: "BTN_TRIGGER_HAPPY20",
        476: "BTN_TRIGGER_HAPPY21",
        477: "BTN_TRIGGER_HAPPY22",
        478: "BTN_TRIGGER_HAPPY23",
        479: "BTN_TRIGGER_HAPPY24",
        480: "BTN_TRIGGER_HAPPY25",
        481: "BTN_TRIGGER_HAPPY26",
        482: "BTN_TRIGGER_HAPPY27",
        483: "BTN_TRIGGER_HAPPY28",
        484: "BTN_TRIGGER_HAPPY29",
        485: "BTN_TRIGGER_HAPPY30",
        486: "BTN_TRIGGER_HAPPY31",
        487: "BTN_TRIGGER_HAPPY32",
        488: "BTN_TRIGGER_HAPPY33",
        489: "BTN_TRIGGER_HAPPY34",
        490: "BTN_TRIGGER_HAPPY35",
        491: "BTN_TRIGGER_HAPPY36",
        492: "BTN_TRIGGER_HAPPY37",
        493: "BTN_TRIGGER_HAPPY38",
        494: "BTN_TRIGGER_HAPPY39",
        495: "BTN_TRIGGER_HAPPY40",
    },
    "rel_labels": {
        0: "REL_X",
        1: "REL_Y",
        2: "REL_Z",
        3: "REL_RX",
        4: "REL_RY",
        5: "REL_RZ",
        6: "REL_HWHEEL",
        7: "REL_DIAL",
        8: "REL_WHEEL",
        9: "REL_MISC",
    },
    "abs_labels": {
        0: "ABS_X",
        1: "ABS_Y",
        2: "ABS_Z",
        3: "ABS_RX",
        4: "ABS_RY",
        5: "ABS_RZ",
        6: "ABS_THROTTLE",
        7: "ABS_RUDDER",
        8: "ABS_WHEEL",
        9: "ABS_GAS",
        10: "ABS_BRAKE",
        11: "ABS_HAT0X",
        12: "ABS_HAT0Y",
        13: "ABS_HAT1X",
        14: "ABS_HAT1Y",
        15: "ABS_HAT2X",
        16: "ABS_HAT2Y",
        17: "ABS_HAT3X",
        18: "ABS_HAT3Y",
        19: "ABS_PRESSURE",
        20: "ABS_DISTANCE",
        21: "ABS_TILT_X",
        22: "ABS_TILT_Y",
        23: "ABS_TOOL_WIDTH",
        24: "ABS_VOLUME",
        25: "ABS_MISC",
        26: "ABS_MT_SLOT",
        27: "ABS_MT_TOUCH_MAJOR",
        28: "ABS_MT_TOUCH_MINOR",
        29: "ABS_MT_WIDTH_MAJOR",
        30: "ABS_MT_WIDTH_MINOR",
        31: "ABS_MT_ORIENTATION",
        32: "ABS_MT_POSITION_X",
        33: "ABS_MT_POSITION_Y",
        34: "ABS_MT_TOOL_TYPE",
        35: "ABS_MT_BLOB_ID",
        36: "ABS_MT_TRACKING_ID",
        37: "ABS_MT_PRESSURE",
        38: "ABS_MT_DISTANCE",
    },
    "sw_labels": {
        0: "SW_LID",
        1: "SW_TABLET_MODE",
        2: "SW_HEADPHONE_INSERT",
        3: "SW_RFKILL_ALL",
        4: "SW_RADIO",
        5: "SW_MICROPHONE_INSERT",
        6: "SW_DOCK",
        7: "SW_LINEOUT_INSERT",
        8: "SW_JACK_PHYSICAL_INSERT",
        9: "SW_VIDEOOUT_INSERT",
        10: "SW_CAMERA_LENS_COVER",
        11: "SW_KEYPAD_SLIDE",
        12: "SW_FRONT_PROXIMITY",
        13: "SW_ROTATE_LOCK",
    },
    "msc_labels": {
        0: "MSC_SERIAL",
        1: "MSC_PULSELED",
        2: "MSC_GESTURE",
        3: "MSC_RAW",
        4: "MSC_SCAN",
    },
    "led_labels": {
        0: "LED_NUML",
        1: "LED_CAPSL",
        2: "LED_SCROLLL",
        3: "LED_COMPOSE",
        4: "LED_KANA",
        5: "LED_SLEEP",
        6: "LED_SUSPEND",
        7: "LED_MUTE",
        8: "LED_MISC",
        9: "LED_MAIL",
        10: "LED_CHARGING",
    },
    "rep_labels": {0: "REP_DELAY", 1: "REP_PERIOD"},
    "snd_labels": {0: "SND_CLICK", 1: "SND_BELL", 2: "SND_TONE"},
    "id_labels": {0: "ID_BUS", 1: "ID_VENDOR", 2: "ID_PRODUCT", 3: "ID_VERSION"},
    "bus_labels": {
        0: "BUS_PCI",
        1: "BUS_ISAPNP",
        2: "BUS_USB",
        3: "BUS_HIL",
        4: "BUS_BLUETOOTH",
        5: "BUS_VIRTUAL",
        6: "BUS_ISA",
        7: "BUS_I8042",
        8: "BUS_XTKBD",
        9: "BUS_RS232",
        10: "BUS_GAMEPORT",
        11: "BUS_PARPORT",
        12: "BUS_AMIGA",
        13: "BUS_ADB",
        14: "BUS_I2C",
        15: "BUS_HOST",
        16: "BUS_GSC",
        17: "BUS_ATARI",
        18: "BUS_SPI",
    },
    "mt_tool_labels": {0: "MT_TOOL_FINGER", 1: "MT_TOOL_PEN", 2: "MT_TOOL_MAX"},
    "ff_status_labels": {
        0: "FF_STATUS_STOPPED",
        1: "FF_STATUS_PLAYING",
        2: "FF_STATUS_MAX",
    },
    "ff_labels": {
        0: "FF_RUMBLE",
        1: "FF_PERIODIC",
        2: "FF_CONSTANT",
        3: "FF_SPRING",
        4: "FF_FRICTION",
        5: "FF_DAMPER",
        6: "FF_INERTIA",
        7: "FF_RAMP",
        8: "FF_SQUARE",
        9: "FF_TRIANGLE",
        10: "FF_SINE",
        11: "FF_SAW_UP",
        12: "FF_SAW_DOWN",
        13: "FF_CUSTOM",
        14: "FF_GAIN",
        15: "FF_AUTOCENTER",
    },
}

key_value_labels = {
    0: "UP",
    1: "DOWN",
    2: "REPEAT",
}


def get_label(labels_dict, key):
    return labels_dict.get(key, "Unknown")


eventkey = 4
EV_SYN = 0
EV_KEY = 1
EV_REL = 2
EV_ABS = 3
EV_MSC = 4
EV_SW = 5
EV_LED = 6
EV_SND = 7
EV_REP = 8
EV_FF = 9
EV_PWR = 10
EV_FF_STATUS = 11
ABS_MT_TOOL_TYPE = 34
syn_labels = allkeydata["syn_labels"]
key_labels = allkeydata["key_labels"]
rel_labels = allkeydata["rel_labels"]
abs_labels = allkeydata["abs_labels"]
msc_labels = allkeydata["msc_labels"]
led_labels = allkeydata["led_labels"]
snd_labels = allkeydata["snd_labels"]
sw_labels = allkeydata["sw_labels"]
rep_labels = allkeydata["rep_labels"]
ff_labels = allkeydata["ff_labels"]
ff_status_labels = allkeydata["ff_status_labels"]
mt_tool_labels = allkeydata["mt_tool_labels"]


def get_event_labels(eventtype, code, value=None):
    code_label = "Unknown"
    value_label = "Unknown"

    if eventtype == EV_SYN:
        code_label = get_label(syn_labels, code)
    elif eventtype == EV_KEY:
        code_label = get_label(key_labels, code)
        value_label = get_label(key_value_labels, value)
    elif eventtype == EV_REL:
        code_label = get_label(rel_labels, code)
    elif eventtype == EV_ABS:
        code_label = get_label(abs_labels, code)
        if code == ABS_MT_TOOL_TYPE:
            value_label = get_label(mt_tool_labels, value)
    elif eventtype == EV_MSC:
        code_label = get_label(msc_labels, code)
    elif eventtype == EV_LED:
        code_label = get_label(led_labels, code)
    elif eventtype == EV_SND:
        code_label = get_label(snd_labels, code)
    elif eventtype == EV_SW:
        code_label = get_label(sw_labels, code)
    elif eventtype == EV_REP:
        code_label = get_label(rep_labels, code)
    elif eventtype == EV_FF:
        code_label = get_label(ff_labels, code)
    elif eventtype == EV_FF_STATUS:
        code_label = get_label(ff_status_labels, code)

    return code_label, value_label

