#include "util.h" // debug_enter
#include "config.h" // CONFIG_*
#include "bregs.h" // struct bregs
-#include "ps2port.h" // kbd_command
+#include "ps2port.h" // ps2_kbd_command
+#include "usb-hid.h" // usb_kbd_command
// Bit definitions for BDA kbd_flag[012]
#define KF0_RSHIFT (1<<0)
static void
dequeue_key(struct bregs *regs, int incr, int extended)
{
+ yield();
u16 buffer_head;
u16 buffer_tail;
for (;;) {
SET_BDA(kbd_buf_head, buffer_head);
}
+static inline int
+kbd_command(int command, u8 *param)
+{
+ if (usb_kbd_active())
+ return usb_kbd_command(command, param);
+ return ps2_kbd_command(command, param);
+}
+
// read keyboard input
static void
handle_1600(struct bregs *regs)
static void
handle_1602(struct bregs *regs)
{
+ yield();
regs->al = GET_BDA(kbd_flag0);
}
static void
handle_1612(struct bregs *regs)
{
+ yield();
regs->al = GET_BDA(kbd_flag0);
regs->ah = ((GET_BDA(kbd_flag1) & ~(KF2_RCTRL|KF2_RALT))
| (GET_BDA(kbd_flag2) & (KF2_RCTRL|KF2_RALT)));