Struct ps2::PS2Keyboard

source ·
pub struct PS2Keyboard<'c> { /* private fields */ }
Expand description

A reference to the PS/2 Keyboard connected to the PS/2 Controller.

Implementations§

source§

impl<'c> PS2Keyboard<'c>

source

pub fn new(controller: &'c PS2Controller) -> Self

Create a new reference to the keyboard connected to the given PS2 controller.

source

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

Reset the keyboard.

source

pub fn set_keyboard_led(&self, value: LEDState) -> Result<(), &'static str>

Set the status LEDs on the keyboard.

source

pub fn set_keyboard_scancode_set( &self, value: ScancodeSet ) -> Result<(), &'static str>

Set the active scancode set currently used by the keyboard.

TODO: set Set2, if Get == 2, return else set Set1, if Get == 1, return else set Set3, if Get == 3, return else Err

source

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

Detect the KeyboardType.

Note: On the identify command, KeyboardType::AncientATKeyboard usually returns no bytes at all, but PS2Controller::read_data always returns a byte. This means PS2Controller::read_data would presumably return 0x00 here, even though the value is already reserved for the device type “Standard PS/2 mouse”. As we only care about detecting keyboard types here, it should work.

source

pub fn read_scancode(&self) -> u8

Reads a raw scancode value from the PS/2 controller’s data port.

Auto Trait Implementations§

§

impl<'c> !RefUnwindSafe for PS2Keyboard<'c>

§

impl<'c> Send for PS2Keyboard<'c>

§

impl<'c> Sync for PS2Keyboard<'c>

§

impl<'c> Unpin for PS2Keyboard<'c>

§

impl<'c> !UnwindSafe for PS2Keyboard<'c>

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.