/* This reads the keyboard status port, and does the appropriate action.  */
static unsigned char handle_kbd_event(void)
/* This reads the keyboard status port, and does the appropriate action.  */
static unsigned char handle_kbd_event(void)
{
	unsigned char status = kbd_read_status();
	unsigned int work = 10000;
	while ((--work > 0) && (status & KBD_STAT_OBF)) {
		unsigned char scancode;
		scancode = kbd_read_input();
		if (!(status & (KBD_STAT_GTO | KBD_STAT_PERR))) {
			if (status & KBD_STAT_MOUSE_OBF)
				;
			else
				handle_scancode(scancode);
		}
		status = kbd_read_status();
	}
	if (!work)
		PRINTF("pc_keyb: controller jammed (0x%02X).\n", status);
	return status;
}