日期:2014-05-16  浏览次数:20761 次

vnc连接linux时出现双鼠标的问题

前文提到过,在虚拟硬件配置中使用绝对定位设备(tablet)取代相对定位设备(mouse)是解决 QEMU VNC 访问 Xen 虚拟机时“双鼠标指针”问题的办法之一。这种办法对于 Windows 和 Ubuntu 虚拟机都有效,无需在虚拟机操作系统内做额外配置。但这对于 CentOS 虚拟机无效,初步判断是 CentOS 没有相应的 tablet 设备驱动。不过经实验发现,CentOS 中已包含相应驱动,只是没有对 X 进行适当的配置。只要对 CentOS 虚拟机进行以下配置,即可使两个鼠标指针同步移动:

  1、确保系统中存在 evdev 驱动模块:/usr/lib/xorg/modules/input/evdev_drv.so(x86_64 系统为 /usr/lib64/xorg/modules/input/evdev_drv.so)。

  2、在 proc 文件系统下查看 QEMU USB Tablet 对应的 event 设备名。在本例中为 event2。

  1. $ cat /proc/bus/input/devices
  2. ?
  3. I: Bus=0003 Vendor=0627 Product=0001 Version=0000
  4. N: Name="QEMU 0.8.2 QEMU USB Tablet"
  5. P: Phys=usb-0000:00:01.3-2/input0
  6. S: Sysfs=/class/input/input2
  7. H: Handlers=mouse1 event2 js0
  8. B: EV=b
  9. B: KEY=70000 0 0 0 0 0 0 0 0
  10. B: ABS=103

  3、修改 xorg.conf,添加一个 InputDevice(本例中命名为“MouseTS”),并将其加入 ServerLayout 段。其中 Device 选项的值参考上一步找到的 event 设备名。

  1. $ vi /etc/X11/xorg.conf
  2. ?
  3. Section "ServerLayout"
  4. ?? ? ? ?Identifier? ? ?"Default Layout"
  5. ?? ? ? ?Screen? ? ? 0? "Screen0" 0 0
  6. ?? ? ? ?InputDevice? ? "Keyboard0" "CoreKeyboard"
  7. ?? ? ? ?InputDevice? ? "MouseTS" "CorePointer"
  8. EndSection
  9. ?
  10. Section "InputDevice"
  11. ?? ? ? ?Identifier? ? ?"MouseTS"
  12. ?? ? ? ?Driver? ? ? ? ?"evdev"
  13. ?? ? ? ?Option? ? ? ? ?"Device" "/dev/input/event2"
  14. ?? ? ? ?Option? ? ? ? ?"DeviceName" "touchscreen"
  15. EndSection

  参考:
  http://thread.gmane.org/gmane.comp.emulators.qemu/11516
  http://forums.opensuse.org/english/get-help-here/hardware/418972-usb-mouse-device-problem.html