Skip to content

Commit

Permalink
Prune garbage from keyboard from before terminal started
Browse files Browse the repository at this point in the history
  • Loading branch information
klange committed Jul 12, 2015
1 parent 06b57c1 commit 4cf6843
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions userspace/gui/terminal/terminal-vga.c
Original file line number Diff line number Diff line change
Expand Up @@ -619,6 +619,14 @@ void * handle_incoming(void * garbage) {

key_event_state_t kbd_state = {0};

/* Prune any keyboard input we got before the terminal started. */
struct stat s;
fstat(kfd, &s);
for (int i = 0; i < s.st_size; i++) {
char tmp[1];
read(kfd, tmp, 1);
}

while (!exit_application) {
int r = read(kfd, &c, 1);
if (r > 0) {
Expand Down

0 comments on commit 4cf6843

Please sign in to comment.