Skip to content
This repository has been archived by the owner on Apr 6, 2020. It is now read-only.

Commit

Permalink
Simplify matching in keyboard scancode decoding
Browse files Browse the repository at this point in the history
  • Loading branch information
dirk committed Oct 2, 2016
1 parent e02ff51 commit bea1522
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions keyboard/src/lib.rs
@@ -1,7 +1,5 @@
#![no_std]

static NULL: char = '\0';

/// Decode a code in the PS/2 scan code set 1 (legacy set).
///
/// Difference between set 1 and sets 2 & 3:
Expand Down Expand Up @@ -62,12 +60,8 @@ pub fn from_scancode(code: usize) -> Option<char> {
0x37 => '*', // Keypad
0x4a => '-', // Keypad
0x4e => '+', // Keypad
_ => NULL,
_ => return None,
};

if printable != NULL {
Some(printable)
} else {
None
}
Some(printable)
}

0 comments on commit bea1522

Please sign in to comment.