xinput ids

Peter Hutterer peter.hutterer at who-t.net
Thu Jun 11 15:49:00 PDT 2015


On Thu, Jun 11, 2015 at 05:37:50PM +0800, Kai Hendry wrote:
> On Tue, 9 Jun 2015, at 01:23 PM, Peter Korsgaard wrote:
> > In the likely situation that the touchscreens are of the same type they
> > will have the same device name, so you need to fish out the
> > corresponding /dev/input/event* device node and pass it to udevadm info
> > (assuming that the server is local) to E.G. key off the ID_PATH
> > (E.G. the USB port the touchscreen is connected to).
> 
> Yes, Mr Hutterer's "some device name" suggestion doesn't work since IIUC
> my user's device comes up twice:
> 
> """
> Also using xinput with device name method wouldn't work either because
> there are 2 same eGalax touchscreen devices listed from xinput, so it
> couldn't tell which one to use, the only unique identification between
> the
> two is the device ID."""
> 
> Sorry, I still don't quite understand how to map /dev/input/event* via
> udevadm. Do you have a worked example, perhaps with systemd I could peer
> at?
> http://s.natalian.org/2015-06-11/lsusb.txt
> 
> Many thanks from Cornwall,

it's a bit more involved than just running udevadm, but: evdev and the other
drivers export a "Device Node" property with the value of the path opened
for this device ("/dev/input/event4" or something). You can then use that to 
extract the event node, and run udevadm info /sys/class/input/event4
and once you have the syspath, you can get the parent and all other
attributes and properties udev provides, and from that you can get back to
the xorg device id.

it's more than a simple grep, but it'll give you reliable device IDs absed
on the path. also, at that point you're seriously in the territory where a
small C app is likely easier and more maintainable than a shell script :)

Cheers,
   Peter


More information about the xorg mailing list