Struct Keyboard

Source
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>

Source

pub fn set_leds(&mut self, leds: KeyboardLedFlags) -> Result<(), KeyboardError>

Set the state of the keyboard LEDs.

Source

pub fn echo(&mut self) -> Result<(), KeyboardError>

Run a diagnostic echo command.

Source

pub fn get_scancode_set(&mut self) -> Result<u8, KeyboardError>

Get the number corresponding to the current scancode set (1, 2, or 3).

Source

pub fn set_scancode_set( &mut self, scancode_set: u8, ) -> Result<(), KeyboardError>

Set the scancode set number (1, 2, or 3).

Source

pub fn get_keyboard_type(&mut self) -> Result<KeyboardType, KeyboardError>

Attempt to obtain a device identifier for this keyboard.

Source

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.

Source

pub fn enable_scanning(&mut self) -> Result<(), KeyboardError>

Clear the data buffer and last typematic key, then enable scancodes.

Source

pub fn disable_scanning(&mut self) -> Result<(), KeyboardError>

Reset keyboard to power-on state and disable scancodes.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

pub fn resend_last_byte(&mut self) -> Result<u8, KeyboardError>

Get the last byte sent by the keyboard.

Source

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.

Trait Implementations§

Source§

impl<'c> Debug for Keyboard<'c>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'c> Freeze for Keyboard<'c>

§

impl<'c> RefUnwindSafe for Keyboard<'c>

§

impl<'c> Send for Keyboard<'c>

§

impl<'c> Sync for Keyboard<'c>

§

impl<'c> Unpin for Keyboard<'c>

§

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

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where 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 T
where 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 T
where U: Into<T>,

Source§

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 T
where U: TryFrom<T>,

Source§

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.