diff --git a/drivers/input/ps2d/src/controller.rs b/drivers/input/ps2d/src/controller.rs index 28982cccd3..7a34e5b604 100644 --- a/drivers/input/ps2d/src/controller.rs +++ b/drivers/input/ps2d/src/controller.rs @@ -291,17 +291,6 @@ impl Ps2 { } } - self.retry(format_args!("keyboard defaults"), 4, |x| { - // Set defaults and disable scanning - let b = x.keyboard_command(KeyboardCommand::SetDefaultsDisable)?; - if b != 0xFA { - error!("keyboard failed to set defaults: {:02X}", b); - return Err(Error::CommandRetry); - } - - Ok(b) - })?; - { // Set scancode set to 2 let scancode_set = 2; @@ -334,6 +323,19 @@ impl Ps2 { self.set_config(config)?; } + // The keyboard seems to still collect bytes even when we disable + // the port, so we must disable the keyboard too + self.retry(format_args!("keyboard defaults"), 4, |x| { + // Set defaults and disable scanning + let b = x.keyboard_command(KeyboardCommand::SetDefaultsDisable)?; + if b != 0xFA { + error!("keyboard failed to set defaults: {:02X}", b); + return Err(Error::CommandRetry); + } + + Ok(b) + })?; + { // Perform the self test self.command(Command::TestController)?;