From 0c91a05ef7e3a1a38089b0ba278bd61948c377ac Mon Sep 17 00:00:00 2001 From: Johannes Leupolz Date: Tue, 23 Dec 2025 21:47:16 +0000 Subject: [PATCH] Improve help message and cargo fmt --- vuinputd/src/main.rs | 6 +++++- vuinputd/src/vt_tools.rs | 7 ++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/vuinputd/src/main.rs b/vuinputd/src/main.rs index c9601ca..16f8763 100644 --- a/vuinputd/src/main.rs +++ b/vuinputd/src/main.rs @@ -79,7 +79,10 @@ struct Args { #[arg( long = "vt-guard", - help = "Prevent leakage of uinput to VT by, sending K_OFF to /dev/tty0" + help = "Prevent all keyboard input from reaching the VT by setting K_OFF on /dev/tty0.", + long_help = "Disable VT keyboard handling (K_OFF on /dev/tty0) to prevent uinput leakage.\n\ + This disables all keyboard input on the virtual terminals, including physical keyboards.\n\ + Loss of local access may require recovery via SSH or a rescue boot." )] pub vt_guard: bool, } @@ -144,6 +147,7 @@ fn main() -> std::io::Result<()> { if args.vt_guard { vt_tools::mute_keyboard()?; + std::process::exit(0); } check_permissions().expect("failed to read the capabilities of the vuinputd process"); diff --git a/vuinputd/src/vt_tools.rs b/vuinputd/src/vt_tools.rs index 60be9f5..ac5a558 100644 --- a/vuinputd/src/vt_tools.rs +++ b/vuinputd/src/vt_tools.rs @@ -2,10 +2,10 @@ // // Author: Johannes Leupolz +use log::{error, info, warn}; use std::fs::OpenOptions; use std::io; use std::os::unix::io::AsRawFd; -use log::{error, info, warn}; use libc::ioctl; @@ -29,10 +29,7 @@ pub fn check_vt_status() { let rc = unsafe { ioctl(fd, KDGKBMODE, &mut mode) }; if rc < 0 { - error!( - "KDGKBMODE ioctl failed: {}", - io::Error::last_os_error() - ); + error!("KDGKBMODE ioctl failed: {}", io::Error::last_os_error()); return; }