|
|
|
|
@ -40,7 +40,7 @@ fn main() -> () {
|
|
|
|
|
}
|
|
|
|
|
println!("{}", INPUT_DEVICE.name().unwrap_or("Unknown device"));
|
|
|
|
|
|
|
|
|
|
let mut drum_pedal: evdev::uinput::VirtualDevice = create_device().unwrap();
|
|
|
|
|
let mut drum_pedal: evdev::uinput::VirtualDevice = create_device(pedals::buttons()).unwrap();
|
|
|
|
|
|
|
|
|
|
run(
|
|
|
|
|
&INPUT_DEVICE,
|
|
|
|
|
@ -104,16 +104,14 @@ fn pick_device() -> evdev::Device {
|
|
|
|
|
use evdev::{uinput::VirtualDeviceBuilder, AttributeSet, Key};
|
|
|
|
|
/// Create new uinput device to send generated events into
|
|
|
|
|
/// Enables explicitly allowed here key press events to be generated
|
|
|
|
|
fn create_device() -> Result<evdev::uinput::VirtualDevice, Box<dyn std::error::Error>> {
|
|
|
|
|
fn create_device(
|
|
|
|
|
buttons: Vec<evdev::Key>,
|
|
|
|
|
) -> Result<evdev::uinput::VirtualDevice, Box<dyn std::error::Error>> {
|
|
|
|
|
let mut keys = AttributeSet::<Key>::new();
|
|
|
|
|
// Addtional buttons go here in `keys.insert(evdev::Key)` format
|
|
|
|
|
keys.insert(Key::KEY_F);
|
|
|
|
|
keys.insert(Key::KEY_SPACE);
|
|
|
|
|
keys.insert(Key::BTN_LEFT);
|
|
|
|
|
keys.insert(Key::KEY_T);
|
|
|
|
|
keys.insert(Key::KEY_Y);
|
|
|
|
|
keys.insert(Key::KEY_R);
|
|
|
|
|
keys.insert(Key::KEY_W);
|
|
|
|
|
for button in buttons {
|
|
|
|
|
keys.insert(button);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
let device = VirtualDeviceBuilder::new()?
|
|
|
|
|
.name("DPK Wired Gaming Keyboard Combo")
|
|
|
|
|
|