From: Gerd Hoffmann <kraxel@redhat.com>
To: qemu-devel@nongnu.org
Cc: Gerd Hoffmann <kraxel@redhat.com>
Subject: [Qemu-devel] [PATCH 1/6] usb/hid: add hid_pointer_activate, use it
Date: Thu, 11 Aug 2011 09:03:40 +0200 [thread overview]
Message-ID: <1313046225-1064-2-git-send-email-kraxel@redhat.com> (raw)
In-Reply-To: <1313046225-1064-1-git-send-email-kraxel@redhat.com>
HID reorganziation broke the usb tablet in windows xp. The reason is
that xp activates idle before it starts polling, which creates a
chicken-and-egg issue: We don't call hid_pointer_poll because there are
no pending events. We don't get any events because the activation code
in hid_pointer_poll is never executed and thus all pointer events are
routed to the PS/2 mouse by qemu.
Fix this by creating a hid_pointer_activate function and call it from
usb-hid when the guest sets the idle state.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
hw/hid.c | 13 +++++++++----
hw/hid.h | 1 +
hw/usb-hid.c | 3 +++
3 files changed, 13 insertions(+), 4 deletions(-)
diff --git a/hw/hid.c b/hw/hid.c
index 7b5ef5f..77339f7 100644
--- a/hw/hid.c
+++ b/hw/hid.c
@@ -218,16 +218,21 @@ static inline int int_clamp(int val, int vmin, int vmax)
}
}
+void hid_pointer_activate(HIDState *hs)
+{
+ if (!hs->ptr.mouse_grabbed) {
+ qemu_activate_mouse_event_handler(hs->ptr.eh_entry);
+ hs->ptr.mouse_grabbed = 1;
+ }
+}
+
int hid_pointer_poll(HIDState *hs, uint8_t *buf, int len)
{
int dx, dy, dz, b, l;
int index;
HIDPointerEvent *e;
- if (!hs->ptr.mouse_grabbed) {
- qemu_activate_mouse_event_handler(hs->ptr.eh_entry);
- hs->ptr.mouse_grabbed = 1;
- }
+ hid_pointer_activate(hs);
/* When the buffer is empty, return the last event. Relative
movements will all be zero. */
diff --git a/hw/hid.h b/hw/hid.h
index 4a8fa5b..9ce03b1 100644
--- a/hw/hid.h
+++ b/hw/hid.h
@@ -51,6 +51,7 @@ void hid_free(HIDState *hs);
bool hid_has_events(HIDState *hs);
void hid_set_next_idle(HIDState *hs, int64_t curtime);
+void hid_pointer_activate(HIDState *hs);
int hid_pointer_poll(HIDState *hs, uint8_t *buf, int len);
int hid_keyboard_poll(HIDState *hs, uint8_t *buf, int len);
int hid_keyboard_write(HIDState *hs, uint8_t *buf, int len);
diff --git a/hw/usb-hid.c b/hw/usb-hid.c
index e5d57de..6f12751 100644
--- a/hw/usb-hid.c
+++ b/hw/usb-hid.c
@@ -454,6 +454,9 @@ static int usb_hid_handle_control(USBDevice *dev, USBPacket *p,
case SET_IDLE:
hs->idle = (uint8_t) (value >> 8);
hid_set_next_idle(hs, qemu_get_clock_ns(vm_clock));
+ if (hs->kind == HID_MOUSE || hs->kind == HID_TABLET) {
+ hid_pointer_activate(hs);
+ }
ret = 0;
break;
default:
--
1.7.1
next prev parent reply other threads:[~2011-08-11 7:21 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-08-11 7:03 [Qemu-devel] [PULL] usb patch queue Gerd Hoffmann
2011-08-11 7:03 ` Gerd Hoffmann [this message]
2011-08-11 7:03 ` [Qemu-devel] [PATCH 2/6] hid: register kbd hander in init() Gerd Hoffmann
2011-08-11 7:03 ` [Qemu-devel] [PATCH 3/6] hid: introduce hid vmstate macros Gerd Hoffmann
2011-08-11 7:03 ` [Qemu-devel] [PATCH 4/6] usb-hid: use hid vmstate macro Gerd Hoffmann
2011-08-11 7:03 ` [Qemu-devel] [PATCH 5/6] milkymist-softusb: use hid code directly Gerd Hoffmann
2011-08-11 7:03 ` [Qemu-devel] [PATCH 6/6] usb-hid: remove usb_hid_datain_cb Gerd Hoffmann
2011-08-12 7:02 ` [Qemu-devel] [PULL] usb patch queue Michael Tokarev
2011-08-12 7:57 ` Gerd Hoffmann
2011-08-12 13:04 ` Anthony Liguori
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=1313046225-1064-2-git-send-email-kraxel@redhat.com \
--to=kraxel@redhat.com \
--cc=qemu-devel@nongnu.org \
/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).