File: python-evdev.rst

package info (click to toggle)
python-libevdev 0.13.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 420 kB
  • sloc: python: 2,739; makefile: 14
file content (29 lines) | stat: -rw-r--r-- 1,464 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
Difference between python-libevdev and python-evdev
===================================================

python-evdev is an existing package that provides python access to the evdev
protocol. Its documentation is found here: https://python-evdev.readthedocs.io/en/latest/

They both wrap the same kernel protocol, so there is a large overlap
between the two projects.

The biggest difference and motivation for python-libevdev was that it wraps
libevdev rather than just using the kernel directly. This provides a number
of advantages, see **Why libevdev?** on the :doc:`index page <index>` for details.

From an API perspective, python-libevdev and python-evdev have two slightly
different approaches. For example,

* python-evdev opens the device directly and provides multiple ways of
  reading events from that device (using
  ``asyncore``, ``select``, ``selectors``, ``asyncio``, etc.).
  python-libevdev requires that the caller opens the file descriptor and
  monitors it, it merely pulls the events off when requested to do so.
* python-libevdev requires the conversion into `EventCode` and
  `EventType` early on, the rest of the API only deals with those.
  python-evdev largely sticks to integers instead (e.g. `dev.leds()` returns
  an integer array). This makes python-evdev less type-safe than
  python-libevdev.

There are other differences as well, but, unsurprisingly, we think that
python-libevdev is the better API and the safer choice. YMMV :)