Struct ps2::PS2Controller
source · pub struct PS2Controller { /* private fields */ }
Expand description
An initialized PS/2 controller that can be used to communicate with legacy PS/2 keyboard and mouse devices.
Implementations§
source§impl PS2Controller
impl PS2Controller
sourcepub fn keyboard_ref(&self) -> Option<PS2Keyboard<'_>>
pub fn keyboard_ref(&self) -> Option<PS2Keyboard<'_>>
Returns a reference to the keyboard attached to this PS/2 controller.
The keyboard only uses the data port.
sourcepub fn mouse_ref(&self) -> Option<PS2Mouse<'_>>
pub fn mouse_ref(&self) -> Option<PS2Mouse<'_>>
Returns a reference to the mouse attached to this PS/2 controller.
The mouse uses both the data port and the command/status port.
sourcepub fn write_command(&self, value: HostToControllerCommand)
pub fn write_command(&self, value: HostToControllerCommand)
Writes a command to the PS/2 command port.
Usage Note
Devices attached to the controller should be disabled before writing a command that returns data, otherwise the output buffer may get overwritten.
sourcepub fn read_config(&self) -> ControllerConfigurationByte
pub fn read_config(&self) -> ControllerConfigurationByte
Reads and returns the current config value from the PS/2 controller.
sourcepub fn write_config(&self, value: ControllerConfigurationByte)
pub fn write_config(&self, value: ControllerConfigurationByte)
Writes the given config value
to the PS/2 controller.
sourcepub fn status_register(&self) -> ControllerToHostStatus
pub fn status_register(&self) -> ControllerToHostStatus
Reads the PS/2 status port.
sourcepub fn flush_output_buffer(&self)
pub fn flush_output_buffer(&self)
Clean the data port output buffer, skipping the ControllerToHostStatus output_buffer_full
check
pub fn test(&self) -> Result<(), &'static str>
pub fn test_port1(&self) -> Result<(), &'static str>
pub fn test_port2(&self) -> Result<(), &'static str>
sourcepub fn read_controller_test_result(&self) -> Result<(), &'static str>
pub fn read_controller_test_result(&self) -> Result<(), &'static str>
must only be called after writing the TestController command otherwise would read bogus data