qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] Re: [PATCH] add event queueing to USB HID


From: Gerd Hoffmann
Subject: [Qemu-devel] Re: [PATCH] add event queueing to USB HID
Date: Fri, 07 Jan 2011 08:59:04 +0100
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.13) Gecko/20101208 Red Hat/3.1.7-3.el6_0 Thunderbird/3.1.7

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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]