evdev-rs/examples/evtest_tokio.rs
Jeff Hiner 6c1add8b73
Add support for virtual uinput devices (#37)
* Prototype support for virtual uinput devices

* Tidy uinput a bit

* Have all the evtest examples use the same args/prompt code

* Switch to libc uinput* structs

* Use InputId in uinput, use libc _CNT constants

* Don't use align_to_mut

* Only check /dev/input/eventN files

* Spelling fixup

* Fix compilation error

* Ah, there we go. Much better.

Co-authored-by: Jeff Hiner <jeff-hiner@users.noreply.github.com>
Co-authored-by: Noah <33094578+coolreader18@users.noreply.github.com>
2021-03-19 09:19:51 -06:00

18 lines
453 B
Rust

//! Demonstrating how to monitor events with evdev + tokio
use tokio_1 as tokio;
// cli/"tui" shared between the evtest examples
mod _pick_device;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let d = _pick_device::pick_device();
println!("{}", d);
println!("Events:");
let mut events = d.into_event_stream()?;
loop {
let ev = events.next_event().await?;
println!("{:?}", ev);
}
}