Skip to contentSkip to conversation

VMMouse Emulation

PATCH New Anthony Liguori 1 participant 1 message Mar 11, 2007 Kbuild

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 VMMouse Emulation

The following patch implements vmmouse emulation for i386 and x86_64. Xorg has included an open source vmmouse driver since 7.1 and it is available in many distros.

vmmouse supports absolute and relative modes. It's based on a queue that's read through PIO but it still uses the PS2 port for notification.

I've tested i386-softmmu and save/restore. Everything seems to work nicely.

To use it, first install the vmmouse driver. For ubuntu, starting with Edgy, it's xserver-xorg-input-vmmouse in the universe. Then, in your Input section, change the "mouse" driver to "vmmouse".

Regards,

Anthony Liguori

Makefile.target +1 -1
diff -r 5b37ca9b68f9 Makefile.target
@@ -371,7 +371,7 @@ VL_OBJS+= ide.o pckbd.o ps2.o vga.o $(SO
 VL_OBJS+= ide.o pckbd.o ps2.o vga.o $(SOUND_HW) dma.o $(AUDIODRV)
 VL_OBJS+= fdc.o mc146818rtc.o serial.o i8259.o i8254.o pcspk.o pc.o
 VL_OBJS+= cirrus_vga.o mixeng.o apic.o parallel.o acpi.o piix_pci.o
-VL_OBJS+= usb-uhci.o smbus_eeprom.o
+VL_OBJS+= usb-uhci.o smbus_eeprom.o vmmouse.o
 CPPFLAGS += -DHAS_AUDIO
 endif
 ifeq ($(TARGET_BASE_ARCH), ppc)
hw/pckbd.c +3 -0
diff -r 5b37ca9b68f9 hw/pckbd.c
@@ -372,6 +372,9 @@ void i8042_init(int kbd_irq_lvl, int mou
 
     s->kbd = ps2_kbd_init(kbd_update_kbd_irq, s);
     s->mouse = ps2_mouse_init(kbd_update_aux_irq, s);
+#ifdef TARGET_I386
+    vmmouse_init(s->mouse);
+#endif
     qemu_register_reset(kbd_reset, s);
 }
 
hw/ps2.c +5 -0
diff -r 5b37ca9b68f9 hw/ps2.c
@@ -324,6 +324,11 @@ static void ps2_mouse_event(void *opaque
     }
 }
 
+void ps2_mouse_fake_event(void *opaque)
+{
+    ps2_mouse_event(opaque, 1, 0, 0, 0);
+}
+
 void ps2_write_mouse(void *opaque, int val)
 {
     PS2MouseState *s = (PS2MouseState *)opaque;
vl.h +3 -0
diff -r 5b37ca9b68f9 vl.h
@@ -996,6 +996,8 @@ void pcnet_h_reset(void *opaque);
 void pcnet_h_reset(void *opaque);
 void *lance_init(NICInfo *nd, uint32_t leaddr, void *dma_opaque);
 
+/* vmmouse.c */
+void *vmmouse_init(void *m);
 
 /* pckbd.c */
 
@@ -1317,6 +1319,7 @@ uint32_t ps2_read_data(void *);
 uint32_t ps2_read_data(void *);
 void ps2_queue(void *, int b);
 void ps2_keyboard_set_translation(void *opaque, int mode);
+void ps2_mouse_fake_event(void *opaque);
 
 /* smc91c111.c */
 void smc91c111_init(NICInfo *, uint32_t, void *, int);
hw/vmmouse.c new file +300 -0

300 lines not on this page · raw message