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

source

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.

source

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.

source

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.

source

pub fn read_config(&self) -> ControllerConfigurationByte

Reads and returns the current config value from the PS/2 controller.

source

pub fn write_config(&self, value: ControllerConfigurationByte)

Writes the given config value to the PS/2 controller.

source

pub fn status_register(&self) -> ControllerToHostStatus

Reads the PS/2 status port.

source

pub fn flush_output_buffer(&self)

Clean the data port output buffer, skipping the ControllerToHostStatus output_buffer_full check

source

pub fn test(&self) -> Result<(), &'static str>

source

pub fn test_port1(&self) -> Result<(), &'static str>

source

pub fn test_port2(&self) -> Result<(), &'static str>

source

pub fn read_controller_test_result(&self) -> Result<(), &'static str>

must only be called after writing the TestController command otherwise would read bogus data

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.