xfree86: Implement a test input driver
Signed-off-by: Povilas Kanapickas <povilas@radix.lt>
This commit is contained in:
parent
f95d81e88b
commit
8c0afc9eb2
|
@ -585,6 +585,7 @@ AC_ARG_WITH(xwayland-path, AS_HELP_STRING([--with-xwayland-path=PATH], [Director
|
|||
AC_ARG_ENABLE(standalone-xpbproxy, AS_HELP_STRING([--enable-standalone-xpbproxy], [Build a standalone xpbproxy (in addition to the one integrated into Xquartz as a separate thread) (default: no)]), [STANDALONE_XPBPROXY=$enableval], [STANDALONE_XPBPROXY=no])
|
||||
AC_ARG_ENABLE(xwin, AS_HELP_STRING([--enable-xwin], [Build XWin server (default: auto)]), [XWIN=$enableval], [XWIN=auto])
|
||||
AC_ARG_ENABLE(glamor, AS_HELP_STRING([--enable-glamor], [Build glamor dix module (default: auto)]), [GLAMOR=$enableval], [GLAMOR=auto])
|
||||
AC_ARG_ENABLE(xf86-input-inputtest, AS_HELP_STRING([--enable-xf86-input-inputtest], [Build Xorg test input driver (default: yes)]), [XORG_DRIVER_INPUT_INPUTTEST=$enableval], [XORG_DRIVER_INPUT_INPUTTEST=yes])
|
||||
dnl kdrive and its subsystems
|
||||
AC_ARG_ENABLE(kdrive, AS_HELP_STRING([--enable-kdrive], [Build kdrive servers (default: no)]), [KDRIVE=$enableval], [KDRIVE=no])
|
||||
AC_ARG_ENABLE(xephyr, AS_HELP_STRING([--enable-xephyr], [Build the kdrive Xephyr server (default: auto)]), [XEPHYR=$enableval], [XEPHYR=auto])
|
||||
|
@ -2019,6 +2020,7 @@ AM_CONDITIONAL([SOLARIS_VT], [test "x$solaris_vt" = xyes])
|
|||
AM_CONDITIONAL([DGA], [test "x$DGA" = xyes])
|
||||
AM_CONDITIONAL([XORG_BUS_PLATFORM], [test "x$CONFIG_UDEV_KMS" = xyes])
|
||||
AM_CONDITIONAL([XORG_DRIVER_MODESETTING], [test "x$XORG_DRIVER_MODESETTING" = xyes])
|
||||
AM_CONDITIONAL([XORG_DRIVER_INPUT_INPUTTEST], [test "x$XORG_DRIVER_INPUT_INPUTTEST" = xyes])
|
||||
|
||||
dnl glamor
|
||||
if test "x$GLAMOR" = xauto; then
|
||||
|
@ -2458,6 +2460,7 @@ hw/xfree86/dri/Makefile
|
|||
hw/xfree86/dri2/Makefile
|
||||
hw/xfree86/dri2/pci_ids/Makefile
|
||||
hw/xfree86/drivers/Makefile
|
||||
hw/xfree86/drivers/inputtest/Makefile
|
||||
hw/xfree86/drivers/modesetting/Makefile
|
||||
hw/xfree86/exa/Makefile
|
||||
hw/xfree86/exa/man/Makefile
|
||||
|
|
|
@ -3,3 +3,6 @@ SUBDIRS =
|
|||
if XORG_DRIVER_MODESETTING
|
||||
SUBDIRS += modesetting
|
||||
endif
|
||||
if XORG_DRIVER_INPUT_INPUTTEST
|
||||
SUBDIRS += inputtest
|
||||
endif
|
||||
|
|
|
@ -0,0 +1,48 @@
|
|||
# Copyright 2005 Adam Jackson.
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a
|
||||
# copy of this software and associated documentation files (the "Software"),
|
||||
# to deal in the Software without restriction, including without limitation
|
||||
# on the rights to use, copy, modify, merge, publish, distribute, sub
|
||||
# license, and/or sell copies of the Software, and to permit persons to whom
|
||||
# the Software is furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice (including the next
|
||||
# paragraph) shall be included in all copies or substantial portions of the
|
||||
# Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
|
||||
# ADAM JACKSON BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
# IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
# this is obnoxious:
|
||||
# -module lets us name the module exactly how we want
|
||||
# -avoid-version prevents gratuitous .0.0.0 version numbers on the end
|
||||
# _ladir passes a dummy rpath to libtool so the thing will actually link
|
||||
# TODO: -nostdlib/-Bstatic/-lgcc platform magic, not installing the .a, etc.
|
||||
|
||||
include $(top_srcdir)/manpages.am
|
||||
|
||||
AM_CFLAGS = $(DIX_CFLAGS) $(XORG_CFLAGS) $(CWARNFLAGS)
|
||||
|
||||
AM_CPPFLAGS = $(XORG_INCS)
|
||||
|
||||
inputtest_drv_la_LTLIBRARIES = inputtest_drv.la
|
||||
inputtest_drv_la_LDFLAGS = -module -avoid-version
|
||||
inputtest_drv_ladir = @moduledir@/input
|
||||
|
||||
inputtest_drv_la_SOURCES = xf86-input-inputtest.c xf86-input-inputtest-protocol.h
|
||||
|
||||
sdk_HEADERS = xf86-input-inputtest-protocol.h
|
||||
|
||||
drivermandir = $(DRIVER_MAN_DIR)
|
||||
driverman_PRE = inputtestdrv.man
|
||||
driverman_DATA = $(driverman_PRE:man=@DRIVER_MAN_SUFFIX@)
|
||||
|
||||
EXTRA_DIST = inputtestdrv.man
|
||||
|
||||
CLEANFILES = $(driverman_DATA)
|
||||
|
|
@ -0,0 +1,107 @@
|
|||
.\" shorthand for double quote that works everywhere.
|
||||
.ds q \N'34'
|
||||
.TH INPUTTEST __drivermansuffix__ __vendorversion__
|
||||
.SH NAME
|
||||
inputtest \- An X.Org input driver for testing
|
||||
.SH SYNOPSIS
|
||||
.nf
|
||||
.B "Section \*qInputDevice\*q"
|
||||
.BI " Identifier \*q" devname \*q
|
||||
.B " Driver \*qinputtest\*q"
|
||||
.BI " Option \*qSocketPath\*q \*q" path \*q
|
||||
\ \ ...
|
||||
.B EndSection
|
||||
.fi
|
||||
|
||||
.SH DESCRIPTION
|
||||
.B inputtest
|
||||
is an Xorg input driver that passes events received over a socket on to the
|
||||
server as input events. It supports the full set of the xf86 driver APIs
|
||||
exposed by Xorg. The primary use cases of this input driver are various
|
||||
integration tests that need to interface with the input subsystem.
|
||||
|
||||
.SH CONFIGURATION DETAILS
|
||||
Please refer to __xconfigfile__(__filemansuffix__) for general configuration
|
||||
details and for options that can be used with all input drivers. This
|
||||
section only covers configuration details specific to this driver.
|
||||
.PP
|
||||
External process can communicate with the input driver via a named socket that
|
||||
is created after the driver is initialized. The paths to the socket is passed
|
||||
via input driver options.
|
||||
.PP
|
||||
The following driver
|
||||
.B Options
|
||||
are supported:
|
||||
.TP 7
|
||||
.BI "Option \*qSocketPath\*q \*q" string \*q
|
||||
Sets the path where the driver will create a named socket. Any existing file
|
||||
at that location will be removed.
|
||||
.TP 7
|
||||
.BI "Option \*qDeviceType\*q \*q" string \*q
|
||||
Sets the type of the device to be emulated.
|
||||
.IP
|
||||
.BI Keyboard
|
||||
Initializes a keyboard device.
|
||||
.IP
|
||||
.BI Pointer
|
||||
Initializes a relative-mode pointer device. It will have four valuators -
|
||||
a "Rel X" valuator at axis 0 and a "Rel Y" valuator at axis 1.
|
||||
A horizontal scroll valuator will be set up at axis 2.
|
||||
A vertical scroll valuator will be set up at axis 3.
|
||||
.IP
|
||||
.BI PointerAbsolute
|
||||
Initializes an absolute-mode pointer device. It will have four valuators -
|
||||
an "Abs X" valuator at axis 0 and an "Abs Y" valuator at axis 1.
|
||||
A horizontal scroll valuator will be set up at axis 2.
|
||||
A vertical scroll valuator will be set up at axis 3.
|
||||
.IP
|
||||
.BI PointerAbsoluteProximity
|
||||
Initializes an absolute-mode pointer device with proximity support.
|
||||
The valuators are initialized in the same way as for \fBPointerAbsolute\fR type.
|
||||
.IP
|
||||
.BI Touch
|
||||
Initializes a touch device.
|
||||
It will have 3 valuators: an "Abs MT Position X" at axis 0,
|
||||
an "Abs MT Position Y" valuator at axis 1 and an "Abs MT Pressure" valuator
|
||||
at axis 2.
|
||||
.TP 7
|
||||
.BI "Option \*qTouchCount\*q \*q" int \*q
|
||||
Sets the maximum number of simultaneous touches for touch devices.
|
||||
.TP 7
|
||||
.BI "Option \*qPointerButtonCount\*q \*q" int \*q
|
||||
Sets the maximum number of buttons in pointer devices.
|
||||
|
||||
.SH INTERFACE WITH THE DRIVER
|
||||
The communication with the driver is a binary protocol defined in
|
||||
include/xf86-input-inputtest-protocol.h
|
||||
.PP
|
||||
At the beginning, the client process that communicates with the driver must
|
||||
connect to the socket that is created by the driver at SocketPath.
|
||||
Once the connection is established, it must write a xf86ITEventClientVersion
|
||||
event and read a xf86ITResponseServerVersion response where the driver
|
||||
specifies the protocol version supported by it. If this version is lower than
|
||||
requested by the client, then the driver will disconnect.
|
||||
.PP
|
||||
After receiving xf86ITResponseServerVersion message the client may send events
|
||||
to the driver. Each event is an instance of one of the
|
||||
.BI xf86ITEvent*
|
||||
structs. The length field defines the full length of the struct in bytes and
|
||||
the event field defines the type of the struct.
|
||||
.PP
|
||||
The responses from the server follow the same structure. Each response is an
|
||||
instance of one of the
|
||||
.BI xf86ITResponse*
|
||||
structs. The length field defines the full length of the struct in bytes and
|
||||
the event field defines the type of the struct.
|
||||
.PP
|
||||
The synchronization with Xorg is performed via
|
||||
.BI xf86ITEventWaitForSync
|
||||
event. After sending such event, the client must read of a
|
||||
.BI xf86ITResponseSyncFinished event from the socket without sending additional
|
||||
events. The completion of the read operation indicates that Xorg has fully
|
||||
processed all input events sent to it so far.
|
||||
|
||||
.SH AUTHORS
|
||||
Povilas Kanapickas <povilas@radix.lt>
|
||||
.SH "SEE ALSO"
|
||||
__xservername__(__appmansuffix__), __xconfigfile__(__filemansuffix__), Xserver(__appmansuffix__), X(__miscmansuffix__)
|
|
@ -0,0 +1,24 @@
|
|||
inputtestdrv_srcs = [
|
||||
'xf86-input-inputtest.c',
|
||||
]
|
||||
|
||||
shared_module(
|
||||
'inputtest_drv',
|
||||
inputtestdrv_srcs,
|
||||
name_prefix: '',
|
||||
|
||||
include_directories: [inc, xorg_inc],
|
||||
c_args: xorg_c_args,
|
||||
dependencies: [common_dep],
|
||||
|
||||
install: true,
|
||||
install_dir: join_paths(module_dir, 'input'),
|
||||
)
|
||||
|
||||
install_man(configure_file(
|
||||
input: 'inputtestdrv.man',
|
||||
output: 'inputtestdrv.4',
|
||||
configuration: manpage_config,
|
||||
))
|
||||
|
||||
install_data('xf86-input-inputtest-protocol.h', install_dir: xorgsdkdir)
|
|
@ -0,0 +1,144 @@
|
|||
/*
|
||||
* Copyright © 2020 Povilas Kanapickas <povilas@radix.lt>
|
||||
*
|
||||
* Permission to use, copy, modify, distribute, and sell this software
|
||||
* and its documentation for any purpose is hereby granted without
|
||||
* fee, provided that the above copyright notice appear in all copies
|
||||
* and that both that copyright notice and this permission notice
|
||||
* appear in supporting documentation, and that the name of Red Hat
|
||||
* not be used in advertising or publicity pertaining to distribution
|
||||
* of the software without specific, written prior permission. Red
|
||||
* Hat makes no representations about the suitability of this software
|
||||
* for any purpose. It is provided "as is" without express or implied
|
||||
* warranty.
|
||||
*
|
||||
* THE AUTHORS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
|
||||
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
|
||||
* NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
|
||||
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
|
||||
* OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
|
||||
* NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
|
||||
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef XF86_INPUT_INPUTTEST_PROTOCOL_H_
|
||||
#define XF86_INPUT_INPUTTEST_PROTOCOL_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#define XF86IT_PROTOCOL_VERSION_MAJOR 1
|
||||
#define XF86IT_PROTOCOL_VERSION_MINOR 0
|
||||
|
||||
enum xf86ITResponseType {
|
||||
XF86IT_RESPONSE_SERVER_VERSION,
|
||||
XF86IT_RESPONSE_SYNC_FINISHED,
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
uint32_t length; /* length of the whole event in bytes, including the header */
|
||||
enum xf86ITResponseType type;
|
||||
} xf86ITResponseHeader;
|
||||
|
||||
typedef struct {
|
||||
xf86ITResponseHeader header;
|
||||
uint16_t major;
|
||||
uint16_t minor;
|
||||
} xf86ITResponseServerVersion;
|
||||
|
||||
typedef struct {
|
||||
xf86ITResponseHeader header;
|
||||
} xf86ITResponseSyncFinished;
|
||||
|
||||
typedef union {
|
||||
xf86ITResponseHeader header;
|
||||
xf86ITResponseServerVersion version;
|
||||
} xf86ITResponseAny;
|
||||
|
||||
/* We care more about preserving the binary input driver protocol more than the
|
||||
size of the messages, so hardcode a larger valuator count than the server has */
|
||||
#define XF86IT_MAX_VALUATORS 64
|
||||
|
||||
enum xf86ITEventType {
|
||||
XF86IT_EVENT_CLIENT_VERSION,
|
||||
XF86IT_EVENT_WAIT_FOR_SYNC,
|
||||
XF86IT_EVENT_MOTION,
|
||||
XF86IT_EVENT_PROXIMITY,
|
||||
XF86IT_EVENT_BUTTON,
|
||||
XF86IT_EVENT_KEY,
|
||||
XF86IT_EVENT_TOUCH,
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
uint32_t length; /* length of the whole event in bytes, including the header */
|
||||
enum xf86ITEventType type;
|
||||
} xf86ITEventHeader;
|
||||
|
||||
typedef struct {
|
||||
uint32_t has_unaccelerated;
|
||||
uint8_t mask[(XF86IT_MAX_VALUATORS + 7) / 8];
|
||||
double valuators[XF86IT_MAX_VALUATORS];
|
||||
double unaccelerated[XF86IT_MAX_VALUATORS];
|
||||
} xf86ITValuatorData;
|
||||
|
||||
typedef struct {
|
||||
xf86ITEventHeader header;
|
||||
uint16_t major;
|
||||
uint16_t minor;
|
||||
} xf86ITEventClientVersion;
|
||||
|
||||
typedef struct {
|
||||
xf86ITEventHeader header;
|
||||
} xf86ITEventWaitForSync;
|
||||
|
||||
typedef struct {
|
||||
xf86ITEventHeader header;
|
||||
uint32_t is_absolute;
|
||||
xf86ITValuatorData valuators;
|
||||
} xf86ITEventMotion;
|
||||
|
||||
typedef struct {
|
||||
xf86ITEventHeader header;
|
||||
uint32_t is_prox_in;
|
||||
xf86ITValuatorData valuators;
|
||||
} xf86ITEventProximity;
|
||||
|
||||
typedef struct {
|
||||
xf86ITEventHeader header;
|
||||
int32_t is_absolute;
|
||||
int32_t button;
|
||||
uint32_t is_press;
|
||||
xf86ITValuatorData valuators;
|
||||
} xf86ITEventButton;
|
||||
|
||||
typedef struct {
|
||||
xf86ITEventHeader header;
|
||||
int32_t key_code;
|
||||
uint32_t is_press;
|
||||
} xf86ITEventKey;
|
||||
|
||||
typedef struct {
|
||||
xf86ITEventHeader header;
|
||||
uint32_t touchid;
|
||||
uint32_t touch_type;
|
||||
xf86ITValuatorData valuators;
|
||||
} xf86ITEventTouch;
|
||||
|
||||
typedef union {
|
||||
xf86ITEventHeader header;
|
||||
xf86ITEventClientVersion version;
|
||||
xf86ITEventMotion motion;
|
||||
xf86ITEventProximity proximity;
|
||||
xf86ITEventButton button;
|
||||
xf86ITEventKey key;
|
||||
xf86ITEventTouch touch;
|
||||
} xf86ITEventAny;
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
#endif /* XF86_INPUT_INPUTTEST_PROTOCOL_H_ */
|
File diff suppressed because it is too large
Load Diff
|
@ -133,6 +133,9 @@ endif
|
|||
if build_modesetting
|
||||
subdir('drivers/modesetting')
|
||||
endif
|
||||
if get_option('xf86-input-inputtest')
|
||||
subdir('drivers/inputtest')
|
||||
endif
|
||||
|
||||
if get_option('suid_wrapper')
|
||||
executable('Xorg.wrap',
|
||||
|
|
|
@ -107,6 +107,8 @@ option('agp', type: 'combo', choices: ['true', 'false', 'auto'], value: 'auto',
|
|||
description: 'AGP support')
|
||||
option('sha1', type: 'combo', choices: ['libc', 'CommonCrypto', 'CryptoAPI', 'libmd', 'libsha1', 'libnettle', 'libgcrypt', 'libcrypto', 'auto'], value: 'auto',
|
||||
description: 'SHA1 implementation')
|
||||
option('xf86-input-inputtest', type: 'boolean', value: true,
|
||||
description: 'Test input driver support on Xorg')
|
||||
|
||||
option('dri1', type: 'combo', choices: ['true', 'false', 'auto'], value: 'auto', description: 'Build DRI1 extension (default: auto)')
|
||||
option('dri2', type: 'combo', choices: ['true', 'false', 'auto'], value: 'auto', description: 'Build DRI2 extension (default: auto)')
|
||||
|
|
Loading…
Reference in New Issue