This should be enough for keyboard handling.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23211 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
François Revol 2008-01-01 23:25:35 +00:00
parent 3e4c56176d
commit fa806b5473
3 changed files with 12 additions and 20 deletions

View File

@ -10,26 +10,15 @@
#include <boot/platform.h> #include <boot/platform.h>
static uint16 static uint32
check_for_key(void) check_for_key(void)
{ {
//XXX: non blocking in ? union key k;
#if 0 if (Bconstat(DEV_CON) == 0)
bios_regs regs;
regs.eax = 0x0100;
call_bios(0x16, &regs);
// the zero flag is set when there is no key stroke waiting for us
if (regs.flags & ZERO_FLAG)
return 0; return 0;
// remove the key from the buffer k.d0 = Bconin(DEV_CON);
regs.eax = 0; return k.d0;
call_bios(0x16, &regs);
return regs.eax & 0xffff;
#endif
return 0;
} }
@ -45,7 +34,7 @@ extern "C" union key
wait_for_key(void) wait_for_key(void)
{ {
union key key; union key key;
key.d0 = Bconin(2); key.d0 = Bconin(DEV_CON);
return key; return key;
} }
@ -57,7 +46,7 @@ check_for_boot_keys(void)
union key key; union key key;
uint32 options = 0; uint32 options = 0;
while ((key.ax = check_for_key()) != 0) { while ((key.d0 = check_for_key()) != 0) {
switch (key.code.ascii) { switch (key.code.ascii) {
case ' ': case ' ':
options |= BOOT_OPTION_MENU; options |= BOOT_OPTION_MENU;

View File

@ -8,8 +8,10 @@
union key { union key {
uint32 d0; uint32 d0;
struct { struct {
uint16 bios; // scan code uint8 modifiers; // not always present!
uint16 ascii; uint8 bios; // scan code
uint8 dummy;
uint8 ascii;
} code; } code;
}; };

View File

@ -16,6 +16,7 @@ extern "C" {
#define DEV_PRINTER 0 #define DEV_PRINTER 0
#define DEV_AUX 1 #define DEV_AUX 1
#define DEV_CON 2 #define DEV_CON 2
#define DEV_CONSOLE 2
#define DEV_MIDI 3 #define DEV_MIDI 3
#define DEV_IKBD 4 #define DEV_IKBD 4
#define DEV_RAW 5 #define DEV_RAW 5