static void hid_keyboard_event(DeviceState *dev, QemuConsole *src,

                               InputEvent *evt)

{

    HIDState *hs = (HIDState *)dev;

    int scancodes[3], i, count;

    int slot;



    count = qemu_input_key_value_to_scancode(evt->key->key,

                                             evt->key->down,

                                             scancodes);

    if (hs->n + count > QUEUE_LENGTH) {

        fprintf(stderr, "usb-kbd: warning: key event queue full\n");

        return;

    }

    for (i = 0; i < count; i++) {

        slot = (hs->head + hs->n) & QUEUE_MASK; hs->n++;

        hs->kbd.keycodes[slot] = scancodes[i];

    }

    hs->event(hs);

}

static void hid_keyboard_event(DeviceState *dev, QemuConsole *src,

                               InputEvent *evt)

{

    HIDState *hs = (HIDState *)dev;

    int scancodes[3], i, count;

    int slot;



    count = qemu_input_key_value_to_scancode(evt->key->key,

                                             evt->key->down,

                                             scancodes);

    if (hs->n + count > QUEUE_LENGTH) {

        fprintf(stderr, "usb-kbd: warning: key event queue full\n");

        return;

    }

    for (i = 0; i < count; i++) {

        slot = (hs->head + hs->n) & QUEUE_MASK; hs->n++;

        hs->kbd.keycodes[slot] = scancodes[i];

    }

    hs->event(hs);

}

static void FUNC_0(DeviceState *VAR_0, QemuConsole *VAR_1,

                               InputEvent *VAR_2)

{

    HIDState *hs = (HIDState *)VAR_0;

    int VAR_3[3], VAR_4, VAR_5;

    int VAR_6;



    VAR_5 = qemu_input_key_value_to_scancode(VAR_2->key->key,

                                             VAR_2->key->down,

                                             VAR_3);

    if (hs->n + VAR_5 > QUEUE_LENGTH) {

        fprintf(stderr, "usb-kbd: warning: key event queue full\n");

        return;

    }

    for (VAR_4 = 0; VAR_4 < VAR_5; VAR_4++) {

        VAR_6 = (hs->head + hs->n) & QUEUE_MASK; hs->n++;

        hs->kbd.keycodes[VAR_6] = VAR_3[VAR_4];

    }

    hs->event(hs);

}

static void FUNC_0(DeviceState *VAR_0, QemuConsole *VAR_1,
InputEvent *VAR_2)
{ HIDState *hs = (HIDState *)VAR_0; int VAR_3[3], VAR_4, VAR_5; int VAR_6; VAR_5 = qemu_input_key_value_to_scancode(VAR_2->key->key,
VAR_2->key->down,
VAR_3); if (hs->n + VAR_5 > QUEUE_LENGTH) { fprintf(stderr, "usb-kbd: warning: key event queue full\n"); return; } for (VAR_4 = 0; VAR_4 < VAR_5; VAR_4++) { VAR_6 = (hs->head + hs->n) & QUEUE_MASK; hs->n++; hs->kbd.keycodes[VAR_6] = VAR_3[VAR_4]; } hs->event(hs); }