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>
impl<'c> PS2Keyboard<'c>
sourcepub fn new(controller: &'c PS2Controller) -> Self
pub fn new(controller: &'c PS2Controller) -> Self
Create a new reference to the keyboard connected to the given PS2 controller.
sourcepub fn set_keyboard_led(&self, value: LEDState) -> Result<(), &'static str>
pub fn set_keyboard_led(&self, value: LEDState) -> Result<(), &'static str>
Set the status LEDs on the keyboard.
sourcepub fn set_keyboard_scancode_set(
&self,
value: ScancodeSet
) -> Result<(), &'static str>
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
sourcepub fn keyboard_detect(&self) -> Result<KeyboardType, &'static str>
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.
sourcepub fn read_scancode(&self) -> u8
pub fn read_scancode(&self) -> u8
Reads a raw scancode value from the PS/2 controller’s data port.