mirror of
https://github.com/k0kubun/xremap
synced 2024-11-02 03:40:25 +00:00
cargo fmt
This commit is contained in:
parent
4b33dee052
commit
1ed2fd9029
@ -5,5 +5,5 @@ use evdev::Device;
|
||||
pub fn select_device() -> Device {
|
||||
// TODO: stop hard-coding the device
|
||||
let device = Device::open("/dev/input/event2");
|
||||
return device.unwrap()
|
||||
return device.unwrap();
|
||||
}
|
||||
|
@ -1,14 +1,16 @@
|
||||
use std::error::Error;
|
||||
use evdev::{Device, EventType};
|
||||
use std::error::Error;
|
||||
|
||||
mod input;
|
||||
mod select;
|
||||
mod output;
|
||||
mod select;
|
||||
|
||||
fn event_loop(input_device: &mut Device) -> Result<(), Box<dyn Error>> {
|
||||
let mut output_device = output::build_device(input_device).unwrap();
|
||||
for _ in 0..5 {
|
||||
if !select::is_readable(input_device) { continue }
|
||||
if !select::is_readable(input_device) {
|
||||
continue;
|
||||
}
|
||||
|
||||
for event in input_device.fetch_events().unwrap() {
|
||||
println!("event: {:?}", event);
|
||||
|
@ -1,6 +1,6 @@
|
||||
use std::error::Error;
|
||||
use evdev::{AttributeSet, Device, RelativeAxisType};
|
||||
use evdev::uinput::{VirtualDevice, VirtualDeviceBuilder};
|
||||
use evdev::{AttributeSet, Device, RelativeAxisType};
|
||||
use std::error::Error;
|
||||
|
||||
pub fn build_device(base_device: &Device) -> Result<VirtualDevice, Box<dyn Error>> {
|
||||
let mut rel_axes = AttributeSet::<RelativeAxisType>::new();
|
||||
|
@ -1,8 +1,8 @@
|
||||
extern crate evdev;
|
||||
|
||||
use evdev::Device;
|
||||
use std::os::unix::io::{AsRawFd, RawFd};
|
||||
use std::{io, mem, ptr};
|
||||
use evdev::Device;
|
||||
|
||||
// A call of this function blocks until the argument device becomes readable.
|
||||
// TODO: support selecting multiple devices
|
||||
@ -21,8 +21,9 @@ pub fn is_readable(device: &mut Device) -> bool {
|
||||
} {
|
||||
-1 => Err(io::Error::last_os_error()),
|
||||
res => Ok(res as usize),
|
||||
}.unwrap();
|
||||
return result == 1 && fd_set.is_set(device.as_raw_fd())
|
||||
}
|
||||
.unwrap();
|
||||
return result == 1 && fd_set.is_set(device.as_raw_fd());
|
||||
}
|
||||
|
||||
fn to_fdset_ptr(opt: Option<&mut FdSet>) -> *mut libc::fd_set {
|
||||
|
Loading…
Reference in New Issue
Block a user