Merge branch 'ps2d-self-test' into 'main'

ps2d: disable keyboard before running self test

See merge request redox-os/base!152
This commit is contained in:
Jeremy Soller
2026-03-11 07:18:08 -06:00
+13 -11
View File
@@ -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)?;