diff --git a/graphics/fbcond/src/main.rs b/graphics/fbcond/src/main.rs index 4db9e1b5fc..4393c9185c 100644 --- a/graphics/fbcond/src/main.rs +++ b/graphics/fbcond/src/main.rs @@ -57,10 +57,7 @@ fn inner(daemon: redox_daemon::Daemon, vt_ids: &[usize]) -> ! { daemon.ready().expect("failed to notify parent"); - scheme - .inputd_handle - .activate(1, inputd::VtMode::Default) - .unwrap(); + scheme.inputd_handle.activate(1).unwrap(); let mut blocked = Vec::new(); diff --git a/graphics/vesad/src/main.rs b/graphics/vesad/src/main.rs index 2b6fd953c4..3bdf8bb14f 100644 --- a/graphics/vesad/src/main.rs +++ b/graphics/vesad/src/main.rs @@ -92,7 +92,7 @@ fn inner(daemon: redox_daemon::Daemon, framebuffers: Vec, spec: &[( daemon.ready().expect("failed to notify parent"); - scheme.inputd_handle.activate(1, inputd::VtMode::Default).unwrap(); + scheme.inputd_handle.activate(1).unwrap(); let mut blocked = Vec::new(); loop { diff --git a/graphics/vesad/src/scheme.rs b/graphics/vesad/src/scheme.rs index 4b94801b16..0ca9bc6c40 100644 --- a/graphics/vesad/src/scheme.rs +++ b/graphics/vesad/src/scheme.rs @@ -279,7 +279,7 @@ impl SchemeMut for DisplayScheme { let command = inputd::parse_command(buf).unwrap(); match command { - DisplayCommand::Activate { vt, mode: _ } => { + DisplayCommand::Activate { vt } => { let vt_i = VtIndex(vt); if let Some(screens) = self.vts.get_mut(&vt_i) { diff --git a/graphics/virtio-gpud/src/scheme.rs b/graphics/virtio-gpud/src/scheme.rs index 4782dfca59..045602185d 100644 --- a/graphics/virtio-gpud/src/scheme.rs +++ b/graphics/virtio-gpud/src/scheme.rs @@ -409,13 +409,12 @@ impl<'a> SchemeMut for Scheme<'a> { } Handle::Input => { - use inputd::{Cmd as DisplayCommand, VtMode}; + use inputd::Cmd as DisplayCommand; let command = inputd::parse_command(buf).unwrap(); match command { - DisplayCommand::Activate { mode, vt } => { - assert!(mode == VtMode::Graphic || mode == VtMode::Default); + DisplayCommand::Activate { vt } => { let target_vt = vt; for handle in self.handles.values() { diff --git a/inputd/src/lib.rs b/inputd/src/lib.rs index 1747e02106..6c55e96949 100644 --- a/inputd/src/lib.rs +++ b/inputd/src/lib.rs @@ -7,18 +7,10 @@ unsafe fn any_as_u8_slice(p: &T) -> &[u8] { ::core::slice::from_raw_parts((p as *const T) as *const u8, ::core::mem::size_of::()) } -#[derive(Debug, Copy, Clone, PartialEq)] -#[repr(usize)] -pub enum VtMode { - Graphic = 1, - Default = 2, -} - #[derive(Debug, Clone)] #[repr(C)] pub struct VtActivate { pub vt: usize, - pub mode: VtMode, } pub struct Handle(File); @@ -35,8 +27,8 @@ impl Handle { self.0.read(&mut []) } - pub fn activate(&mut self, vt: usize, mode: VtMode) -> Result { - let cmd = VtActivate { vt, mode }; + pub fn activate(&mut self, vt: usize) -> Result { + let cmd = VtActivate { vt }; self.0.write(unsafe { any_as_u8_slice(&cmd) }) } } @@ -67,7 +59,6 @@ pub enum Cmd { // TODO(andypython): #VT should really need to be a `u8`. Activate { vt: usize, - mode: VtMode, }, Deactivate(usize /* #VT */), @@ -98,8 +89,8 @@ pub fn send_comand(file: &mut File, command: Cmd) -> Result<(), libredox::error: result.push(command.ty() as u8); match command { - Cmd::Activate { vt, mode } => { - let cmd = VtActivate { vt, mode }; + Cmd::Activate { vt } => { + let cmd = VtActivate { vt }; let bytes = unsafe { any_as_u8_slice(&cmd) }; result.extend_from_slice(bytes); @@ -138,10 +129,7 @@ pub fn parse_command(buffer: &[u8]) -> Option { match command { CmdTy::Activate => { let cmd = unsafe { &*buffer.as_ptr().offset(1).cast::() }; - Some(Cmd::Activate { - vt: cmd.vt, - mode: cmd.mode, - }) + Some(Cmd::Activate { vt: cmd.vt }) } CmdTy::Deactivate => Some(Cmd::Deactivate(vt)), diff --git a/inputd/src/main.rs b/inputd/src/main.rs index cb2ee9c021..db4ac50e83 100644 --- a/inputd/src/main.rs +++ b/inputd/src/main.rs @@ -18,7 +18,7 @@ use std::os::fd::AsRawFd; use std::sync::atomic::{AtomicUsize, Ordering}; use std::sync::Arc; -use inputd::{Cmd, VtActivate, VtMode}; +use inputd::{Cmd, VtActivate}; use spin::Mutex; @@ -50,7 +50,6 @@ impl Handle { /// requires the system call to return first. Otherwise, it will block indefinitely. struct VtInner { handle_file: File, - mode: VtMode, } struct Vt { @@ -74,10 +73,7 @@ impl Vt { pub fn inner(&self) -> &Mutex { self.inner.call_once(|| { let handle_file = File::open(format!("/scheme/{}/handle", self.display)).unwrap(); - Mutex::new(VtInner { - handle_file, - mode: VtMode::Default, - }) + Mutex::new(VtInner { handle_file }) }) } } @@ -292,7 +288,6 @@ impl SchemeMut for InputScheme { &mut vt_inner.handle_file, Cmd::Activate { vt: new_active.index, - mode: VtMode::Default, }, )?; self.active_vt = Some(new_active.clone()); @@ -379,17 +374,12 @@ fn deamon(deamon: redox_daemon::Daemon) -> anyhow::Result<()> { let mut vt_inner = vt.inner().lock(); // Failing to activate a VT is not a fatal error. - if let Err(err) = inputd::send_comand( - &mut vt_inner.handle_file, - Cmd::Activate { - vt: vt.index, - mode: cmd.mode, - }, - ) { + if let Err(err) = + inputd::send_comand(&mut vt_inner.handle_file, Cmd::Activate { vt: vt.index }) + { log::error!("inputd: failed to activate VT #{}: {err}", vt.index) } - vt_inner.mode = cmd.mode; scheme.active_vt = Some(vt.clone()); } @@ -509,9 +499,7 @@ pub fn main() { let mut handle = inputd::Handle::new(display_scheme) .expect("inputd: failed to open display handle"); - handle - .activate(vt, VtMode::Default) - .expect("inputd: failed to activate VT"); + handle.activate(vt).expect("inputd: failed to activate VT"); } _ => panic!("inputd: invalid argument: {}", val),