Python script to parse https://gist.github.com/MightyPork/6da26e382a7ad91b5496ee55fdc73db2
file = open("usb_hid_keys.h", "r") | |
for line in file: | |
goodline = line[8:].split(" ") | |
if line.startswith("#define ") and len(goodline)>1: | |
key = goodline[0] | |
value = "" | |
for i in range(1, len(goodline)): | |
if goodline[i] == "": | |
continue | |
else: | |
value = goodline[i].rsplit()[0] | |
break | |
# do whatever you wanna do with the scancode name, and its hex value | |
print("\"{}\": \"{}\",".format(key, value)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment