kumquat-buildroot/support/testing/tests/package/sample_python_evdev.py
Witold Lipieta b100440bff package/python-evdev: new package
evdev 1.6.1 https://pypi.org/project/evdev/

Signed-off-by: Witold Lipieta <witold.lipieta@thaumatec.com>
[yann.morin.1998@free.fr:
  - add missing comment on kernel headers
  - fix flake8 in test
]
Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
2023-04-17 22:50:39 +02:00

12 lines
374 B
Python

import evdev
devices = [evdev.InputDevice(path) for path in evdev.list_devices()]
e = evdev.events.InputEvent(1036996631, 984417, evdev.ecodes.EV_KEY, evdev.ecodes.KEY_A, 2)
k = evdev.events.KeyEvent(e)
assert(k.keystate == evdev.events.KeyEvent.key_hold)
assert(k.event == e)
assert(k.scancode == evdev.ecodes.KEY_A)
assert(k.keycode == 'KEY_A')
assert(len(devices) > 0)