'libevdev.Device.events' method returns bogus events when evdev device disappears.
evdev devices come and go... but this is not treated correctly in libevdev.Device.events method.
How to reproduce
-
Connect device (I'm testing with a bluetooth keyboard)
-
Device node is created
/dev/input/eventX
-
In a terminal launch this python program
import libevdev fd = open("/dev/input/eventX", "rb") ctx = libevdev.Device(fd) while True: for e in ctx.events(): print(e)
-
Disconnect device (I just turn bt keyboard off)
-
Device node
/dev/input/eventX
disappears. -
Your terminal will be flooded by bogus
InputEvent(EV_SYN, SYN_REPORT, 0)
events.
I can provide a MR.