diff --git a/src/main.rs b/src/main.rs index 9f41793..2526390 100644 --- a/src/main.rs +++ b/src/main.rs @@ -11,6 +11,10 @@ fn main() -> () { let d = pick_device(); d }; + static ref OUTPUT_DEVICE: evdev::uinput::VirtualDevice = { + let d = create_device().unwrap(); + d + }; } 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> { + let mut keys = AttributeSet::::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 { key: evdev::Key, action: Box () + Send + 'static>,