static int usb_hid_handle_data(USBDevice *dev, USBPacket *p)

{

    USBHIDState *s = (USBHIDState *)dev;

    int ret = 0;



    switch(p->pid) {

    case USB_TOKEN_IN:

        if (p->devep == 1) {

            int64_t curtime = qemu_get_clock_ns(vm_clock);

            if (!s->changed && (!s->idle || s->next_idle_clock - curtime > 0))

                return USB_RET_NAK;

            usb_hid_set_next_idle(s, curtime);

            if (s->kind == USB_MOUSE || s->kind == USB_TABLET) {

                ret = usb_pointer_poll(s, p->data, p->len);

            }

            else if (s->kind == USB_KEYBOARD) {

                ret = usb_keyboard_poll(s, p->data, p->len);

            }

            s->changed = s->n > 0;

        } else {

            goto fail;

        }

        break;

    case USB_TOKEN_OUT:

    default:

    fail:

        ret = USB_RET_STALL;

        break;

    }

    return ret;

}

static int usb_hid_handle_data(USBDevice *dev, USBPacket *p)

{

    USBHIDState *s = (USBHIDState *)dev;

    int ret = 0;



    switch(p->pid) {

    case USB_TOKEN_IN:

        if (p->devep == 1) {

            int64_t curtime = qemu_get_clock_ns(vm_clock);

            if (!s->changed && (!s->idle || s->next_idle_clock - curtime > 0))

                return USB_RET_NAK;

            usb_hid_set_next_idle(s, curtime);

            if (s->kind == USB_MOUSE || s->kind == USB_TABLET) {

                ret = usb_pointer_poll(s, p->data, p->len);

            }

            else if (s->kind == USB_KEYBOARD) {

                ret = usb_keyboard_poll(s, p->data, p->len);

            }

            s->changed = s->n > 0;

        } else {

            goto fail;

        }

        break;

    case USB_TOKEN_OUT:

    default:

    fail:

        ret = USB_RET_STALL;

        break;

    }

    return ret;

}

                ret = usb_pointer_poll(s, p->data, p->len);                 ret = usb_keyboard_poll(s, p->data, p->len);
static int FUNC_0(USBDevice *VAR_0, USBPacket *VAR_1)

{

    USBHIDState *s = (USBHIDState *)VAR_0;

    int VAR_2 = 0;



    switch(VAR_1->pid) {

    case USB_TOKEN_IN:

        if (VAR_1->devep == 1) {

            int64_t curtime = qemu_get_clock_ns(vm_clock);

            if (!s->changed && (!s->idle || s->next_idle_clock - curtime > 0))

                return USB_RET_NAK;

            usb_hid_set_next_idle(s, curtime);

            if (s->kind == USB_MOUSE || s->kind == USB_TABLET) {

                VAR_2 = usb_pointer_poll(s, VAR_1->data, VAR_1->len);

            }

            else if (s->kind == USB_KEYBOARD) {

                VAR_2 = usb_keyboard_poll(s, VAR_1->data, VAR_1->len);

            }

            s->changed = s->n > 0;

        } else {

            goto fail;

        }

        break;

    case USB_TOKEN_OUT:

    default:

    fail:

        VAR_2 = USB_RET_STALL;

        break;

    }

    return VAR_2;

}

static int FUNC_0(USBDevice *VAR_0, USBPacket *VAR_1)
{ USBHIDState *s = (USBHIDState *)VAR_0; int VAR_2 = 0; switch(VAR_1->pid) { case USB_TOKEN_IN:
if (VAR_1->devep == 1) { int64_t curtime = qemu_get_clock_ns(vm_clock); if (!s->changed && (!s->idle || s->next_idle_clock - curtime > 0))
return USB_RET_NAK; usb_hid_set_next_idle(s, curtime); if (s->kind == USB_MOUSE || s->kind == USB_TABLET) { VAR_2 = usb_pointer_poll(s, VAR_1->data, VAR_1->len); } else if (s->kind == USB_KEYBOARD) { VAR_2 = usb_keyboard_poll(s, VAR_1->data, VAR_1->len); } s->changed = s->n > 0; } else { goto fail; } break; case USB_TOKEN_OUT:
default:
fail:
VAR_2 = USB_RET_STALL; break; } return VAR_2; }