/* Wish we could just send scancodes straight to the guest which already has code for dealing with this...  */
static void xenfb_key_event(void *opaque, int scancode)
/* Wish we could just send scancodes straight to the guest which already has code for dealing with this...  */
static void xenfb_key_event(void *opaque, int scancode)
{
    struct XenInput *xenfb = opaque;
    int down = 1;
    if (scancode == 0xe0) {
	xenfb->extended = 1;
	return;
    } else if (scancode & 0x80) {
	scancode &= 0x7f;
	down = 0;
    }
    if (xenfb->extended) {
	scancode |= 0x80;
	xenfb->extended = 0;
    }
    xenfb_send_key(xenfb, down, scancode2linux[scancode]);
}