]> Joshua Wise's Git repositories - netwatch.git/blobdiff - aseg-paging/main.c
another try
[netwatch.git] / aseg-paging / main.c
index 1bc502e6dc1663bd2a9177d0f15c598920456849..586935c723ca777919f8f0df49c1d60ab10e25db 100644 (file)
@@ -9,7 +9,7 @@
 #include "../net/net.h"
 #include "vga-overlay.h"
 #include "../aseg/packet.h"
-#include "../aseg/keyboard.h"
+#include "keyboard.h"
 
 unsigned int lastctr = 0;
 extern unsigned int counter;
@@ -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);
@@ -140,7 +141,8 @@ void gbl_rls_handler(smi_event_t ev)
                dump_log((char *)packet->data);
                *(unsigned long*)0xAFFD4 = 42;
        } else if (packet->type == 0xAA) {
-               kbd_inject_key('A');
+               kbd_inject_keysym('A', 1);
+               kbd_inject_keysym('A', 0);
        } else {
                *(unsigned long*)0xAFFD4 = 0x2BADD00D;
        }
This page took 0.016369 seconds and 4 git commands to generate.