Skip to content

Commit c518bbf

Browse files
Handle unknown keys
Add to the `keys` dictionary when an unknown key is pressed.
1 parent 91710cd commit c518bbf

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

evdev/events.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,9 @@ def __init__(self, event):
9494
elif event.value == 1:
9595
self.keystate = KeyEvent.key_down
9696

97-
self.keycode = keys[event.code] # :todo:
97+
if not (event.code in keys):
98+
keys[event.code] = ''.join('{:02X}'.format(event.code))
99+
self.keycode = keys[event.code]
98100
self.scancode = event.code
99101

100102
#: Reference to an :class:`InputEvent` instance.

0 commit comments

Comments
 (0)