我正在通过 Qemu/KVM 在 Centos Stream 上运行 SLES 9.0 来宾。
在详细说明之前:我不可能升级客人。它运行的是仅支持此内核版本(2.4.21)的专用硬件。
遗憾的是,SLES 9.0 没有对通过 Qemu 提供的 EvTouch USB 平板电脑的内置支持。我用谷歌搜索了一下,发现了来自 Kenan Esau 的开源 evtouch 驱动程序(http://www.stz-softwaretechnik.de/~ke/touchscreen/evtouch.html或者http://www.conan.de/touchscreen/evtouch.html曾经是一个来源......)。网页已关闭,但互联网档案馆拥有第一个网址的副本,其中仍包含 tarball。这样我就成功获得了除 v0.87 之外的所有版本的预编译包和 src 包,v0.87 只找到了源代码。
我正在尝试让驱动程序支持来宾中的绝对指向,这是通过 VNC 连接到主机时需要的。如果没有表驱动程序,我无法通过 VNC 在来宾中使用鼠标(实际上是 xrdp,但这并不重要)。
- - - - - - - - 更新 - - - - - - - -
我已经尝试过:最初SLES 9.0附带XFree4.3.0.1。通过 xmkmf -a 安装驱动程序缺少 XFree 源文件,因此我被迫获取源文件。然而,4.3.0 的源代码并不包含驱动程序尝试包含的所有文件。在预编译的驱动程序中,我只成功加载了 v0.8 版本,但它无法工作,因为光标仍然卡住。 /var/log/XF86Free.0.log 中没有错误。
因此,我决定从 Xfree ftp 服务器的二进制文件升级 XFree(SLES 9 没有相应的软件包)。这非常有效,现在我有了 XFree 4.4.0。另外,我现在下载了 4.4.0 源代码并尝试自己编译驱动程序。
添加一些额外的包含路径并将 3 个 .def 文件和 /usr/bin/revpath 复制到 make 期望的路径后,我实际上能够编译 v0.8.0! XFree86.0.log 现在正确地提到了正在加载的驱动程序,并且它是为 XFree4.4.0 编译的。然而,行为与预编译的 v0.8.0 相同 - 没有错误消息,鼠标不移动。
有趣的是,通过将 Imake 文件 I 复制到 v0.8.8 源并添加进一步的包含(+ 调整 .c 文件列表),我什至设法为我的设备编译最新版本,但是:相同。
浏览 INSTALl 文件,我发现我还可以使用 DEBUG=y 和 LOG=y 进行编译。我这样做了,现在我至少在 /var/log/XFree86.0.log 中获得了一些信息。文件的相关部分如下:
(II) Module evtouch: vendor="Kenan Esau"
compiled for 4.4.0, module version = 0.8.8
Module class: XFree86 XInput Driver
ABI class: XFree86 XInput driver, version 0.4
EVTouch: EVTouchPreInit
State: S_UNTOUCHED Action: No Action Button: 0
State: S_TOUCHED Action: No Action Button: 0
State: S_LONGTOUCHED Action: down Button: 1
State: S_MOVING Action: No Action Button: 0
State: S_MAYBETAPPED Action: click Button: 1
State: S_ONEANDAHALFTAP Action: down Button: 3
(**) Option "MinX" "0"
(**) Option "MaxX" "32767"
(**) Option "MinY" "0"
(**) Option "MaxY" "32767"
(**) Option "Emulate3Buttons"
(**) Option "Emulate3Timeout" "50"
(diff[0][0]/diff[0][1])=(0/0)
(diff[1][0]/diff[1][1])=(0/0)
(diff[2][0]/diff[2][1])=(0/0)
(diff[3][0]/diff[3][1])=(0/0)
(diff[4][0]/diff[4][1])=(0/0)
(diff[5][0]/diff[5][1])=(0/0)
(diff[6][0]/diff[6][1])=(0/0)
(diff[7][0]/diff[7][1])=(0/0)
(diff[8][0]/diff[8][1])=(0/0)
(**) Option "DeviceName" "touchscreen"
(**) Option "SendCoreEvents"
(**) touchscreen: always reports core events
(**) Option "CorePointer"
(**) touchscreen: Core Pointer
(**) Option "Protocol" "imps/2"
(**) Mouse[1]: Device: "/dev/mouse"
(**) Mouse[1]: Protocol: "imps/2"
(**) Option "CorePointer" "False"
(**) Option "Device" "/dev/mouse"
(**) Option "Buttons" "5"
(**) Mouse[1]: Emulate3Buttons, Emulate3Timeout: 50
(**) Option "ZAxisMapping" "4 5"
(**) Mouse[1]: ZAxisMapping: buttons 4 and 5
(**) Mouse[1]: Buttons: 5
(II) XINPUT: Adding extended input device "Mouse[1]" (type: MOUSE)
(II) XINPUT: Adding extended input device "touchscreen" (type: TOUCHSCREEN)
EVTouch: DeviceInit
EVTouch: Display X,Y: 1920 910
EVTouch: Virtual X,Y: 1920 910
EVTouch: DriverName, Rev.: vmware 657922
EVTouch: Viewport X0,Y0: 0 0
EVTouch: Viewport X1,Y1: 1919 909
EVTouch: MaxValue H,V: 0 0
EVTouch: DeviceInit btn_count=5
EVTouch: DeviceInit btn_count=5
(**) Option "Device" "/dev/input/event0"
EVTouch: DeviceOn
EVTouch: QueryHardware
(EE) touchscreen: Unable to grab device (Invalid argument).
EVTouch: DeviceOff
对 Imakefile 的更改
XFREE_TOP = /home/kmf/Desktop/xc
#INCLUDES = -I. -I$(XF86COMSRC) -I$(XF86SRC)/loader -I/home/kmf/Desktop/xc/programs/Xserver/hw/xfree86 \
# -I$(SERVERSRC)/include -I$(SERVERSRC) -I$(XINCLUDESRC) -I$(EXTINCSRC) -I/home/kmf/Desktop/xc/include
INCLUDES = -I. -I$(XFREE_TOP)/programs/Xserver/hw/xfree86/common \
-I$(XFREE_TOP)/programs/Xserver/hw/xfree86/loader \
-I$(XFREE_TOP)/programs/Xserver/hw/xfree86/os-support \
-I$(XFREE_TOP)/programs/Xserver/hw/xfree86/os-support/bus \
-I$(XFREE_TOP)/programs/Xserver/hw/xfree86/xf86cfg \
-I$(XFREE_TOP)/programs/Xserver/randr \
-I$(XFREE_TOP)/include \
-I$(XFREE_TOP)/programs/Xserver/include \
-I$(XFREE_TOP)/programs/Xserver/hw/xfree86 \
-I$(XFREE_TOP)/exports/include/X11 -I$(XFREE_TOP)/include/extensions \
-I/usr/X11R6/include
对于 0.8.8 也可以编译:
SRCS1 = evtouch.c libtouch.c
OBJS1 = evtouch.o libtouch.o
make 输出为:
rm -f ev_calibrate.o
gcc -m32 -O2 -fno-strength-reduce -fno-strict-aliasing -ansi -pedantic -Wall -Wpointer-arith -Wundef -fno-merge-constants -I. -I/home/kmf/Desktop/xc/programs/Xserver/hw/xfree86/common -I/home/kmf/Desktop/xc/programs/Xserver/hw/xfree86/loader -I/home/kmf/Desktop/xc/programs/Xserver/hw/xfree86/os-support -I/home/kmf/Desktop/xc/programs/Xserver/hw/xfree86/os-support/bus -I/home/kmf/Desktop/xc/programs/Xserver/hw/xfree86/xf86cfg -I/home/kmf/Desktop/xc/programs/Xserver/randr -I/home/kmf/Desktop/xc/include -I/home/kmf/Desktop/xc/programs/Xserver/include -I/home/kmf/Desktop/xc/programs/Xserver/hw/xfree86 -I/home/kmf/Desktop/xc/exports/include/X11 -I/home/kmf/Desktop/xc/include/extensions -I/usr/X11R6/include -I/home/kmf/Desktop/xc -I/home/kmf/Desktop/xc/exports/include -Dlinux -D__i386__ -D_POSIX_C_SOURCE=199309L -D_POSIX_SOURCE -D_XOPEN_SOURCE -D_BSD_SOURCE -D_SVID_SOURCE -D_GNU_SOURCE -DSHAPE -DXINPUT -DXKB -DLBX -DXAPPGROUP -DXCSECURITY -DTOGCUP -DXF86BIGFONT -DDPMSExtension -DPIXPRIV -DPANORAMIX -DRENDER -DRANDR -DGCCUSESGAS -DAVOID_GLYPHBLT -DPIXPRIV -DSINGLEDEPTH -DXFreeXDGA -DXvExtension -DXFree86LOADER -DXFree86Server -DXF86VIDMODE -DXvMCExtension -DSMART_SCHEDULE -DBUILDDEBUG -DXResExtension -DX_BYTE_ORDER=X_LITTLE_ENDIAN -DNDEBUG -DFUNCPROTO=15 -DNARROWPROTO -DIN_MODULE -DXFree86Module -ggdb -DEVDBG -c ev_calibrate.c
ev_calibrate.c: In function `main':
ev_calibrate.c:185: warning: ISO C90 forbids variable-size array `xy_ring_buf'
ev_calibrate.c:357: warning: ordered comparison of pointer with integer zero
ev_calibrate.c:401: warning: ISO C forbids passing arg 3 of `pthread_create' between function pointer and `void *'
ev_calibrate.c:181: warning: unused variable `p_mtx_attr'
rm -f ev_calibrate
gcc -m32 -o ev_calibrate -O2 -fno-strength-reduce -fno-strict-aliasing -ansi -pedantic -Wall -Wpointer-arith -Wundef -L/home/kmf/Desktop/xc/exports/lib ev_calibrate.o -lXaw -lXmu -lXt -lSM -lICE -lXpm -lXext -lX11 -lpthread -L/usr/X11R6/lib -Wl,-rpath-link,/home/kmf/Desktop/xc/exports/lib
rm -f evtouch.o
gcc -m32 -O2 -fno-strength-reduce -fno-strict-aliasing -ansi -pedantic -Wall -Wpointer-arith -Wundef -fno-merge-constants -I. -I/home/kmf/Desktop/xc/programs/Xserver/hw/xfree86/common -I/home/kmf/Desktop/xc/programs/Xserver/hw/xfree86/loader -I/home/kmf/Desktop/xc/programs/Xserver/hw/xfree86/os-support -I/home/kmf/Desktop/xc/programs/Xserver/hw/xfree86/os-support/bus -I/home/kmf/Desktop/xc/programs/Xserver/hw/xfree86/xf86cfg -I/home/kmf/Desktop/xc/programs/Xserver/randr -I/home/kmf/Desktop/xc/include -I/home/kmf/Desktop/xc/programs/Xserver/include -I/home/kmf/Desktop/xc/programs/Xserver/hw/xfree86 -I/home/kmf/Desktop/xc/exports/include/X11 -I/home/kmf/Desktop/xc/include/extensions -I/usr/X11R6/include -I/home/kmf/Desktop/xc -I/home/kmf/Desktop/xc/exports/include -Dlinux -D__i386__ -D_POSIX_C_SOURCE=199309L -D_POSIX_SOURCE -D_XOPEN_SOURCE -D_BSD_SOURCE -D_SVID_SOURCE -D_GNU_SOURCE -DSHAPE -DXINPUT -DXKB -DLBX -DXAPPGROUP -DXCSECURITY -DTOGCUP -DXF86BIGFONT -DDPMSExtension -DPIXPRIV -DPANORAMIX -DRENDER -DRANDR -DGCCUSESGAS -DAVOID_GLYPHBLT -DPIXPRIV -DSINGLEDEPTH -DXFreeXDGA -DXvExtension -DXFree86LOADER -DXFree86Server -DXF86VIDMODE -DXvMCExtension -DSMART_SCHEDULE -DBUILDDEBUG -DXResExtension -DX_BYTE_ORDER=X_LITTLE_ENDIAN -DNDEBUG -DFUNCPROTO=15 -DNARROWPROTO -DIN_MODULE -DXFree86Module -ggdb -DEVDBG -c evtouch.c
evtouch.c:84:1: warning: "DBG" redefined
In file included from evtouch.c:75:
/home/kmf/Desktop/xc/programs/Xserver/hw/xfree86/common/xf86Xinput.h:113:1: warning: this is the location of the previous definition
In file included from evtouch.c:95:
evtouch.h:33:21: warning: anonymous variadic macros were introduced in C99
evtouch.c: In function `emulate3Timer':
evtouch.c:201: warning: ISO C89 forbids mixed declarations and code
evtouch.c: In function `EVTouchProcessRel':
evtouch.c:355: warning: unused variable `dummy'
evtouch.c: In function `DeviceInit':
evtouch.c:590: warning: ISO C89 forbids mixed declarations and code
evtouch.c:605: warning: ISO C89 forbids mixed declarations and code
evtouch.c: In function `ReadInput':
evtouch.c:810: warning: `0' flag ignored with precision and `%x' printf format
evtouch.c:810: warning: `0' flag ignored with precision and `%x' printf format
evtouch.c: In function `ConvertProc':
evtouch.c:923: warning: ISO C89 forbids mixed declarations and code
evtouch.c:937: warning: implicit declaration of function `RRGetRotation'
evtouch.c:1080: warning: ISO C89 forbids mixed declarations and code
/home/kmf/Desktop/xc/programs/Xserver/hw/xfree86/common/compiler.h: At top level:
evtouch.c:753: warning: `EVTouchRead' defined but not used
rm -f libtouch.o
gcc -m32 -O2 -fno-strength-reduce -fno-strict-aliasing -ansi -pedantic -Wall -Wpointer-arith -Wundef -fno-merge-constants -I. -I/home/kmf/Desktop/xc/programs/Xserver/hw/xfree86/common -I/home/kmf/Desktop/xc/programs/Xserver/hw/xfree86/loader -I/home/kmf/Desktop/xc/programs/Xserver/hw/xfree86/os-support -I/home/kmf/Desktop/xc/programs/Xserver/hw/xfree86/os-support/bus -I/home/kmf/Desktop/xc/programs/Xserver/hw/xfree86/xf86cfg -I/home/kmf/Desktop/xc/programs/Xserver/randr -I/home/kmf/Desktop/xc/include -I/home/kmf/Desktop/xc/programs/Xserver/include -I/home/kmf/Desktop/xc/programs/Xserver/hw/xfree86 -I/home/kmf/Desktop/xc/exports/include/X11 -I/home/kmf/Desktop/xc/include/extensions -I/usr/X11R6/include -I/home/kmf/Desktop/xc -I/home/kmf/Desktop/xc/exports/include -Dlinux -D__i386__ -D_POSIX_C_SOURCE=199309L -D_POSIX_SOURCE -D_XOPEN_SOURCE -D_BSD_SOURCE -D_SVID_SOURCE -D_GNU_SOURCE -DSHAPE -DXINPUT -DXKB -DLBX -DXAPPGROUP -DXCSECURITY -DTOGCUP -DXF86BIGFONT -DDPMSExtension -DPIXPRIV -DPANORAMIX -DRENDER -DRANDR -DGCCUSESGAS -DAVOID_GLYPHBLT -DPIXPRIV -DSINGLEDEPTH -DXFreeXDGA -DXvExtension -DXFree86LOADER -DXFree86Server -DXF86VIDMODE -DXvMCExtension -DSMART_SCHEDULE -DBUILDDEBUG -DXResExtension -DX_BYTE_ORDER=X_LITTLE_ENDIAN -DNDEBUG -DFUNCPROTO=15 -DNARROWPROTO -DIN_MODULE -DXFree86Module -ggdb -DEVDBG -c libtouch.c
rm -f evtouch_drv.o
gcc -m32 -nostdlib -r evtouch.o libtouch.o -o evtouch_drv.o
rm -f /home/kmf/Desktop/xc/exports/lib/modules/input/evtouch_drv.o
+ cd /home/kmf/Desktop/xc/exports/lib/modules/input
+ ln -s ../../../..//home/kmf/Desktop/Evtouch/xf86-input-evtouch-0.8.8/evtouch_drv.o .
我应该提到 v0.8.8 在第 676 行的 C 代码中存在语法错误,我对其进行了如下更改(基于 v0.8.6 的驱动程序代码):
#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) == 2
xf86InitValuatorAxisStruct(dev, 0, 0, priv->screen_width,
1024,
EV_AXIS_MIN_RES /* min_res */ ,
EV_AXIS_MAX_RES /* max_res */ );
xf86InitValuatorDefaults(dev, 0);
xf86InitValuatorAxisStruct(dev, 1, 0, priv->screen_height,
1024,
EV_AXIS_MIN_RES /* min_res */ ,
EV_AXIS_MAX_RES /* max_res */ );
xf86InitValuatorDefaults(dev, 1);
#else
xf86InitValuatorAxisStruct(dev, 0, priv->min_x, priv->max_x,
1024, //THIS LINE WAS MISSING
EV_AXIS_MIN_RES /* min_res */ , //THIS LINE WAS MISSING
EV_AXIS_MAX_RES /* max_res */ ); //THIS LINE WAS MISSING
xf86InitValuatorDefaults(dev, 0); //THIS LINE WAS MISSING
InitValuatorAxisStruct (dev, 1, priv->min_y, priv->max_y, //THIS LINE WAS MISSING
1024, //THIS LINE WAS MISSING
EV_AXIS_MIN_RES /* min_res */ , //THIS LINE WAS MISSING
EV_AXIS_MAX_RES /* max_res */ ); //THIS LINE WAS MISSING
xf86InitValuatorDefaults(dev, 1);
#endif
dmesg 在其结尾报告:
input: USB HID v0.01 Mouse [QEMU QEMU USB Tablet] on usb1:2.0
hid-core.c: v1.9.1 Andreas Gal, Vojtech Pavlik <[email protected]>
hid-core.c: USB HID support drivers
mtrr: type mismatch for fa000000,2000000 old: uncachable new: write-combining
错误消息为:(EE) 触摸屏:无法抓取设备(参数无效)。遗憾的是,没有关于哪个参数实际上无效的信息。检查 evtouch.c 中的代码,我发现错误是在 DeviceOn 函数的以下实例中引发的:
if (ioctl(local->fd, EVIOCGRAB, (void *)1))
xf86Msg(X_ERROR, "%s: Unable to grab device (%s).\n", local->name, strerror(errno));
其中 EVIOCGRAB 定义为:
#ifndef EVIOCGRAB
#define EVIOCGRAB _IOW('E', 0x90, int)
#endif
在我看来,local->fd 中的某些选项无法通过 ioctl 应用。然而,我开始相信提供给客人的设备存在一些问题,因此无法正确抓住它......
如何让这个东西运行起来?
答案1
我设法使用内核 2.4 在 SLES9 中获得绝对指针支持,但无法使用 Evtouch 做到这一点。
我找到了一个解决方案在这里,在“非常旧的 Linux 上没有 EvTouch USB 平板电脑”部分。开头是“我能够编译 EvTouch,但 EvTouch 平板电脑被检测为“HID”(人机接口设备)”,但是 hid 驱动程序无法识别它。
我首先尝试使用启动参数启动 SLES,以鼓励 usbhid 忽略它:
usbhid.quirk=0x672:0x0001:0x4
它不起作用。该页面提到了 evtouch、vmmouse 和 wacom 平板电脑。我查了一下,目录wacom.o
里有一个/usr/X11R6/lib/module/input
。这给了我 2.4 内核与 wacom 设备兼容的希望。
以下变化需要让 wacom 工作:
概述中
virt-manager
,将第一行更改为:<domain type='kvm' xmlns:qemu='http://libvirt.org/schemas/domain/qemu/1.0'>
将以下内容添加到底部:
<qemu:commandline> <qemu:arg value='-usb'/> <qemu:arg value='-device'/> <qemu:arg value='usb-wacom-tablet'/> </qemu:commandline>
请注意此处的附加内容-usb
,该链接未提及。
在来宾中,/dev/input/event0
当 X 停止时(使用 启动init 3
),我看到垃圾输出。
这需要更改设置/etc/X11/XFree86
:
Section "InputDevice"
Identifier "Tablet"
Driver "wacom"
Option "Device" "/dev/input/event0"
Option "DeviceName" "Wacom"
Option "Type" "stylus"
Option "USB" "on"
Option "Mode" "Absolute"
Option "SendCoreEvents"
# Option "AlwaysCore" "On"
# Option "BottomX" "98"
# Option "BottomY" "43"
# Option "TopX" "940"
# Option "TopY" "925"
EndSection
链接也发生了变化ServerLayout
,但请使用以下更改:
Section "ServerLayout"
Identifier "Layout[all]"
InputDevice "Keyboard[0]" "CoreKeyboard"
InputDevice "Tablet" "CorePointer"
Screen "Screen[0]"
Option "Clone" "off"
Option "Xinerama" "off"
# InputDevice "Mouse[1]" "CorePointer"
EndSection
使用这些设置似乎效果很好。