Improve help message and cargo fmt

This commit is contained in:
Johannes Leupolz 2025-12-23 21:47:16 +00:00
parent 04bd88f179
commit 0c91a05ef7
2 changed files with 7 additions and 6 deletions

View file

@ -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");

View file

@ -2,10 +2,10 @@
//
// Author: Johannes Leupolz <dev@leupolz.eu>
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;
}