From c08ce938f3039c73bb5081606248b8dfa2321cf7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Sun, 29 Jan 2006 15:53:37 +0000 Subject: [PATCH] Added way to enter the kernel debugger in case keyboard is disabled - couldn't test it, though, as I couldn't reproduce the problem since then. Fixed indentation in ps2_keyboard.c. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@16137 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/add-ons/kernel/bus_managers/ps2/ps2_dev.c | 4 ++ .../kernel/bus_managers/ps2/ps2_keyboard.c | 64 +++++++++---------- 2 files changed, 35 insertions(+), 33 deletions(-) diff --git a/src/add-ons/kernel/bus_managers/ps2/ps2_dev.c b/src/add-ons/kernel/bus_managers/ps2/ps2_dev.c index de67de4cea..c340c1328e 100644 --- a/src/add-ons/kernel/bus_managers/ps2/ps2_dev.c +++ b/src/add-ons/kernel/bus_managers/ps2/ps2_dev.c @@ -131,6 +131,10 @@ ps2_dev_handle_int(ps2_dev *dev, uint8 data) if ((flags & PS2_FLAG_ENABLED) == 0) { dprintf("not enabled, data dropped\n"); + // TODO: remove me again; let us drop into the kernel debugger with F12 + if ((flags & PS2_FLAG_KEYB) != 0 && data == 88) + panic("keyboard requested halt.\n"); + return B_HANDLED_INTERRUPT; } diff --git a/src/add-ons/kernel/bus_managers/ps2/ps2_keyboard.c b/src/add-ons/kernel/bus_managers/ps2/ps2_keyboard.c index 9c4111b749..04b71e7738 100644 --- a/src/add-ons/kernel/bus_managers/ps2/ps2_keyboard.c +++ b/src/add-ons/kernel/bus_managers/ps2/ps2_keyboard.c @@ -61,52 +61,50 @@ set_leds(led_info *ledInfo) int32 keyboard_handle_int(uint8 data) { - at_kbd_io keyInfo; - uint8 scancode; + at_kbd_io keyInfo; + uint8 scancode; if (atomic_and(&sKeyboardOpenMask, 1) == 0) return B_HANDLED_INTERRUPT; + // TODO: Handle braindead "pause" key special case + if (data == EXTENDED_KEY) { + sIsExtended = true; + TRACE(("Extended key\n")); + return B_HANDLED_INTERRUPT; + } - // TODO: Handle braindead "pause" key special case + scancode = data; - if (data == EXTENDED_KEY) { - sIsExtended = true; - TRACE(("Extended key\n")); - return B_HANDLED_INTERRUPT; - } + TRACE(("scancode: %x\n", scancode)); - scancode = data; + // For now, F12 enters the kernel debugger + // ToDo: remove me later :-) + if (scancode == 88) + panic("keyboard requested halt.\n"); - TRACE(("scancode: %x\n", scancode)); + if (scancode & 0x80) { + keyInfo.is_keydown = false; + scancode -= 0x80; + } else + keyInfo.is_keydown = true; - // For now, F12 enters the kernel debugger - // ToDo: remove me later :-) - if (scancode == 88) - panic("keyboard requested halt.\n"); + if (sIsExtended) { + scancode |= 0x80; + sIsExtended = false; + } - if (scancode & 0x80) { - keyInfo.is_keydown = false; - scancode -= 0x80; - } else - keyInfo.is_keydown = true; + keyInfo.timestamp = system_time(); + keyInfo.scancode = scancode; - if (sIsExtended) { - scancode |= 0x80; - sIsExtended = false; - } + 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; + } - keyInfo.timestamp = system_time(); - keyInfo.scancode = scancode; - - 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); + release_sem_etc(sKeyboardSem, 1, B_DO_NOT_RESCHEDULE); return B_INVOKE_SCHEDULER; }