Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 14 additions & 10 deletions kernel/ps2/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -111,17 +111,21 @@ pub fn init() -> Result<&'static PS2Controller, &'static str> {
controller.write_config(config);

// Step 10: Reset Devices
let keyboard_ref = PS2Keyboard::new(&controller);
if let Err(e) = keyboard_ref.reset() {
warn!("couldn't reset the keyboard; assuming there is none: {e}");
} else {
controller.keyboard_attached = true;
if port_1_works {
let keyboard_ref = PS2Keyboard::new(&controller);
if let Err(e) = keyboard_ref.reset() {
warn!("couldn't reset the keyboard; assuming there is none: {e}");
} else {
controller.keyboard_attached = true;
}
}
let mouse_ref = PS2Mouse::new(&controller);
if let Err(e) = mouse_ref.reset() {
warn!("couldn't reset the mouse; assuming there is none: {e}");
} else {
controller.mouse_attached = true;
if port_2_works {
let mouse_ref = PS2Mouse::new(&controller);
if let Err(e) = mouse_ref.reset() {
warn!("couldn't reset the mouse; assuming there is none: {e}");
} else {
controller.mouse_attached = true;
}
}

debug!("Final PS/2 {:?}", controller.read_config());
Expand Down