pub struct Keyboard<'c> { /* private fields */ }
Expand description
A PS/2 keyboard.
This provides the functionality of a typical PS/2 keyboard, as well as PS/2 devices that act like keyboards, such as barcode scanners, card readers, fingerprint scanners, etc.
§Examples
use ps2::Controller;
let mut controller = unsafe { Controller::new() };
let mut keyboard = controller.keyboard();
Implementations§
Source§impl<'c> Keyboard<'c>
impl<'c> Keyboard<'c>
Sourcepub fn set_leds(&mut self, leds: KeyboardLedFlags) -> Result<(), KeyboardError>
pub fn set_leds(&mut self, leds: KeyboardLedFlags) -> Result<(), KeyboardError>
Set the state of the keyboard LEDs.
Sourcepub fn echo(&mut self) -> Result<(), KeyboardError>
pub fn echo(&mut self) -> Result<(), KeyboardError>
Run a diagnostic echo command.
Sourcepub fn get_scancode_set(&mut self) -> Result<u8, KeyboardError>
pub fn get_scancode_set(&mut self) -> Result<u8, KeyboardError>
Get the number corresponding to the current scancode set (1, 2, or 3).
Sourcepub fn set_scancode_set(
&mut self,
scancode_set: u8,
) -> Result<(), KeyboardError>
pub fn set_scancode_set( &mut self, scancode_set: u8, ) -> Result<(), KeyboardError>
Set the scancode set number (1, 2, or 3).
Sourcepub fn get_keyboard_type(&mut self) -> Result<KeyboardType, KeyboardError>
pub fn get_keyboard_type(&mut self) -> Result<KeyboardType, KeyboardError>
Attempt to obtain a device identifier for this keyboard.
Sourcepub fn set_typematic_rate_and_delay(
&mut self,
typematic_config: u8,
) -> Result<(), KeyboardError>
pub fn set_typematic_rate_and_delay( &mut self, typematic_config: u8, ) -> Result<(), KeyboardError>
Set the typematic repeat rate and delay.
Use the ‘Repeat rate’ and ‘Delay’ tables on this page to create the configuration byte.
Sourcepub fn enable_scanning(&mut self) -> Result<(), KeyboardError>
pub fn enable_scanning(&mut self) -> Result<(), KeyboardError>
Clear the data buffer and last typematic key, then enable scancodes.
Sourcepub fn disable_scanning(&mut self) -> Result<(), KeyboardError>
pub fn disable_scanning(&mut self) -> Result<(), KeyboardError>
Reset keyboard to power-on state and disable scancodes.
Sourcepub fn set_defaults(&mut self) -> Result<(), KeyboardError>
pub fn set_defaults(&mut self) -> Result<(), KeyboardError>
Reset keyboard to power-on state by clearing the data buffer and restoring all default key settings.
Sourcepub fn set_all_keys_typematic(&mut self) -> Result<(), KeyboardError>
pub fn set_all_keys_typematic(&mut self) -> Result<(), KeyboardError>
Set all keys to typematic only. This only has an effect if scancode set 3 is in use.
Sourcepub fn set_all_keys_make_break(&mut self) -> Result<(), KeyboardError>
pub fn set_all_keys_make_break(&mut self) -> Result<(), KeyboardError>
Set all keys to make/break only. This only has an effect if scancode set 3 is in use.
Sourcepub fn set_all_keys_make_only(&mut self) -> Result<(), KeyboardError>
pub fn set_all_keys_make_only(&mut self) -> Result<(), KeyboardError>
Set all keys to make only. This only has an effect if scancode set 3 is in use.
Sourcepub fn set_all_keys_typematic_make_break(&mut self) -> Result<(), KeyboardError>
pub fn set_all_keys_typematic_make_break(&mut self) -> Result<(), KeyboardError>
Set all keys to typematic and make/break. This only has an effect if scancode set 3 is in use.
Sourcepub fn set_key_typematic(&mut self, scancode: u8) -> Result<(), KeyboardError>
pub fn set_key_typematic(&mut self, scancode: u8) -> Result<(), KeyboardError>
Set a specific key to typematic only. This only has an effect if scancode set 3 is in use.
Sourcepub fn set_key_make_break(&mut self, scancode: u8) -> Result<(), KeyboardError>
pub fn set_key_make_break(&mut self, scancode: u8) -> Result<(), KeyboardError>
Set a specific key to make/break only. This only has an effect if scancode set 3 is in use.
Sourcepub fn set_key_make_only(&mut self, scancode: u8) -> Result<(), KeyboardError>
pub fn set_key_make_only(&mut self, scancode: u8) -> Result<(), KeyboardError>
Set a specific key to make only. This only has an effect if scancode set 3 is in use.
Sourcepub fn resend_last_byte(&mut self) -> Result<u8, KeyboardError>
pub fn resend_last_byte(&mut self) -> Result<u8, KeyboardError>
Get the last byte sent by the keyboard.
Sourcepub fn reset_and_self_test(&mut self) -> Result<(), KeyboardError>
pub fn reset_and_self_test(&mut self) -> Result<(), KeyboardError>
Reset the keyboard and perform a Basic Assurance Test.
Returns KeyboardError::SelfTestFailed
if the test fails.