ps2d: disable keyboard before running self test
Beforehand, if you spammed 'enter' (or any key) upon startup, your self test would fail with 1C or 9C (the scancodes for pressing and releasing enter respectively). We now disable the keyboard earlier, and this fixes the issue.
This commit is contained in:
@@ -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)?;
|
||||
|
||||
Reference in New Issue
Block a user