mirror of
https://github.com/marcriera/ddgo-pnp-controller.git
synced 2025-04-18 01:29:28 +02:00
Working evdev tester
This commit is contained in:
parent
c4cb41ac70
commit
c1f0aa2a89
2 changed files with 18 additions and 2 deletions
|
@ -6,3 +6,4 @@ edition = "2021"
|
||||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
|
evdev-rs = "0.6.1"
|
17
src/main.rs
17
src/main.rs
|
@ -1,3 +1,18 @@
|
||||||
|
use evdev_rs::Device;
|
||||||
|
use evdev_rs::ReadFlag;
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
println!("Hello, world!");
|
let d = Device::new_from_path("/dev/input/event4").unwrap();
|
||||||
|
|
||||||
|
loop {
|
||||||
|
let ev = d.next_event(ReadFlag::NORMAL).map(|val| val.1);
|
||||||
|
match ev {
|
||||||
|
Ok(ev) => println!("Event: time {}.{}, {} {}",
|
||||||
|
ev.time.tv_sec,
|
||||||
|
ev.time.tv_usec,
|
||||||
|
ev.event_type().map(|ev_type| format!("{}", ev_type)).unwrap_or("".to_owned()),
|
||||||
|
ev.value),
|
||||||
|
Err(_e) => (),
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
Loading…
Add table
Reference in a new issue