Esempio n. 1
0
/* read one byte from the keyboard */
static int
read_kbd_data(KBDC p)
{
    if (!wait_for_kbd_data(kbdcp(p)))
        return -1;		/* timeout */
    DELAY(KBDC_DELAYTIME);
    return inb(kbdcp(p)->port + KBD_DATA_PORT);
}
Esempio n. 2
0
/* read one byte from the keyboard */
int
read_kbd_data(KBDC p)
{
#if KBDIO_DEBUG >= 2
    if (++call > 2000) {
	call = 0;
	log(LOG_DEBUG, "kbdc: kbd q: %d calls, max %d chars, "
			     "aux q: %d calls, max %d chars\n",
		       kbdcp(p)->kbd.call_count, kbdcp(p)->kbd.max_qcount,
		       kbdcp(p)->aux.call_count, kbdcp(p)->aux.max_qcount);
    }
#endif

    if (availq(&kbdcp(p)->kbd)) 
        return removeq(&kbdcp(p)->kbd);
    if (!wait_for_kbd_data(kbdcp(p)))
        return -1;		/* timeout */
    return read_data(kbdcp(p));
}