Skip to content
PS/2 Keyboard Decoder in Rust
Branch: master
Clone or download
thejpster Version bump.
Updated description - we do more than UK105/SCS2.
Latest commit 34595c1 Feb 7, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
src
.gitignore
.travis.yml Add Travis support. Nov 9, 2018
Cargo.toml
README.md More docs and tests. Feb 6, 2019

README.md

pc-keyboard

A simple driver for handling PC keyboards, with both Scancode Set 1 (when running on a PC) and Scancode Set 2 support (when reading a PS/2 keyboard output directly).

Supports:

  • Scancode Set 1 and 2
  • US 104-key layout
  • UK 105-key layout

Usage

extern crate pc_keyboard;

use pc_keyboard::{Keyboard, layouts, ScancodeSet2, HandleControlPlusLetter};

fn main() {
	let mut kb = pc_keyboard::Keyboard::new(layouts::Us104Key, ScancodeSet2, HandleControlPlusLetter::MapToUnicode);
	match kb.add_byte(0x20) {
		Ok(Some(event)) => {
			println!("Event {:?}", event);
		}
		Ok(None) => {
			println!("Need more data");
		}
		Err(e) => {
			println!("Error decoding: {:?}", e);
		}
	}
}
You can’t perform that action at this time.