[Spice-devel] [PATCH] spice-vmc: add a reset handler used to unregister spice interface (and trigger server mouse)
Alon Levy
alevy at redhat.com
Tue Aug 24 07:39:30 PDT 2010
In the scenario where we already switched to agent mouse, and then reset, there was no indication to the device, and from there to spice, that the guest driver and agent have quit.
This allows us to switch to server side mouse until the agent starts up again. In case the agent doesn't start, we have a working mouse.
---
hw/spice-vmc.c | 9 +++++++++
1 files changed, 9 insertions(+), 0 deletions(-)
diff --git a/hw/spice-vmc.c b/hw/spice-vmc.c
index 2ddecf4..fad3bdd 100644
--- a/hw/spice-vmc.c
+++ b/hw/spice-vmc.c
@@ -172,6 +172,14 @@ static void vmc_have_data(VirtIOSerialPort *port, const uint8_t *buf, size_t len
spice_server_vdi_port_wakeup(&svc->sin);
}
+static void vmc_reset(void *opaque)
+{
+ SpiceVirtualChannel *svc = opaque;
+
+ dprintf(svc, 1, "%s\n", __func__);
+ vmc_unregister_interface(svc);
+}
+
static int vmc_initfn(VirtIOSerialDevice *dev)
{
VirtIOSerialPort *port = DO_UPCAST(VirtIOSerialPort, dev, &dev->qdev);
@@ -185,6 +193,7 @@ static int vmc_initfn(VirtIOSerialDevice *dev)
svc->vmstate = qemu_add_vm_change_state_handler(
vmc_change_state_handler, svc);
virtio_serial_open(port);
+ qemu_register_reset(vmc_reset, svc);
return 0;
}
--
1.7.2
More information about the Spice-devel
mailing list