qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Gerd Hoffmann <kraxel@redhat.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: Ian Jackson <ian.jackson@eu.citrix.com>,
	qemu-devel@nongnu.org,
	Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Subject: [Qemu-devel] Re: [PATCH] add event queueing to USB HID
Date: Fri, 07 Jan 2011 08:59:04 +0100	[thread overview]
Message-ID: <4D26C7C8.1020203@redhat.com> (raw)
In-Reply-To: <1293116270-7069-1-git-send-email-pbonzini@redhat.com>

On 12/23/10 15:57, Paolo Bonzini wrote:
> The polling nature of the USB HID device makes it very hard to double
> click or drag while on a high-latency VNC connection.  This patch,
> based on work done in the Xen qemu-dm tree by Ian Jackson, fixes this
> bug by adding an event queue to the device.  The event queue associates
> each movement with the correct button state (and each button state change
> with the correct location); it also remembers all button presses and
> releases as well.

> @@ -68,7 +77,7 @@ typedef struct USBHIDState {
>       int protocol;
>       uint8_t idle;
>       int64_t next_idle_clock;
> -    int changed;
> +    int have_data, changed;

What is the difference between have_data and changed?
Do you need both?  And can't you just compare head and tail of the ring 
instead?

I think it makes sense to do the same for the keyboard, which might even 
simplify the code overall as both mouse and keyboard will work in a 
simliar way then.

> +static void usb_pointer_event_clear(USBPointerEvent *e, int buttons) {
> +    e->xdx = e->ydy = e->dz = 0;
> +    e->buttons_state = buttons;
> +}

Code style.

>
> -    usb_hid_changed(hs);
> +static void usb_pointer_event_combine(USBPointerEvent *e, int xyrel,
> +                                      int x1, int y1, int z1) {
> +    if (xyrel) {

Here too.

> +    /* When the buffer is empty, return the last event.

Why can this happen in the first place?  Shouldn't the device NAK polls 
when it has no events to deliver?

cheers,
   Gerd

  parent reply	other threads:[~2011-01-07  7:59 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-12-23 14:57 [Qemu-devel] [PATCH] add event queueing to USB HID Paolo Bonzini
2011-01-05 17:06 ` [Qemu-devel] " Stefano Stabellini
2011-01-07  7:59 ` Gerd Hoffmann [this message]
2011-01-07 12:20   ` Ian Jackson
2011-01-07 12:26     ` Ian Jackson
2011-01-10  9:05   ` Paolo Bonzini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4D26C7C8.1020203@redhat.com \
    --to=kraxel@redhat.com \
    --cc=ian.jackson@eu.citrix.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=stefano.stabellini@eu.citrix.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).