PS/2 Keyboard Decoder in Rust
Switch branches/tags
Nothing to show
Clone or download
thejpster Merge pull request #3 from phil-opp/fixes
Two fixes for scancode set 1
Latest commit 49d60c5 Nov 11, 2018
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
src Add a test for set 1: a_down -> a_up -> s_down Nov 11, 2018
.gitignore Add .gitignore. Apr 16, 2018
.travis.yml Add Travis support. Nov 9, 2018
Cargo.toml Bump. Nov 9, 2018
README.md Add a README. Nov 9, 2018

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};

fn main() {
	let mut kb = pc_keyboard::Keyboard::new(layouts::Us104Key, ScancodeSet2);
	match kb.add_byte(0x20) {
		Ok(Some(event)) => {
			println!("Event {:?}", event);
		}
		Ok(None) => {
			println!("Need more data");
		}
		Err(e) => {
			println!("Error decoding: {:?}", e);
		}
	}
}