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

Peter Hutterer peter.hutterer at who-t.net
Tue May 2 03:02:03 UTC 2017


Hi Christian,

On Wed, Apr 26, 2017 at 08:40:27AM +0000, Kögler Christian wrote:
> 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.

what version of libinput are you using? this was fixed in 1.5.3, afaict.

> 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.

the better option would be to use the MatchTag system in the xorg.conf. If
you assign ID_INPUT.tags="foo,bar" to the device in your udev rule, you can
then use MatchTag on those to match on the specific device.

> ---
>  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);
> +}
> +}
> +

fwiw, this wouldn't be a patch that I could accept, please make sure you
keep the same coding style, specfically indentation in this case.

Cheers,
   Peter

>  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
> _______________________________________________
> wayland-devel mailing list
> wayland-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/wayland-devel
> 


More information about the wayland-devel mailing list