24

I'm trying to find the device manufacturer and model of my keyboard and touch pad so I can write an XOrg configuration file targeting it via:

Section "InputClass"
    Identifier "touchpad"
    MatchIsTouchpad "on"
    Driver "synaptics"
    MatchProduct "Product Name"
    MatchVendor "Vendor Name"
EndSection

How can I discover a device's product and vendor name using a CLI tool? I'd like to nail down my Bluetooth touchpad and keyboard so as to be able to tailor Xorg configuration.

4 Answers 4

27

Device Product Name (Model)

Get the xinput device Product Name (or model) using xinput list. Example output might look something like this:

# xinput list
⎡ Virtual core pointer                      id=2  [master pointer  (3)]
⎜   ↳ Virtual core XTEST pointer                id=4  [slave  pointer  (2)]
⎜   ↳ ELAN Touchscreen                          id=10 [slave  pointer  (2)]
⎜   ↳ SynPS/2 Synaptics TouchPad                id=13 [slave  pointer  (2)]
⎜   ↳ Logitech Unifying Device. Wireless        id=16 [slave  pointer  (2)]
⎣ Virtual core keyboard                     id=3  [master keyboard (2)]
    ↳ Virtual core XTEST keyboard               id=5  [slave  keyboard (3)]
    ↳ Power Button                              id=6  [slave  keyboard (3)]
    ↳ Video Bus                                 id=7  [slave  keyboard (3)]
    ↳ AT Translated Set 2 keyboard              id=12 [slave  keyboard (3)]

In the above output, the model or product name for the Touchscreen device is "ELAN Touchscreen".

Device Path (Node)

To get the xinput device Vendor Name (or manufacturer), we need to know the device Path (also called Device Node) to query, and then ask udevadm info. You can get the path by listing the xinput properties for a device and finding the 'Device Node' value.

From our previous example the Device Node value for the Touchscreen, which says it has id=10, could be found like this:

# xinput list-props 10 | grep 'Device Node'
    Device Node (253):    "/dev/input/event9"

Device Vendor Name (Manufacturer)

Now we can get the xinput device Vendor Name (or manufacturer) by looking at the value for the VENDOR property returned by udevadm info for the device with our path name found above:

# udevadm info --query=property --name=/dev/input/event9 | grep 'VENDOR='
ID_VENDOR=ELAN

In the output above, the manufacturer or vendor name for the Touchscreen would be "ELAN".

XOrg Configuration

Putting it all together, we can create a new XOrg configuration InputClass Section to match specific device vendors, products or paths. Using our previous examples, this section matches any Touchscreen Product manufactured by the ELAN Vendor:

Section "InputClass"
    Identifier "elan touchscreen catchall"
    MatchDevicePath "/dev/input/event*"
    MatchProduct "Touchscreen"
    MatchVendor "ELAN"
EndSection

Thanks to @Stéphane, @Daniel and @ManuelSchneid3r

4
  • 1
    xinput list shows both vendor and product name in one line, separated only by a space char. In my case it was TrulyErgonomic.com Truly Ergonomic Computer Keyboard instead of Truly Ergonomic Computer Keyboard. But MatchProduct seems to work with both strings: vendor and product name (as listed by xinput list) or only product name (as listed by udevadm).
    – erik
    Dec 3, 2015 at 13:53
  • Excellent answer. Thanks.
    – WesternGun
    Apr 14, 2021 at 8:09
  • And while xinput list allows spaces and /, in udevadm output they are replaced with underscore. So in xinput list I see GN Netcom A/S Jabra EVOLVE LINK MS, but in udevadm I see ID_VENDOR=GN_Netcom_A_S
    – WesternGun
    Apr 14, 2021 at 8:30
7

For USB devices on Linux, you can use:

lsusb -v | grep -e idProduct -e idVendor

For the IDs only:

grep . /sys/bus/usb/devices/*/id*

lsusb uses /var/lib/usbutils/usb.ids to translate ids to names, I don't know whether Xorg would use the same source.

3
  • Awesome, I can now see my USB devices, but I actually need to find Bluetooth info. This information is exactly what I'm looking for, just need it for my Bluetooth devices. I can find the hex vendor ids on Bluetooth devices, but I can't seem to find actual vendor or product names. Dec 10, 2012 at 21:37
  • -1 because this doesn’t work for non-usb devices. And it even doesn’t work for all usb devices, because lsusb often does not show a product name. ManuelSchneid3r’s answer worked best for me, that is: xinput list.
    – erik
    Dec 3, 2015 at 13:59
  • This answer is now outdated: lsusb (from usbutils) since this commit no longer uses usb.ids directly, but udev hwid (intro which is part of systemd. That one has a vendored usb.ids that appears to be regularly imported from the offical usb.ids and generates hwdb entries in this code.
    – nh2
    May 29, 2021 at 23:06
2

MatchProduct "Product Name" does not work with the output of Stephane's suggestion lsusb -v | grep -e idProduct -e idVendor. I just tested it.

xinput list outputs the correct string that works with MatchProduct

5
  • Does xinput list list both vendor and product together? Do you know how to work out which is which?
    – Sparhawk
    May 25, 2013 at 0:32
  • 2
    @Sparhawk xinput list shows the Product name but not the Vendor name. udevadm info shows the Vendor name but not the Product name. Aug 4, 2015 at 7:04
  • @Christopher I can't actually remember why I wanted this information, but thanks for replying, and hopefully it can help someone else.
    – Sparhawk
    Aug 4, 2015 at 10:18
  • @Christopher: No, xinput list show both vendor and product name in one line, separated by a space. I needed to use @DanielK’s answer to find only the product name. But udevadm shows _ instead of spaces. Easier to use might be the MatchUSBID found with lsusb or lsusb -v.
    – erik
    Dec 3, 2015 at 13:43
  • Ok, I just tested it: It works both with the whole string from xinput list, which is vendor and product name (at least in my case), and with the product name only (which I got from udevadm replacing the _ chars with spaces.
    – erik
    Dec 3, 2015 at 13:52
2

I've found the following commands to be useful in finding the model/vendor for use with the xorg.conf configuration.

From https://bbs.archlinux.org/viewtopic.php?pid=753773: (where /dev/sdx is replaced with the target device's device path i.e. /dev/input/mouse1)

udevadm info --query=all --path=$(udevadm info --query=path --name=/dev/sdx)

According to http://fedoraproject.org/wiki/Input_device_configuration:

udevadm info --export-db | grep ID_MODEL
1
  • But this lists the product names with _ instead of spaces. In my case it was Truly_Ergonomic_Computer_Keyboard instead of Truly Ergonomic Computer Keyboard. xinput list shows it correctly, but vendor and product name together in one line.
    – erik
    Dec 3, 2015 at 13:47

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .