From 5e21ff35c49591f3a8995e06f01a3fdfe044e126 Mon Sep 17 00:00:00 2001 From: Joshua Wise Date: Fri, 12 Dec 2008 17:50:47 -0500 Subject: [PATCH 1/1] another try --- aseg-paging/main.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/aseg-paging/main.c b/aseg-paging/main.c index d41e8c2..586935c 100644 --- a/aseg-paging/main.c +++ b/aseg-paging/main.c @@ -98,14 +98,15 @@ void timer_handler(smi_event_t ev) if (kbd_has_injected_scancode() && _inject_ready()) { smi_disable_event(SMI_EVENT_DEVTRAP_KBC); - outputf("Injecting key"); - /* Actually do the inject. */ - outb(0x64, 0xD2); /* "Inject, please!" */ - while (inb(0x64) & 0x02) /* Busy? */ - ; - outb(0x60, kbd_get_injected_scancode()); /* data */ - while (inb(0x64) & 0x02) /* wait for completion */ - ; + while (kbd_has_injected_scancode() && !(inb(0x64) & 0x01)) { + int i = 1000; + outb(0x64, 0xD2); /* "Inject, please!" */ + while (inb(0x64) & 0x02) /* Busy? */ + ; + outb(0x60, kbd_get_injected_scancode()); /* data */ + while ((inb(0x64) & 0x02) && i--) /* wait for completion */ + ; + } smi_enable_event(SMI_EVENT_DEVTRAP_KBC); } else if (kbd_has_injected_scancode()) outputf("Would like to inject, but %d %d", _ibf_ready, _waiting_for_data); -- 2.43.0