From 6448220c1146a08a80e8878aef5e17948660a580 Mon Sep 17 00:00:00 2001 From: Yifei Zhan Date: Mon, 6 May 2024 02:58:49 +0000 Subject: update evdev-rs to 0.6.1 --- src/deviceinfo.rs | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'src/deviceinfo.rs') diff --git a/src/deviceinfo.rs b/src/deviceinfo.rs index 7239294..353f105 100644 --- a/src/deviceinfo.rs +++ b/src/deviceinfo.rs @@ -1,5 +1,5 @@ -use anyhow::{anyhow, bail, Context, Result}; -use evdev_rs::Device; +use anyhow::{bail, Context, Result}; +use evdev_rs::{Device, DeviceWrapper}; use std::cmp::Ordering; use std::path::PathBuf; @@ -13,10 +13,8 @@ pub struct DeviceInfo { impl DeviceInfo { pub fn with_path(path: PathBuf) -> Result { let f = std::fs::File::open(&path).context(format!("opening {}", path.display()))?; - let mut input = Device::new().ok_or_else(|| anyhow!("failed to make new Device"))?; - input - .set_fd(f) - .context(format!("assigning fd for {} to Device", path.display()))?; + let input = Device::new_from_file(f) + .with_context(|| format!("failed to create new Device from file {}", path.display()))?; Ok(Self { name: input.name().unwrap_or("").to_string(), -- cgit v1.2.3