Virtualization

Improve mouse tracking in a Virtual Machine Manager (virt-manager)

Incorrect mouse movement in a Linux virtual machine can be fixed in two ways:

  1. 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. -*-
  2. Change the configuration from a virtual mouse to a virtual tablet. This article covers that method.

Changing the configuration through the GUI

  1. Open Virtual Machine Manager (virt-manager). If the virtual machine is running, shut it down first.
  2. In virt-manager, click details in the hardware tab.
  3. Click add to add new hardware. Select Input Device and click Forward.
  4. Select EvTouch USB Graphics Tablet and click Forward.
  5. Click Finish.

Changing the configuration in text mode

If you prefer editing in text mode, follow these steps:

  1. Edit /etc/xen/virtual-machine-name ทำการเพิ่ม usbdevice = 'tablet' เข้าไปในไฟล์ /etc/xen/virtual-machine-name
  2. Start the virtual machine.
  3. After it boots, press CTRL-ALT-F1 to switch the console to text mode.
  4. Enter init 3 to switch entirely to text mode.
  5. 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
  1. 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
  1. 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
  1. 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. :)

EOF.← Back to articles