Changelogs » Evdev




- Fix build on 32bit arches with 64bit time_t

- Add functionality to query device properties. See ``InputDevice.input_props``
and the ``input_props`` argument to ``Uinput``.

- ``KeyEvent`` received an ``allow_unknown`` constructor argument, which
determines what will happen when an event code cannot be mapped to a keycode.
The default and behavior so far has been to raise ``KeyError``. If set to
``True``, the keycode will be set to the event code formatted as a hex number.

- Add ``InputDevice.set_absinfo()`` and ``InputDevice.absinfo()``.

- Instruct the asyncio event loop to stop monitoring the fd of the input device
when the device is closed.



- Add UInput support for the resolution parameter in AbsInfo. This brings
support for the new method of uinput device setup, which was `introduced in
Linux 4.5`_ (thanks to `LinusCDE`_).

- Vendor and product identifiers can be greater or equal to `0x8000` (thanks



- Fix installation on kernels <= 4.4.

- Fix uinput creation ignoring absinfo settings.



- Add support for handling force-feedback effect uploads (many thanks to `ndreys`_).

- Fix typo preventing ff effects that need left coefficients from working.



- Prevent ``Uinput`` device creation raising ``Objects/longobject.c:415: bad
argument to internal function`` when a non-complete ``AbsInfo`` structure is
passed. All missing ``AbsInfo`` fields are set to 0.

- Fix ``Uinput`` device creation raising ``KeyError`` when a capability filtered
by default is not present.

- The ``InputDevice.fn`` attribute was deprecated in favor of ``InputDevice.path``.
Using the former will show a ``DeprecationWarning``, but would otherwise continue
working as before.

- Fix ``InputDevice`` comparison raising ``AttributeError`` due to a non-existant
``path`` attribute.

- Fix asyncio support in Python 3.5+.

- Uploading FF effect now works both on Python 2.7 and Python 3+.

- Remove the ``asyncore`` example from the tutorial.



- Fix Python 2 compatibility issue in with ``Uinput.from_device``.

- Fix minor `evdev.evtest` formatting issue.



- Fix ``InputDevice`` comparison on Python 2.

- The device path is now considered when comparing two devices.

- Fix ``UInput.from_device`` not correctly merging the capabilities of
selected devices.

- The list of excluded event types in ``UInput.from_device`` is now
configurable. For example::

UInput.from_device(dev, filtered_types=(EV_SYN, EV_FF))

In addition, ``ecodes.EV_FF`` is now excluded by default.

- Add a context manager for grabbing access to a device -
``InputDevice.grab_context``. For example::

with dev.grab_context():

- Add the ``InputDevice.uniq`` attribute, which contains the unique identifier
of the device. As with ``phys``, this attribute may be empty (i.e. `''`).



- ``InputDevice`` now accepts objects that support the path protocol.
For example::

pth = pathlib.Path('/dev/input/event0')
dev = evdev.InputDevice(pth)

- Support path protocol in ``InputDevice``. This means that ``InputDevice``
instances can be passed to callers that expect a ``os.PathLike`` object.

- Exceptions raised during ``InputDevice.async_read()`` (and similar) are now
handled properly (i.e. an exception is set on the returned future instead of
leaking that exception into the event loop) (Fixes `67`_).



- Exclude ``ecodes.c`` from source distribution (Fixes `63`_).



- Add the ``UInput.from_device`` class method, which allows uinput device to be
created with the capabiltiies of one or more existing input devices::

ui = UInput.from_device('/dev/input1', '/dev/input2', **constructor_kwargs)

- Add the ``build_ecodes`` distutils command, which generates the ``ecodes.c``
extension module. The new way of overwriting the evdev header locations is::

python build \
build_ecodes --evdev-headers path/input.h:path/input-event-codes.h \
build_ext --include-dirs  path/ \

The ``build*`` and ``install`` commands no longer have to be part of the same
command-line (i.e. running ``install`` will reuse the outputs of the last



- Disable tty echoing while evtest is running.
- Allow evtest to listen to more than one devices.

- The script now allows the location of the input header files to be
overwritten. For example::

python build_ext \
--evdev-headers path/input.h:path/input-event-codes.h \
--include-dirs  path/ \



- Asyncio and async/await support (many thanks to `paulo-raca`_).
- Add the ability to set the `phys` property of uinput devices (thanks `paulo-raca`_).
- Add a generic :func:`InputDevice.set` method (thanks `paulo-raca`_).
- Distribute the evtest script along with evdev.
- Fix issue with generating :mod:`ecodes.c` in recent kernels (``>= 4.4.0``).
- Fix absinfo item indexes in :func:`UInput.uinput_create()` (thanks `forsenonlhaimaisentito`_).
- More robust comparison of :class:`InputDevice` objects (thanks `isia`_).



- Write access to the input device is no longer mandatory. Evdev will
first try to open the device for reading and writing and fallback to
read-only. Methods that require write access (e.g. :func:`set_led()`)
will raise :class:`EvdevError` if the device is open only for reading.



- Fallback to distutils if setuptools is not available.



- Rework documentation and docstrings once more.

- Fix install on Python 3.4 (works around issue21121_).

- Fix :func:`ioctl()` requested buffer size (thanks Jakub Wojciech Klama).



- Add method for returning a list of the currently active keys -
:func:`InputDevice.active_keys()` (thanks `spasche`_).

- Fix a potential buffer overflow in :func:`ioctl_capabilities()` (thanks `spasche`_).



- Calling :func:`InputDevice.read_one()` should always return ``None``,
when there is nothing to be read, even in case of a ``EAGAIN`` errno
(thanks JPP).



- Silence :class:`OSError` in destructor (thanks `polyphemus`_).

- Make :func:`InputDevice.close()` work in cases in which stdin (fd 0)
has been closed (thanks `polyphemus`_).



- Rework documentation and docstrings.

- Call :func:`InputDevice.close()` from :func:`InputDevice.__del__()`.



- Fix reference counting in :func:`InputDevice.device_read()`,
:func:`InputDevice.device_read_many()` and :func:`ioctl_capabilities`.



- Add ``FF_*`` and ``FF_STATUS`` codes to :func:`ecodes` (thanks `bgilbert`_).

- Reverse event code mappings (``ecodes.{KEY,FF,REL,ABS}`` and etc.)
will now map to a list of codes, whenever a value corresponds to
multiple codes::

>>> ecodes.KEY[152]
>>> ecodes.KEY[30]
... 'KEY_A'

- Set the state of a LED through :func:`InputDevice.set_led()` (thanks

- Open :attr:`InputDevice.fd` in ``O_RDWR`` mode from now on.

- Fix segfault in :func:`InputDevice.device_read_many()` (thanks `bgilbert`_).



- Raise :class:`IOError` from :func:`InputDevice.device_read()` and
:func:`InputDevice.device_read_many()` when :func:``

- Several stability and style changes (thank you debian code reviewers).



- Fix vendor id and product id order in :func:`DeviceInfo` (thanks `kived`_).



- :func:`` will return an empty tuple if the device
has nothing to offer (instead of segfaulting).

- Exclude unnecessary package data in sdist and bdist.



- Add ability to set/get auto-repeat settings with ``EVIOC{SG}REP``.

- Add :func:`InputDevice.version` - the value of ``EVIOCGVERSION``.

- Add :func:`InputDevice.read_loop()`.

- Add :func:`InputDevice.grab()` and :func:`InputDevice.ungrab()` -
exposes ``EVIOCGRAB``.

- Add :func:`InputDevice.leds` - exposes ``EVIOCGLED``.

- Replace :class:`DeviceInfo` class with a namedtuple.

- Prevent :func:`InputDevice.read_one()` from skipping events.

- Rename :class:`AbsData` to :class:`AbsInfo` (as in ``struct input_absinfo``).



- Add the ability to set arbitrary device capabilities on uinput
devices (defaults to all ``EV_KEY`` ecodes).

- Add :attr:`UInput.device` which is an open :class:`InputDevice` to
the input device that uinput 'spawns'.

- Add :func:`UInput.capabilities()` which is just a shortcut to

- Rename :func:`UInput.write()` to :func:`UInput.write_event()`.

- Add a simpler :func:`UInput.write(type, code, value)` method.

- Make all :func:`UInput` constructor arguments optional (default
device name is now ``py-evdev-uinput``).

- Add the ability to set ``absmin``, ``absmax``, ``absfuzz`` and
``absflat`` when specifying the uinput device's capabilities.

- Remove the ``nophys`` argument - if a device fails the
``EVIOCGPHYS`` ioctl, phys will equal the empty string.

- Make :func:`InputDevice.capabilities()` perform a ``EVIOCGABS``
ioctl for devices that support ``EV_ABS`` and return that info
wrapped in an ``AbsData`` namedtuple.

- Split ``ioctl_devinfo`` into ``ioctl_devinfo`` and

- Split :func:`UInput.uinput_open()` to :func:`UInput.uinput_open()`
and :func:`UInput.uinput_create()`

- Add more uinput usage examples and documentation.

- Rewrite uinput tests.

- Remove ``mouserel`` and ``mouseabs`` from :class:`UInput`.

- Tie the sphinx version and release to the distutils version.

- Set 'methods-before-attributes' sorting in the docs.

- Remove ``KEY_CNT`` and ``KEY_MAX`` from :func:`ecodes.keys`.



- Add ``events.keys``, which is a combination of all ``BTN_`` and
``KEY_`` event codes.

- ``ecodes.c`` was not generated when installing through ``pip``.



*Initial Release*

.. _`polyphemus`:
.. _`bgilbert`:
.. _`accek`:
.. _`kived`:
.. _`spasche`:
.. _`isia`:
.. _`forsenonlhaimaisentito`:
.. _`paulo-raca`:
.. _`ndreys`:
.. _`LinusCDE`:
.. _`ivaradi`:

.. _`introduced in Linux 4.5`:
.. _issue21121:
.. _`63`:
.. _`67`: