Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't try to initialize mouse or keyboard if there's no port #1092

Open
wants to merge 1 commit into
base: theseus_main
Choose a base branch
from
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