User Tools

Site Tools


ubuntu:mouse:determine_the_mouse

This is an old revision of the document!


Ubuntu - Mouse - Determine the Mouse

Determine the Mouse to use

xinput --list --short

returns:

⎡ Virtual core pointer                    	id=2	[master pointer  (3)]
⎜   ↳ Virtual core XTEST pointer              	id=4	[slave  pointer  (2)]
⎜   ↳ Corsair CORSAIR K70 RGB MK.2 Mechanical Gaming Keyboard Consumer Control	id=11	[slave  pointer  (2)]
⎜   ↳ Corsair CORSAIR K70 RGB MK.2 Mechanical Gaming Keyboard Mouse	id=12	[slave  pointer  (2)]
⎜   ↳ Razer Razer DeathAdder V2               	id=8	[slave  pointer  (2)]
⎜   ↳ Razer Razer DeathAdder V2 Consumer Control	id=9	[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)]
    ↳ Power Button                            	id=7	[slave  keyboard (3)]
    ↳ Corsair CORSAIR K70 RGB MK.2 Mechanical Gaming Keyboard	id=10	[slave  keyboard (3)]
    ↳ Corsair CORSAIR K70 RGB MK.2 Mechanical Gaming Keyboard Consumer Control	id=13	[slave  keyboard (3)]
    ↳ Razer Razer DeathAdder V2 Consumer Control	id=14	[slave  keyboard (3)]
    ↳ Razer Razer DeathAdder V2 Keyboard      	id=15	[slave  keyboard (3)]
    ↳ Razer Razer DeathAdder V2 System Control	id=16	[slave  keyboard (3)]
    ↳ Razer Razer DeathAdder V2               	id=17	[slave  keyboard (3)]

NOTE: In this case, the “Razer Razer DeathAdder V2” is the mouse.

  • As there are multiple entries, the name “Razer Razer DeathAdder V2” cannot be used as it is not unique.
  • Instead, use the id.
    • How to know which of the id to use.

Which id to use

In the above results, the Razer DeathAdder is shown multiple times.

  • Only the salient id is needed.
xinput | grep -m 1 "DeathAdder"

returns:

⎜   ↳ Razer Razer DeathAdder V2               	id=8	[slave  pointer  (2)]

NOTE: Many mouse show as as both Mouse and Keyboard.

  • The Keyboard entries can usually be ignore.
  • -m 1 in the grep returns only the first line.
    • This shows that id=8 is the relevant line.
    • This id may change upon system reboot, so for any future scripts using the id, it is best this is calculated beforehand:
      xinput | grep -m 1 "DeathAdder" | sed 's/^.*id=\([0-9]*\)[ \t].*$/\1/'
    • returns:
      8

Determine Other Device Idenfiers

Device Product Name (Model)

The Product Name (or model):

xinput --list --short

returns:

...
Razer Razer DeathAdder V2
...

NOTE: This is the same as above.


Device Vendor Name (Manufacturer)

The manufacturer or vendor name:

udevadm info --query=property --name=/dev/input/event7 | grep 'VENDOR='

returns:

ID_VENDOR=Razer

NOTE: This is the same as above.


XOrg Configuration

Putting it all together, a new XOrg configuration InputClass Section would look like:

/usr/share/X11/xorg.conf.d/60-razer-deathadder-v2.conf
Section "InputClass"
    Identifier "Razer Deathadder v2"
    MatchDevicePath "/dev/input/event*"
    MatchProduct "Razer Razer DeathAdder V2"
    MatchVendor "Razer"
EndSection
ubuntu/mouse/determine_the_mouse.1635259552.txt.gz · Last modified: 2021/10/26 14:45 by peter

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki