Improve mouse tracking in a Virtual Machine Manager (virt-manager)
Incorrect mouse movement in a Linux virtual machine can be fixed in two ways:
- Switch from the VNC console to an SDL console. However, SDL in virt-manager does not work very well: closing the SDL console also shuts down the virtual machine. -*-
- Change the configuration from a virtual mouse to a virtual tablet. This article covers that method.
Changing the configuration through the GUI
- Open Virtual Machine Manager (virt-manager). If the virtual machine is running, shut it down first.
- In virt-manager, click details in the hardware tab.
- Click add to add new hardware. Select Input Device and click Forward.
- Select EvTouch USB Graphics Tablet and click Forward.
- Click Finish.
Changing the configuration in text mode
If you prefer editing in text mode, follow these steps:
- Edit /etc/xen/virtual-machine-name
ทำการเพิ่ม usbdevice = 'tablet' เข้าไปในไฟล์/etc/xen/virtual-machine-name - Start the virtual machine.
- After it boots, press CTRL-ALT-F1 to switch the console to text mode.
- Enter init 3 to switch entirely to text mode.
- Enter the command below to check whether the required tablet name is present:
[root@ezylinux ~]# egrep 'Name|Handlers' /proc/bus/input/devices | grep -i -A 1 tablet N: Name="QEMU 0.8.2 QEMU USB Tablet" H: Handlers=mouse1 event2 js0
- Edit /etc/X11/xorg.conf, find the ServerLayout section, and add the InputDevice line shown below. This adds an input device named Mouse1 to the system.
Section "ServerLayout" ... ... InputDevice "Mouse1" "CorePointer" EndSection
- Add the InputDevice section below to the same file to configure Mouse1.
Section "InputDevice" Identifier "Mouse1" Driver "evdev" Option "Device" "/dev/input/event2" Option "Name" "QEMU 0.8.2 QEMU USB Tablet" Option "Mode" "Absolute" EndSection
- Once editing is complete, return to GUI mode by entering:
[root@ezylinux ~]# init 5; exit
Try moving the mouse to check whether it tracks correctly. :)