Skip to content

Commit

Permalink
Move syn() convenience method from InputDevice to EventIO (#224)
Browse files Browse the repository at this point in the history
Move `syn()` method from `UInput` to `EventIO`, makes it possible to use it with `InputDevice` as well
  • Loading branch information
Lawstorant authored Nov 12, 2024
1 parent 0d496bf commit 21dc595
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
9 changes: 9 additions & 0 deletions evdev/eventio.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
9 changes: 0 additions & 9 deletions evdev/uinput.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 <evdev.device.InputDevice.capabilities>`."""
if self.device is None:
Expand Down

0 comments on commit 21dc595

Please sign in to comment.