#devices #ioctl #caller #bindings #moves #common-tasks #libevdev #erroneous

evdev-rs

Bindings to libevdev for interacting with evdev devices. It moves the common tasks when dealing with evdev devices into a library and provides a library interface to the callers, thus avoiding erroneous ioctls, etc.

10 releases (6 breaking)

0.6.3 Sep 14, 2025
0.6.2 Jun 29, 2025
0.6.1 Oct 22, 2022
0.6.0 Jul 24, 2022
0.0.1 Sep 2, 2017

#56 in Hardware support

Download history 1662/week @ 2025-08-27 1507/week @ 2025-09-03 1861/week @ 2025-09-10 1558/week @ 2025-09-17 1552/week @ 2025-09-24 1387/week @ 2025-10-01 1089/week @ 2025-10-08 1966/week @ 2025-10-15 1804/week @ 2025-10-22 1616/week @ 2025-10-29 1758/week @ 2025-11-05 2102/week @ 2025-11-12 1890/week @ 2025-11-19 1481/week @ 2025-11-26 1817/week @ 2025-12-03 1349/week @ 2025-12-10

6,822 downloads per month
Used in 22 crates (16 directly)

MIT/Apache

505KB
13K SLoC

C 8K SLoC // 0.0% comments Rust 4.5K SLoC // 0.0% comments Python 408 SLoC // 0.0% comments M4 191 SLoC // 0.2% comments Shell 186 SLoC // 0.1% comments Automake 186 SLoC JavaScript 64 SLoC // 0.3% comments

evdev-rs

Build Status Latest Version Documentation

A Rust wrapper for libevdev

# Cargo.toml
[dependencies]
evdev-rs = "0.6.3"

to enable serialization support, enable the feature "serde"

# Cargo.toml
[dependencies]
evdev-rs = { version = "0.6.3", features = ["serde"] }

With a newer libevdev version (>= 1.10) enable the feature libevdev-1-10 to allow disabling a property. It also extends the Enable trait to InputProp, enabling the use of enable(), disable() and has() for InputProp as well.

Why a libevdev wrapper?

The evdev protocol is simple, but quirky, with a couple of behaviors that are non-obvious. libevdev transparently handles some of those quirks.

The evdev crate is an implementation of libevdev in Rust which provides most of the same features.

evdev-rs crate closely follows libevdev and hence enjoys all the complex handling that libevdev does. Some of the things that libevdev handles transparently, which may or may not be in evdev crate:

  • handling of fake multitouch devices
  • synching of slots and per-slot state
  • transparent generation of missing tracking ids after SYN_DROPPED
  • various boundary checks with defined error codes if you request invalid data (e.g. event codes that don't exist on the device)
  • fd swapping on the same context
  • disabling/enabling events on a per-context basis, so you can disable/enable ABS_FOO and then not care about quirks in the client-side code.

Development

src/enums.rs can be generated by running ./tools/make-enums.sh.

Dependencies

~110–640KB
~13K SLoC