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

Kögler Christian Christian.Koegler at esg.de
Tue May 2 12:23:34 UTC 2017


Hi Peter,

> -----Ursprüngliche Nachricht-----
> Von: Peter Hutterer [mailto:peter.hutterer at who-t.net]
> Gesendet: Dienstag, 2. Mai 2017 05:02
> An: Kögler Christian <Christian.Koegler at esg.de>
> Cc: wayland-devel at lists.freedesktop.org
> Betreff: Re: [PATCH xf86-input-libinput] Allow symbolic link device path
>
> 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.
I used 1.5.1 and yes with 1.5.3 I have no problem.
Thanks for that simple and fast solution!

> > 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.
Good to know, cool feature.

> > ---
> >  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.
My email client removed all indentation spaces. Next time my patch is more readable.
I do not need this patch anymore, but if somebody needs to address a device by a symbolic link, it could be helpful.

>
> Cheers,
>    Peter
>
> >  free(device);
> >  }
> >
> _______________________________________________
> > wayland-devel mailing list
> > wayland-devel at lists.freedesktop.org
> > https://lists.freedesktop.org/mailman/listinfo/wayland-devel
> >

Tanks and Cheers
Christian



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