Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
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] == "":
value = goodline[i].rsplit()[0]
# 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
You can’t perform that action at this time.