Skip to content

Commit

Permalink
Fix invalid bytes from serial (#479)
Browse files Browse the repository at this point in the history
* Fix invalid bytes from serial

* Update changelog
  • Loading branch information
vinc authored Apr 15, 2023
1 parent f5ad1a0 commit f54560e
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Changelog

## Unreleased
- Fix invalid bytes from serial (#479)
- Use pbkdf2_hmac to fix compilation warnings (#477)
- Bump spin from 0.9.5 to 0.9.6 (#474)
- Bump pbkdf2 from 0.11.0 to 0.12.1 (#470)
Expand Down
2 changes: 1 addition & 1 deletion src/sys/keyboard.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,8 @@ fn send_csi(c: char) {
}

fn interrupt_handler() {
let scancode = read_scancode();
if let Some(ref mut keyboard) = *KEYBOARD.lock() {
let scancode = read_scancode();
if let Ok(Some(event)) = keyboard.add_byte(scancode) {
let ord = Ordering::Relaxed;
match event.code {
Expand Down
3 changes: 3 additions & 0 deletions src/sys/serial.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,9 @@ pub fn init() {

fn interrupt_handler() {
let b = SERIAL.lock().read_byte();
if b == 0xFF { // Ignore invalid bytes
return;
}
let c = match b as char {
'\r' => '\n',
'\x7F' => '\x08', // Delete => Backspace
Expand Down

0 comments on commit f54560e

Please sign in to comment.