#!python # -*- mode: python; Encoding: utf-8; coding: utf-8 -*- # Last updated: <2021/02/28 02:11:30 +0900> """ EV値が何を示しているかを表示 Windows10 x64 20H2 + Python 3.8.7 64bit """ # reference material # # Programming for a Touchscreen on the Raspberry Pi | ozzmaker.com # https://ozzmaker.com/programming-a-touchscreen-on-the-raspberry-pi/ # # linux/input.h at master - spotify/linux # https://github.com/spotify/linux/blob/master/include/linux/input.h # ( 0 0 0 0 0 0)H # (7654 .21. .... .... ..54 3210)B # |||| || || |||| # |||| || || |||+- EV_SYN # |||| || || ||+-- EV_KEY # |||| || || |+--- EV_REL # |||| || || +---- EV_ABS # |||| || |+------ EV_MSC # |||| || +------- EV_SW # |||| |+---------------------- EV_LED # |||| +----------------------- EV_SND # |||+-------------------------- EV_REP # ||+--------------------------- EV_FF # |+---------------------------- EV_PWR # +----------------------------- EV_FF_STATUS ev_list = { 0x00:"EV_SYN", 0x01:"EV_KEY", 0x02:"EV_REL", 0x03:"EV_ABS", 0x04:"EV_MSC", 0x05:"EV_SW", 0x11:"EV_LED", 0x12:"EV_SND", 0x14:"EV_REP", 0x15:"EV_FF", 0x16:"EV_PWR", 0x17:"EV_FF_STATUS", 0x1f:"EV_MAX" } def main(): allmask = 0 for k, v in ev_list.items(): allmask = allmask | (1 << k) print("Please input, hexadecimal or 'exit'") while True: s = input("EV=") if s == "" or s == "bye" or s == "quit" or s == "exit": break val = int(s, 16) result = " -> " for k, v in ev_list.items(): # print("0x%02x : %s" % (k, v)) mask = 1 << k if (val & mask) != 0: result = result + v + " " print(result) if (val & ~allmask) != 0: v = val & ~allmask print("Unknown : 0x%x" % v) print() if __name__ == '__main__': main()