emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: master 3b41141708: Expose the name of an event's input device to Lis


From: Po Lu
Subject: Re: master 3b41141708: Expose the name of an event's input device to Lisp
Date: Mon, 11 Apr 2022 08:58:58 +0800
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.91 (gnu/linux)

Brian Cully <bjc@spork.org> writes:

>       So I’ve tried to verify this, and couldn’t. I trawled the Xorg
> xserver code, and from what I can tell, the “name” field that gets
> assigned to a device comes from the driver level, which, in my case at
> least, is libinput. I couldn’t find any place in the X server code that
> changes the name as passed in from the driver level (although I may have
> missed it, but I doubt it, as I’ll show below).

As I said, the input driver is supposed to give it a unique name.  That
may be the libinput X driver, the Synaptics driver, the evdev driver, or
any number of other drivers.

>       Moreover, it appears as though, at least with udev and libinput,
> device names are *not* unique. This time, rather than trying to go
> through their code, I created a simple test: I updated the firmware on a
> USB device to have the same name, model, vid, and pid as my keyboard,
> but a different serial number. I think this reflects how this would work
> in the real world.

You likely missed something, or the input driver doesn't know enough
about that specific kind of device to create a unique enough name.

I would consider that an error in the user's configuration.  As a last
resort, he could always configure it manually in the X server
configuration instead of relying on hotplug.  It's possible, though I
forgot exactly how.

>       And here you can see that the two input devices have the same
> name (Keyboardio Model 01). In particular the last set of XINPUT lines
> which echo the name come from device activation in xf86input.c at line
> 412 of the xserver code, just before the device is enabled, and I would
> assume far too late in the process to adjust the name (but again, I
> admit I may be missing something).

When I insert two actual mice of the same kind (I did not flash
anything), I get two different names.

So there's something wrong with the input driver, or your device isn't
providing the information necessary to disambiguate the two.

>       AFAICT this is the name that’s presented to
> toolkit layers. There may be a place where it’s modified by X, but,
> again, I couldn’t find it.

As I've been saying for a long time, it's modified by the input drivers,
which should behave correctly.  I don't expect users to flash custom
firmware onto their mice specifically for them to look exactly like
another device.

>       So, the tl;dr here is that I flashed a USB device to look like
> one of my existing ones, and from everything I can tell, they have the
> same name, at least coming out of X.

I tried a real pair of the same mice and got different names, and there
isn't any more disambugating information supplied to applications (they
all rely on names being unique and as persistent as possible), so this
is not a problem in practice.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]