From 21dc595f32c88f02cb47015546d4c3af0d725d38 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20Paku=C5=82a?= Date: Tue, 12 Nov 2024 16:33:29 +0100 Subject: [PATCH] Move `syn()` convenience method from `InputDevice` to `EventIO` (#224) Move `syn()` method from `UInput` to `EventIO`, makes it possible to use it with `InputDevice` as well --- evdev/eventio.py | 9 +++++++++ evdev/uinput.py | 9 --------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/evdev/eventio.py b/evdev/eventio.py index 1b0e5cc..415e2e8 100644 --- a/evdev/eventio.py +++ b/evdev/eventio.py @@ -136,5 +136,14 @@ def write(self, etype, code, value): _uinput.write(self.fd, etype, code, value) + def syn(self): + """ + Inject a ``SYN_REPORT`` event into the input subsystem. Events + queued by :func:`write()` will be fired. If possible, events + will be merged into an 'atomic' event. + """ + + self.write(ecodes.EV_SYN, ecodes.SYN_REPORT, 0) + def close(self): pass diff --git a/evdev/uinput.py b/evdev/uinput.py index 476a84a..c4225d8 100644 --- a/evdev/uinput.py +++ b/evdev/uinput.py @@ -227,15 +227,6 @@ def close(self): _uinput.close(self.fd) self.fd = -1 - def syn(self): - """ - Inject a ``SYN_REPORT`` event into the input subsystem. Events - queued by :func:`write()` will be fired. If possible, events - will be merged into an 'atomic' event. - """ - - _uinput.write(self.fd, ecodes.EV_SYN, ecodes.SYN_REPORT, 0) - def capabilities(self, verbose=False, absinfo=True): """See :func:`capabilities `.""" if self.device is None: