|
|
|
@ -11,6 +11,10 @@ fn main() -> () {
|
|
|
|
let d = pick_device();
|
|
|
|
let d = pick_device();
|
|
|
|
d
|
|
|
|
d
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
static ref OUTPUT_DEVICE: evdev::uinput::VirtualDevice = {
|
|
|
|
|
|
|
|
let d = create_device().unwrap();
|
|
|
|
|
|
|
|
d
|
|
|
|
|
|
|
|
};
|
|
|
|
}
|
|
|
|
}
|
|
|
|
println!("{}", INPUT_DEVICE.name().unwrap_or("Unknown device"));
|
|
|
|
println!("{}", INPUT_DEVICE.name().unwrap_or("Unknown device"));
|
|
|
|
|
|
|
|
|
|
|
|
@ -54,6 +58,20 @@ fn pick_device() -> evdev::Device {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
use evdev::{uinput::VirtualDeviceBuilder, AttributeSet, Key};
|
|
|
|
|
|
|
|
fn create_device() -> Result<evdev::uinput::VirtualDevice, Box<dyn std::error::Error>> {
|
|
|
|
|
|
|
|
let mut keys = AttributeSet::<Key>::new();
|
|
|
|
|
|
|
|
keys.insert(Key::KEY_F);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let device = VirtualDeviceBuilder::new()?
|
|
|
|
|
|
|
|
.name("DPK Wired Gaming Keyboard Combo")
|
|
|
|
|
|
|
|
.with_keys(&keys)?
|
|
|
|
|
|
|
|
.build()
|
|
|
|
|
|
|
|
.unwrap();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Ok(device)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
pub struct Pedal {
|
|
|
|
pub struct Pedal {
|
|
|
|
key: evdev::Key,
|
|
|
|
key: evdev::Key,
|
|
|
|
action: Box<dyn Fn() -> () + Send + 'static>,
|
|
|
|
action: Box<dyn Fn() -> () + Send + 'static>,
|
|
|
|
|