* [Qemu-devel] [PATCH] usb-hid: activate usb tablet / mouse after migration.
@ 2011-10-12 11:30 Gerd Hoffmann
2011-10-13 2:09 ` TeLeMan
0 siblings, 1 reply; 7+ messages in thread
From: Gerd Hoffmann @ 2011-10-12 11:30 UTC (permalink / raw)
To: qemu-devel; +Cc: Gerd Hoffmann
qemu uses the ps/2 mouse by default. The usb tablet (or mouse) is
activated as soon as qemu sees some guest activity on the device,
i.e. polling for HID events. That used to work fine for both fresh
boot and migration.
Remote wakeup support changed the picture though: There will be no
polling after migration in case the guest suspended the usb bus,
waiting for wakeup events. Result is that the ps/2 mouse stays
active.
Fix this by activating the usb tablet / mouse in post_load() in case
the guest enabled remote wakeup.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
hw/usb-hid.c | 11 +++++++++++
1 files changed, 11 insertions(+), 0 deletions(-)
diff --git a/hw/usb-hid.c b/hw/usb-hid.c
index 7c564b6..997f828 100644
--- a/hw/usb-hid.c
+++ b/hw/usb-hid.c
@@ -520,10 +520,21 @@ static int usb_keyboard_initfn(USBDevice *dev)
return usb_hid_initfn(dev, HID_KEYBOARD);
}
+static int usb_ptr_post_load(void *opaque, int version_id)
+{
+ USBHIDState *s = opaque;
+
+ if (s->dev.remote_wakeup) {
+ hid_pointer_activate(&s->hid);
+ }
+ return 0;
+}
+
static const VMStateDescription vmstate_usb_ptr = {
.name = "usb-ptr",
.version_id = 1,
.minimum_version_id = 1,
+ .post_load = usb_ptr_post_load,
.fields = (VMStateField []) {
VMSTATE_USB_DEVICE(dev, USBHIDState),
VMSTATE_HID_POINTER_DEVICE(hid, USBHIDState),
--
1.7.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [Qemu-devel] [PATCH] usb-hid: activate usb tablet / mouse after migration.
2011-10-12 11:30 [Qemu-devel] [PATCH] usb-hid: activate usb tablet / mouse after migration Gerd Hoffmann
@ 2011-10-13 2:09 ` TeLeMan
2011-10-13 10:48 ` Gerd Hoffmann
0 siblings, 1 reply; 7+ messages in thread
From: TeLeMan @ 2011-10-13 2:09 UTC (permalink / raw)
To: Gerd Hoffmann; +Cc: qemu-devel
On Wed, Oct 12, 2011 at 19:30, Gerd Hoffmann <kraxel@redhat.com> wrote:
> qemu uses the ps/2 mouse by default. The usb tablet (or mouse) is
> activated as soon as qemu sees some guest activity on the device,
> i.e. polling for HID events. That used to work fine for both fresh
> boot and migration.
It does not fix usb tablet/mouse when starting vm directly from snapshot.
> Remote wakeup support changed the picture though: There will be no
> polling after migration in case the guest suspended the usb bus,
> waiting for wakeup events. Result is that the ps/2 mouse stays
> active.
>
> Fix this by activating the usb tablet / mouse in post_load() in case
> the guest enabled remote wakeup.
>
> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
> ---
> hw/usb-hid.c | 11 +++++++++++
> 1 files changed, 11 insertions(+), 0 deletions(-)
>
> diff --git a/hw/usb-hid.c b/hw/usb-hid.c
> index 7c564b6..997f828 100644
> --- a/hw/usb-hid.c
> +++ b/hw/usb-hid.c
> @@ -520,10 +520,21 @@ static int usb_keyboard_initfn(USBDevice *dev)
> return usb_hid_initfn(dev, HID_KEYBOARD);
> }
>
> +static int usb_ptr_post_load(void *opaque, int version_id)
> +{
> + USBHIDState *s = opaque;
> +
> + if (s->dev.remote_wakeup) {
> + hid_pointer_activate(&s->hid);
> + }
> + return 0;
> +}
> +
> static const VMStateDescription vmstate_usb_ptr = {
> .name = "usb-ptr",
> .version_id = 1,
> .minimum_version_id = 1,
> + .post_load = usb_ptr_post_load,
> .fields = (VMStateField []) {
> VMSTATE_USB_DEVICE(dev, USBHIDState),
> VMSTATE_HID_POINTER_DEVICE(hid, USBHIDState),
> --
> 1.7.1
>
>
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [Qemu-devel] [PATCH] usb-hid: activate usb tablet / mouse after migration.
2011-10-13 2:09 ` TeLeMan
@ 2011-10-13 10:48 ` Gerd Hoffmann
2011-10-16 8:54 ` TeLeMan
0 siblings, 1 reply; 7+ messages in thread
From: Gerd Hoffmann @ 2011-10-13 10:48 UTC (permalink / raw)
To: TeLeMan; +Cc: qemu-devel
On 10/13/11 04:09, TeLeMan wrote:
> On Wed, Oct 12, 2011 at 19:30, Gerd Hoffmann<kraxel@redhat.com> wrote:
>> qemu uses the ps/2 mouse by default. The usb tablet (or mouse) is
>> activated as soon as qemu sees some guest activity on the device,
>> i.e. polling for HID events. That used to work fine for both fresh
>> boot and migration.
> It does not fix usb tablet/mouse when starting vm directly from snapshot.
What does "info mice" print before/after snapshotting?
Which guest? WinXP IIRC?
cheers,
Gerd
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [Qemu-devel] [PATCH] usb-hid: activate usb tablet / mouse after migration.
2011-10-13 10:48 ` Gerd Hoffmann
@ 2011-10-16 8:54 ` TeLeMan
2011-10-21 9:22 ` Gerd Hoffmann
2012-02-21 16:25 ` Peter Lieven
0 siblings, 2 replies; 7+ messages in thread
From: TeLeMan @ 2011-10-16 8:54 UTC (permalink / raw)
To: Gerd Hoffmann; +Cc: qemu-devel
On Thu, Oct 13, 2011 at 18:48, Gerd Hoffmann <kraxel@redhat.com> wrote:
> On 10/13/11 04:09, TeLeMan wrote:
>>
>> On Wed, Oct 12, 2011 at 19:30, Gerd Hoffmann<kraxel@redhat.com> wrote:
>>>
>>> qemu uses the ps/2 mouse by default. The usb tablet (or mouse) is
>>> activated as soon as qemu sees some guest activity on the device,
>>> i.e. polling for HID events. That used to work fine for both fresh
>>> boot and migration.
>>
>> It does not fix usb tablet/mouse when starting vm directly from snapshot.
>
> What does "info mice" print before/after snapshotting?
> Which guest? WinXP IIRC?
Yes, the guest is WinXP.
Original:
* Mouse #1: QEMU HID Tablet (absolute)
Mouse #0: QEMU PS/2 Mouse
Start from the snapshot:
* Mouse #0: QEMU PS/2 Mouse
Mouse #1: QEMU HID Tablet (absolute)
The active mouse device is not be saved into the snapshot.
> cheers,
> Gerd
>
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [Qemu-devel] [PATCH] usb-hid: activate usb tablet / mouse after migration.
2011-10-16 8:54 ` TeLeMan
@ 2011-10-21 9:22 ` Gerd Hoffmann
2012-02-20 10:42 ` Peter Lieven
2012-02-21 16:25 ` Peter Lieven
1 sibling, 1 reply; 7+ messages in thread
From: Gerd Hoffmann @ 2011-10-21 9:22 UTC (permalink / raw)
To: TeLeMan; +Cc: qemu-devel
Hi,
> Original:
> * Mouse #1: QEMU HID Tablet (absolute)
> Mouse #0: QEMU PS/2 Mouse
>
> Start from the snapshot:
> * Mouse #0: QEMU PS/2 Mouse
> Mouse #1: QEMU HID Tablet (absolute)
>
> The active mouse device is not be saved into the snapshot.
That shouldn't hurt though. When the guest polls the tablet the first
time after starting from snapshot should activate it. In case it the
guest doesn't pull because the guest activated remote wakeup and
suspended the device we now (with the patch) activate it too.
It also doesn't reproduce here. /me wonders what is going on ...
What does 'info usb' print before and after snapshotting?
Can you also post the full qemu command line?
thanks,
Gerd
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [Qemu-devel] [PATCH] usb-hid: activate usb tablet / mouse after migration.
2011-10-21 9:22 ` Gerd Hoffmann
@ 2012-02-20 10:42 ` Peter Lieven
0 siblings, 0 replies; 7+ messages in thread
From: Peter Lieven @ 2012-02-20 10:42 UTC (permalink / raw)
To: qemu-devel
On 21.10.2011 11:22, Gerd Hoffmann wrote:
> Hi,
>
>> Original:
>> * Mouse #1: QEMU HID Tablet (absolute)
>> Mouse #0: QEMU PS/2 Mouse
>>
>> Start from the snapshot:
>> * Mouse #0: QEMU PS/2 Mouse
>> Mouse #1: QEMU HID Tablet (absolute)
>>
>> The active mouse device is not be saved into the snapshot.
> That shouldn't hurt though. When the guest polls the tablet the first
> time after starting from snapshot should activate it. In case it the
> guest doesn't pull because the guest activated remote wakeup and
> suspended the device we now (with the patch) activate it too.
>
> It also doesn't reproduce here. /me wonders what is going on ...
>
> What does 'info usb' print before and after snapshotting?
> Can you also post the full qemu command line?
I see the same issue here, but not in my case it happens when migrating
a VM.
Before migration:
(qemu) info usb
info usb
Device 0.1, Port 1, Speed 12 Mb/s, Product QEMU USB Tablet
(qemu) info mice
info mice
Mouse #0: QEMU PS/2 Mouse
* Mouse #1: QEMU HID Tablet (absolute)
After migration:
(qemu) info usb
info usb
Device 0.1, Port 1, Speed 12 Mb/s, Product QEMU USB Tablet
(qemu) info mice
info mice
Mouse #1: QEMU HID Tablet (absolute)
* Mouse #0: QEMU PS/2 Mouse
It seems the USB Tablet is not activated again. I can get it working by
manually aktivating and deactivating the USB Hub in Windows Device Manager.
The guest is Windows7 32-bit.
cmdline:
/usr/bin/qemu-kvm-1.0 -net
tap,vlan=141,script=no,downscript=no,ifname=tap0 -net
nic,vlan=141,model=e1000,macaddr=52:54:00:ff:00:d3 -drive
format=host_device,file=/dev/mapper/iqn.2001-05.com.equallogic:0-8a0906-eeef4e007-a8a9f3818674f2fc-lieven-windows7-r80788,if=virtio,cache=writethrough,aio=native
-m 2048 -monitor tcp:0:4001,server,nowait -vnc :1 -name lieven-win7
-boot order=dc,menu=off -k de -pidfile /var/run/qemu/vm-187.pid -rtc
base=localtime -vga std -usb -usbdevice tablet -cpu host
Thanks,
Peter
> thanks,
> Gerd
>
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [Qemu-devel] [PATCH] usb-hid: activate usb tablet / mouse after migration.
2011-10-16 8:54 ` TeLeMan
2011-10-21 9:22 ` Gerd Hoffmann
@ 2012-02-21 16:25 ` Peter Lieven
1 sibling, 0 replies; 7+ messages in thread
From: Peter Lieven @ 2012-02-21 16:25 UTC (permalink / raw)
To: qemu-devel
On 16.10.2011 10:54, TeLeMan wrote:
> On Thu, Oct 13, 2011 at 18:48, Gerd Hoffmann<kraxel@redhat.com> wrote:
>> On 10/13/11 04:09, TeLeMan wrote:
>>> On Wed, Oct 12, 2011 at 19:30, Gerd Hoffmann<kraxel@redhat.com> wrote:
>>>> qemu uses the ps/2 mouse by default. The usb tablet (or mouse) is
>>>> activated as soon as qemu sees some guest activity on the device,
>>>> i.e. polling for HID events. That used to work fine for both fresh
>>>> boot and migration.
>>> It does not fix usb tablet/mouse when starting vm directly from snapshot.
>> What does "info mice" print before/after snapshotting?
>> Which guest? WinXP IIRC?
> Yes, the guest is WinXP.
>
> Original:
> * Mouse #1: QEMU HID Tablet (absolute)
> Mouse #0: QEMU PS/2 Mouse
>
> Start from the snapshot:
> * Mouse #0: QEMU PS/2 Mouse
> Mouse #1: QEMU HID Tablet (absolute)
>
> The active mouse device is not be saved into the snapshot.
it seems that the active mouse event receiver is messed up up after
loading a vm.
if you issue a 'mouse_set 1' in the qemu monitor the tablet should work
again.
can someone who is more familiar with the loadvm code check if the
devices are just added in wrong order?
thanks
peter
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2012-02-21 16:25 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-10-12 11:30 [Qemu-devel] [PATCH] usb-hid: activate usb tablet / mouse after migration Gerd Hoffmann
2011-10-13 2:09 ` TeLeMan
2011-10-13 10:48 ` Gerd Hoffmann
2011-10-16 8:54 ` TeLeMan
2011-10-21 9:22 ` Gerd Hoffmann
2012-02-20 10:42 ` Peter Lieven
2012-02-21 16:25 ` Peter Lieven
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).