I use python-evdev library for detect keyboard event.
But I have a problem, I need flush the keyboard event after I have detect key.
example:
from evdev import InputDevice, categorize, ecodes
dev = InputDevice('/dev/input/event1')
for event in dev.read_loop():
if event.type == ecodes.EV_KEY:
print(categorize(event))
#to do..............
>>>flush here> KEYBOARD EVENT>>
how fflush dev ?
After doing your stuff with your event, use device.read_one() to read all the ones in the queue (read_one() returns None if the queue is empty).