rip-synergy/src/hw_device.rs
2018-11-11 02:39:32 +02:00

23 lines
412 B
Rust

extern crate evdev_rs;
use std::fs::File;
pub struct HwDevice {
pub device: evdev_rs::Device,
_file: File,
}
impl HwDevice {
pub fn new(path: &str) -> Self {
let f = File::open(path).unwrap();
let mut d = evdev_rs::Device::new().unwrap();
d.set_fd(&f).unwrap();
HwDevice {
device: d,
// keep fd open
_file: f,
}
}
}