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