Example #1
0
bool PDC_check_key(void)
{
#ifdef CONFIG_USB_HID
    usb_poll();
    if ((curses_flags & F_ENABLE_CONSOLE) &&
        usbhid_havechar()) {
        return TRUE;
    }
#endif

#ifdef CONFIG_PC_KEYBOARD
    if ((curses_flags & F_ENABLE_CONSOLE) &&
        keyboard_havechar()) {
        return TRUE;
    }
#endif

#ifdef CONFIG_SERIAL_CONSOLE
    if ((curses_flags & F_ENABLE_SERIAL) &&
        serial_havechar()) {
        return TRUE;
    }
#endif

    return FALSE;
}
Example #2
0
static int curses_getchar(int _delay)
{
#if CONFIG(LP_USB_HID) || CONFIG(LP_PC_KEYBOARD) || \
	CONFIG(LP_SERIAL_CONSOLE)
	unsigned short c;
#endif

	do {
#if CONFIG(LP_USB_HID)
		usb_poll();
		if ((curses_flags & F_ENABLE_CONSOLE) &&
		    usbhid_havechar()) {
			c = usbhid_getchar();
			if (c != 0) return c;
		}
#endif
#if CONFIG(LP_PC_KEYBOARD)
		if ((curses_flags & F_ENABLE_CONSOLE) &&
		    keyboard_havechar()) {
			c = keyboard_getchar();
			if (c != 0) return c;
		}
#endif

#if CONFIG(LP_SERIAL_CONSOLE)
		if ((curses_flags & F_ENABLE_SERIAL) &&
		    serial_havechar()) {
			c = serial_getchar();
			return cook_serial(c);
		}
#endif

		if (_delay == 0) {
			break;
		} else if (_delay >= 10) {
			mdelay(10);
			_delay -= 10;
		} else if (_delay > 0) {
			mdelay(_delay);
			_delay = 0;
		}
	} while (1);

	return ERR;
}
Example #3
0
static int curses_getchar(int _delay)
{
#if defined(CONFIG_USB_HID) || defined(CONFIG_PC_KEYBOARD) || defined(CONFIG_SERIAL_CONSOLE)
	unsigned short c;
#endif

	do {
#ifdef CONFIG_USB_HID
		usb_poll();
		if ((curses_flags & F_ENABLE_CONSOLE) &&
		    usbhid_havechar()) {
			c = usbhid_getchar();
			if (c != 0) return c;
		}
#endif
#ifdef CONFIG_PC_KEYBOARD
		if ((curses_flags & F_ENABLE_CONSOLE) &&
		    keyboard_havechar()) {
			c = keyboard_getchar();
			if (c != 0) return c;
		}
#endif

#ifdef CONFIG_SERIAL_CONSOLE
		if ((curses_flags & F_ENABLE_SERIAL) &&
		    serial_havechar()) {
			c = serial_getchar();
			return cook_serial(c);
		}
#endif

		if (_delay == 0)
			break;

		if (_delay > 0) {
			mdelay(1);
			_delay--;
		}


	} while (1);

	return ERR;
}
Example #4
0
int PDC_get_key(void)
{
    int c = 0;

#ifdef CONFIG_USB_HID
    usb_poll();
    if ((curses_flags & F_ENABLE_CONSOLE) &&
        usbhid_havechar()) {
        c = usbhid_getchar();
    }
#endif

#ifdef CONFIG_PC_KEYBOARD
    if ((curses_flags & F_ENABLE_CONSOLE) &&
        keyboard_havechar() && (c==0)) {
        c = keyboard_getchar();
    }
#endif

#ifdef CONFIG_SERIAL_CONSOLE
    if ((curses_flags & F_ENABLE_SERIAL) &&
        serial_havechar() && (c==0)) {
        c = cook_serial(serial_getchar());
    }
#endif

    SP->key_code = FALSE;

    if (c == 0) {
        c = ERR;
    }
    if (c >= KEY_MIN) {
        SP->key_code = TRUE;
    }

    return c;
}