[PATCH xf86-input-libinput] Allow symbolic link device path

Kögler Christian Christian.Koegler at esg.de
Wed Apr 26 08:40:27 UTC 2017


Motivation
Assign calibration to a specific device.

Problem
LIBINPUT_CALIBRATION_MATRIX is not used, because the used context creation
function libinput_path_create_context do not recognize Udev variables.
The documented approach is to set the option "CalibrationMatrix" and
"Device" in xorg.conf for assigning a calibration information to a device.
To be able to choose a specific device, an udev rule creates a device unique
path to that device (e.g. /dev/input/by-id/...). This path can not be
used, because Udev calls open_restricted with the base name.

This patch resolves the real name of the given "Device" option during
initialization.
---
 src/xf86libinput.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/src/xf86libinput.c b/src/xf86libinput.c
index f09f57e..ec39258 100644
--- a/src/xf86libinput.c
+++ b/src/xf86libinput.c
@@ -2214,6 +2214,19 @@ open_restricted(const char *path, int flags, void *data)
 free(device);
 break;
 }
+
+if (device != NULL) {
+char* realdevice = realpath(device, NULL);
+if (realdevice != NULL) {
+if (strcmp(path, realdevice) == 0) {
+free(device);
+free(realdevice);
+break;
+}
+free(realdevice);
+}
+}
+
 free(device);
 }

--
2.12.2



ESG Elektroniksystem- und Logistik-GmbH

Rechtsform / Legal Form: Gesellschaft mit beschränkter Haftung
Sitz / Registered Office: München
Handelsregister / Commercial Register: Registergericht München, HRB 219422
Vorsitzender des Aufsichtsrats / Chairman of the Supervisory Board: Alexander Schemann
Geschäftsführer / CEO: Kai Horten


More information about the wayland-devel mailing list