unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Po Lu <luangruo@yahoo.com>
To: Brian Cully <bjc@spork.org>
Cc: Eli Zaretskii <eliz@gnu.org>,
	 emacs-devel@gnu.org,  larsi@gnus.org, monnier@iro.umontreal.ca,
	 rms@gnu.org
Subject: Re: master 3b41141708: Expose the name of an event's input device to Lisp
Date: Mon, 11 Apr 2022 08:58:58 +0800	[thread overview]
Message-ID: <87v8vg77vx.fsf@yahoo.com> (raw)
In-Reply-To: <87mtgsyeg0.fsf@ditto.jhoto.spork.org> (Brian Cully's message of "Sun, 10 Apr 2022 14:08:00 -0400")

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	other threads:[~2022-04-11  0:58 UTC|newest]

Thread overview: 86+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <164933858147.29834.15050766441005536059@vcs2.savannah.gnu.org>
     [not found] ` <20220407133623.9C209C009A8@vcs2.savannah.gnu.org>
2022-04-07 14:05   ` master 3b41141708: Expose the name of an event's input device to Lisp Stefan Monnier
2022-04-07 23:31     ` Po Lu
2022-04-07 23:41       ` Stefan Monnier
2022-04-08  0:07         ` Po Lu
2022-04-08  6:02         ` Eli Zaretskii
2022-04-08  6:08           ` Po Lu
2022-04-08  6:26             ` Eli Zaretskii
2022-04-08  7:36               ` Po Lu
2022-04-08 11:12                 ` Eli Zaretskii
2022-04-08 11:31                   ` Po Lu
2022-04-08 12:12                     ` Eli Zaretskii
2022-04-08 12:35                       ` Po Lu
2022-04-09  6:48                         ` Eli Zaretskii
2022-04-09  9:06                           ` Po Lu
2022-04-09  9:09                             ` Lars Ingebrigtsen
2022-04-09  9:30                             ` Eli Zaretskii
2022-04-09 10:03                               ` Po Lu
2022-04-09 11:03                                 ` Eli Zaretskii
2022-04-09 11:44                                   ` Po Lu
2022-04-09 14:04                                     ` Eli Zaretskii
2022-04-09 16:33                                       ` Stefan Monnier
2022-04-09 16:41                                         ` Lars Ingebrigtsen
2022-04-09 17:06                                           ` Eli Zaretskii
2022-04-09 17:16                                             ` Eli Zaretskii
2022-04-09 17:52                                             ` Brian Cully
2022-04-09 19:18                                               ` Eli Zaretskii
2022-04-10  0:54                                               ` Po Lu
2022-04-10  1:46                                                 ` Brian Cully
2022-04-10  2:11                                                   ` Po Lu
2022-04-10  2:45                                                     ` Brian Cully
2022-04-10  3:30                                                       ` Po Lu
2022-04-10  0:37                                           ` Po Lu
2022-04-10  5:49                                             ` Eli Zaretskii
2022-04-10  6:09                                               ` Po Lu
2022-04-10  6:44                                                 ` Eli Zaretskii
2022-04-10  7:31                                                   ` Po Lu
2022-04-10  8:28                                                     ` Eli Zaretskii
2022-04-10  8:50                                                       ` Po Lu
2022-04-10  9:17                                                         ` Eli Zaretskii
2022-04-10  9:25                                                           ` Po Lu
2022-04-10 11:15                                                             ` Po Lu
2022-04-10 15:16                                                               ` Stefan Monnier
2022-04-11  1:02                                                                 ` Po Lu
2022-04-10 11:46                                                   ` Lars Ingebrigtsen
2022-04-10 11:41                                             ` Lars Ingebrigtsen
2022-04-10  0:48                                       ` Po Lu
2022-04-10  6:04                                         ` Eli Zaretskii
2022-04-10  6:17                                           ` Po Lu
2022-04-10  6:49                                             ` Eli Zaretskii
2022-04-10  7:01                                               ` Po Lu
2022-04-10  8:24                                                 ` Eli Zaretskii
2022-04-10  8:42                                                   ` Po Lu
2022-04-10  9:13                                                     ` Eli Zaretskii
2022-04-10 12:51                                                       ` Brian Cully
2022-04-10 13:21                                                         ` Po Lu
2022-04-10 18:08                                                           ` Brian Cully
2022-04-11  0:58                                                             ` Po Lu [this message]
2022-04-11  1:08                                                               ` Brian Cully
2022-04-11  2:00                                                                 ` Po Lu
2022-04-11  2:03                                                                   ` Po Lu
2022-04-11  2:21                                                                   ` Brian Cully
2022-04-11  3:12                                                                     ` Po Lu
2022-04-11  4:11                                                                       ` Brian Cully
2022-04-11  5:20                                                                         ` Po Lu
2022-04-11 11:33                                                                           ` Brian Cully
2022-04-11 14:09                                                                             ` Po Lu
2022-04-11 16:26                                                                               ` Brian Cully
2022-04-11 10:10                                                             ` Lars Ingebrigtsen
2022-04-10 12:44                                                     ` Brian Cully
2022-04-10 13:14                                                       ` Po Lu
2022-04-08 14:27         ` Stefan Monnier
2022-04-09  0:24           ` Po Lu
2022-04-09  2:52             ` Stefan Monnier
2022-04-09  3:17               ` Po Lu
2022-04-09 13:31                 ` Stefan Monnier
2022-04-09 13:37                   ` Po Lu
2022-04-09 14:20                     ` Stefan Monnier
2022-04-10  0:58                       ` Po Lu
2022-04-09 14:31                     ` Eli Zaretskii
2022-04-10  0:56                       ` Po Lu
2022-04-10  6:11                         ` Eli Zaretskii
2022-04-10  6:23                           ` Po Lu
2022-04-10  6:52                             ` Eli Zaretskii
2022-04-10  7:37                               ` Po Lu
2022-04-10  8:12                                 ` Eli Zaretskii
2022-04-09  6:22             ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87v8vg77vx.fsf@yahoo.com \
    --to=luangruo@yahoo.com \
    --cc=bjc@spork.org \
    --cc=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=larsi@gnus.org \
    --cc=monnier@iro.umontreal.ca \
    --cc=rms@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).