From fddbbc88ef8bd3d3f1ed80b1621ce02f9a659939 Mon Sep 17 00:00:00 2001 From: Marcus Overhagen Date: Mon, 30 May 2005 20:00:02 +0000 Subject: [PATCH] made this a little bit less weird git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@12906 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/add-ons/kernel/drivers/input/ps2_hid/keyboard.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/add-ons/kernel/drivers/input/ps2_hid/keyboard.c b/src/add-ons/kernel/drivers/input/ps2_hid/keyboard.c index 90a79462fd..7b02fab33d 100644 --- a/src/add-ons/kernel/drivers/input/ps2_hid/keyboard.c +++ b/src/add-ons/kernel/drivers/input/ps2_hid/keyboard.c @@ -192,9 +192,10 @@ handle_keyboard_interrupt(void *data) keyInfo.timestamp = system_time(); keyInfo.scancode = scancode; - while (packet_buffer_write(sKeyBuffer, (uint8 *)&keyInfo, sizeof(keyInfo)) == 0) { - // if there is no space left in the buffer, we start dropping old key strokes - packet_buffer_flush(sKeyBuffer, sizeof(keyInfo)); + if (packet_buffer_write(sKeyBuffer, (uint8 *)&keyInfo, sizeof(keyInfo)) == 0) { + // If there is no space left in the buffer, we drop this key stroke. We avoid + // dropping old key strokes, to not destroy what already was typed. + return B_HANDLED_INTERRUPT; } release_sem_etc(sKeyboardSem, 1, B_DO_NOT_RESCHEDULE);