2

I am running a SLES 9.0 guest on Centos Stream through Qemu/KVM.

Before going into the details: there is no possibility for me to upgrade the guest. It is running a dedicated hardware which only supports this kernel version (2.4.21).

SLES 9.0 sadly has no built-in support for the EvTouch USB tablet provided through Qemu. I googled a bit and found an open-source evtouch driver from Kenan Esau (http://www.stz-softwaretechnik.de/~ke/touchscreen/evtouch.html or http://www.conan.de/touchscreen/evtouch.html used to be one source...). The webpages are down, but the internet archive has copies of the first url which still contain the tarballs. This way I managed to get the precompiled and src packages of all versions except v0.87 for which I only found the sources.

I am trying to get the driver to work to support absolute pointing in the guest, which I need when connecting to the host via VNC. Without the table driver I cannot use the mouse in the guest over VNC (actually xrdp, but that doesn't matter).

---------------- UPDATE---------------

What have I've tried: Originally SLES 9.0 came with XFree4.3.0.1. Installing the driver via xmkmf -a was missing XFree source files, so I was forced to get sources. The sources for 4.3.0 however did not contain all files that the driver tried to include. Of the precompiled drivers I only managed to load the v0.8 version, however it wasn't working as the cursor remained stuck. There was no error in /var/log/XF86Free.0.log.

Hence I decided to upgrade XFree from the binaries of the Xfree ftp server (there were no respective packages for SLES 9). This worked wonderfully and now I have XFree 4.4.0. Also, I now downloaded the 4.4.0 sources and tried to compile the driver myself.

After adding some additional include paths and copying 3 .def files and /usr/bin/revpath to the paths where make expected them I was in fact able to compile v0.8.0!! XFree86.0.log now correctly mentions the driver being loaded and also that it was compiled for XFree4.4.0. The behavior however is the same as for the pre-compiled v0.8.0 - no error message, mouse not moving.

Interestingly, by copying the Imake-file I to the v0.8.8 sources and adding one further include (+ adapting the list of .c files), I even managed to compile the newest version for my device, but: SAME.

Skimming through the INSTALl file, I saw that I can also compile using DEBUG=y and LOG=y. I did this and now I got at least some info in the /var/log/XFree86.0.log. The relevant parts of the file are below:

(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

Changes to 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

for 0.8.8 to compile also:

SRCS1 = evtouch.c libtouch.c
OBJS1 = evtouch.o libtouch.o

The make output is:

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 .

I should mention that v0.8.8 had a syntax error in its C-code in line 676, which I changed as follows (based on the driver code of 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 reports at its end:

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

The error message is: (EE) touchscreen: Unable to grab device (Invalid argument). Sadly there is no info about which argument is actually invalid. Checking the code in evtouch.c, I see that the error is raised at the following instance of the DeviceOn function:

if (ioctl(local->fd, EVIOCGRAB, (void *)1))
    xf86Msg(X_ERROR, "%s: Unable to grab device (%s).\n", local->name, strerror(errno));

where EVIOCGRAB is defined as:

#ifndef EVIOCGRAB
#define EVIOCGRAB _IOW('E', 0x90, int)
#endif

This sounds to me like some of the options in local->fd cannot be applied via ioctl. However I am starting to believe that there is some issue with the device presented to the guest, such that it cannot be grabbed properly...

How to get this thing running?

3
  • I think I can rule out that my codefix is the issue. I tried two further things: 1) Building v0.8.7 of the driver which has no code error -> also reports invalid argument in XFree86.0.log. v0.86 does not report this and silently fails (as do all prior versions). Also, I adapted the makefile and removed the -pedantic -ansi flags when compiling to get rid of the C99, etc. warnings. This also had no impact. I am a bit out of ideas now.
    – Elarion
    Oct 14, 2022 at 7:47
  • More general thinking: was the Evtouch emulation updated in some qemu version and is now incompatible with the driver? I am running qemu version 7.0.0 (qemu-7.0.0-2.el8). Could I revert this specific device only? Also I read about a vmmouse device, but this is not accepted by libvirt if I alter the xmls... Was this removed? I've read it being an absolute ps2 device introduced with qemu 0.9.1...
    – Elarion
    Oct 14, 2022 at 7:50
  • The invalid argument starts to appear with v0.8.7 and doesn't arise in prior versions, so it may just be a property not supported by XFree86 which is set from v0.8.7 onwards. From my understanding, also without proper drivers I should be able to see some garbage output in /dev/input/eventX, however it seems like the QEmu tablet isn't captured in any /dev/input/eventX, so there is no way the driver can grab it. This sounds like an incompatibility between device and operating system. How can I test/debug this hypothesis?
    – Elarion
    Oct 19, 2022 at 14:25

1 Answer 1

0

I managed to get absolute pointer support in SLES9 using kernel 2.4, but have not been able to do so with Evtouch.

I found a solution here, in the section "No EvTouch USB Tablet with very old Linux". The starts with "I was able to compile EvTouch but the EvTouch tablet get detected as an "HID" (Human Interface Device)", however the hid driver does not recognize it.

I first tried launching SLES with boot parameter to encourage usbhid to ignore it:

usbhid.quirk=0x672:0x0001:0x4

It did not work. The page mentions evtouch, vmmouse, and the wacom tablet. I looked into this, there is a wacom.o in the /usr/X11R6/lib/module/input directory. That gave me hope the 2.4 kernel is compatible with wacom devices.

The following changes were required to get the wacom working:

  • In virt-manager overview, change the first line to:

    <domain type='kvm' xmlns:qemu='http://libvirt.org/schemas/domain/qemu/1.0'>
    
  • Add the following to the bottom:

    <qemu:commandline>
        <qemu:arg value='-usb'/>
        <qemu:arg value='-device'/>
        <qemu:arg value='usb-wacom-tablet'/>
    </qemu:commandline>
    

Note the additional -usb here, which the link does not mentioned.

In the guest, I saw garbage output on /dev/input/event0 when X was stopped (boot with init 3).
This required a change to a /etc/X11/XFree86 setting:

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

The link also had changes to ServerLayout, but use these changes instead:

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

Using these settings seems to work well.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .