#evdev #bindings #libevdev #wrapper #level #high #evdev-rs

sys evdev-sys

Raw bindings to libevdev High level Rust bindings are available in the evdev crate

8 releases

0.2.5 Jul 24, 2022
0.2.4 Dec 5, 2021
0.2.3 Jun 15, 2021
0.2.2 Apr 4, 2021
0.0.1 Sep 2, 2017

#1083 in Hardware support

Download history 683/week @ 2023-12-11 478/week @ 2023-12-18 337/week @ 2023-12-25 377/week @ 2024-01-01 454/week @ 2024-01-08 744/week @ 2024-01-15 591/week @ 2024-01-22 655/week @ 2024-01-29 805/week @ 2024-02-05 684/week @ 2024-02-12 721/week @ 2024-02-19 861/week @ 2024-02-26 750/week @ 2024-03-04 743/week @ 2024-03-11 860/week @ 2024-03-18 526/week @ 2024-03-25

2,950 downloads per month
Used in 14 crates (2 directly)

MIT/Apache

325KB
9K SLoC

C 8K SLoC // 0.0% comments Rust 353 SLoC // 0.0% comments Python 275 SLoC // 0.1% comments Automake 196 SLoC // 0.0% comments M4 192 SLoC // 0.2% comments Shell 108 SLoC // 0.2% comments JavaScript 65 SLoC // 0.3% comments

Contains (obscure autoconf code, 5KB) libevdev/configure.ac

evdev-rs

Build Status Latest Version Documentation

A Rust wrapper for libevdev

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

to enable serialization support, enable the feature "serde"

# Cargo.toml
[dependencies]
evdev-rs = { version = "0.6.1", 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