Formated documents

This commit is contained in:
2026-05-15 16:32:19 +02:00
parent b97976bc09
commit 27643c727c
2 changed files with 7 additions and 17 deletions

View File

@@ -36,7 +36,6 @@ fn enumerate_keyboards() -> Vec<PathBuf> {
}
async fn find_target_keyboard(device_paths: &Vec<PathBuf>) -> Option<Device> {
let (tx, mut rx): (Sender<PathBuf>, Receiver<PathBuf>) = channel(1);
let mut handles = vec![];
@@ -62,8 +61,6 @@ async fn find_target_keyboard(device_paths: &Vec<PathBuf>) -> Option<Device>{
#[tokio::main(flavor = "local")]
async fn main() {
let devices_paths = enumerate_keyboards();
println!("Found the following devices");
@@ -73,13 +70,10 @@ async fn main() {
}
}
let Some(kb) = find_target_keyboard(&devices_paths).await else {
return;
};
let Ok(mut kb) = kb.into_event_stream() else {
return;
};
@@ -97,9 +91,8 @@ async fn main() {
match kb.device_mut().ungrab() {
Err(err) => println!("Failed to release device: {err}"),
_ => ()
_ => (),
};
println!("Device released");
}

View File

@@ -1,12 +1,12 @@
use evdev::uinput::VirtualDevice;
use evdev::{
AbsInfo, AbsoluteAxisCode, AttributeSet, EventStream, EventType, InputEvent, KeyCode, UinputAbsSetup
AbsInfo, AbsoluteAxisCode, AttributeSet, EventStream, EventType, InputEvent, KeyCode,
UinputAbsSetup,
};
use std::collections::HashMap;
#[derive(PartialEq, Debug)]
#[derive(Clone, Copy)]
#[derive(PartialEq, Debug, Clone, Copy)]
#[repr(u8)]
pub enum Direction {
Up = 0,
@@ -66,8 +66,6 @@ impl VirtualGamepad {
dpad_bindings.insert(KeyCode::KEY_F.code(), Direction::Right);
dpad_bindings.insert(KeyCode::KEY_W.code(), Direction::Left);
let ui = VirtualDevice::builder()
.unwrap()
.name(&name)
@@ -86,7 +84,6 @@ impl VirtualGamepad {
.build()
.unwrap();
VirtualGamepad {
ui,
btn_bindings,