less spam in case of missing read rights on devices

xkb
sezanzeb 4 years ago committed by sezanzeb
parent e701fd3919
commit f1e069cbaa

@ -47,6 +47,7 @@ class _KeycodeReader:
self.virtual_devices = []
self._pipe = None
self._process = None
self.fail_counter = 0
def __del__(self):
self.stop_reading()
@ -149,7 +150,10 @@ class _KeycodeReader:
def read(self):
"""Get the newest tuple of event type, keycode or None."""
if self._pipe is None:
logger.debug('No pipe available to read from')
self.fail_counter += 1
if self.fail_counter % 10 == 0:
# spam less
logger.debug('No pipe available to read from')
return None, None
newest_event = (None, None)

Loading…
Cancel
Save