Bug 244110 - x11-drivers/xf86-input-vmmouse InputClass not matching when VMWare is used
Summary: x11-drivers/xf86-input-vmmouse InputClass not matching when VMWare is used
Status: New
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: freebsd-x11 mailing list
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-02-13 22:40 UTC by Daniel Morante
Modified: 2020-02-27 01:11 UTC (History)
0 users

See Also:
bugzilla: maintainer-feedback? (x11)


Attachments
Working Xorg log (39.23 KB, text/plain)
2020-02-27 01:11 UTC, Daniel Morante
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Daniel Morante 2020-02-13 22:40:03 UTC
When using AutoAddDevices (currently the default behavior), X11 is not able to correctly match the input class of the vmware mouse in a virtual machine.  X11 therefore defaults to using the normal 'mouse' driver instead of 'vmmouse'.  This is true no matter if moused is used or not.

Both 'moused_nondefault_enable' and 'moused_enable' are set to "NO" in /etc/rc.conf:

```
sysrc moused_nondefault_enable moused_enable

moused_nondefault_enable: NO
moused_enable: NO
```

Currently in `/usr/local/share/X11/xorg.conf.d/50-vmmouse.conf` (as installed by x11-drivers/xf86-input-vmmouse)

```
Section "InputClass"
	Identifier	"vmmouse"
	MatchIsPointer	"on"
	MatchTag	"vmmouse"
	Driver		"vmmouse"
EndSection
```

Xorg.0.log shows that X11 is falling back to using the default "mouse' driver for both /dev/sysmouse and /dev/psm0.

```
[     9.160] (II) config/devd: adding input device (null) (/dev/sysmouse)
[     9.160] (II) LoadModule: "mouse"
[     9.160] (II) Loading /usr/local/lib/xorg/modules/input/mouse_drv.so
[     9.161] (II) Module mouse: vendor="X.Org Foundation"
[     9.161] 	compiled for 1.18.4, module version = 1.9.3
[     9.161] 	Module class: X.Org XInput Driver
[     9.161] 	ABI class: X.Org XInput driver, version 22.1
[     9.161] (II) Using input driver 'mouse' for 'sysmouse'
[     9.161] (**) sysmouse: always reports core events
[     9.161] (**) Option "Device" "/dev/sysmouse"
[     9.161] (==) sysmouse: Protocol: "Auto"
[     9.161] (**) sysmouse: always reports core events
[     9.161] (==) sysmouse: Emulate3Buttons, Emulate3Timeout: 50
[     9.161] (**) sysmouse: ZAxisMapping: buttons 4 and 5
[     9.161] (**) sysmouse: Buttons: 5
[     9.161] (**) Option "config_info" "devd:sysmouse"
[     9.161] (II) XINPUT: Adding extended input device "sysmouse" (type: MOUSE, id 7)
[     9.161] (**) sysmouse: (accel) keeping acceleration scheme 1
[     9.161] (**) sysmouse: (accel) acceleration profile 0
[     9.161] (**) sysmouse: (accel) acceleration factor: 2.000
[     9.161] (**) sysmouse: (accel) acceleration threshold: 4
[     9.161] (II) sysmouse: SetupAuto: hw.iftype is 4, hw.model is 0
[     9.161] (II) sysmouse: SetupAuto: protocol is SysMouse
[     9.194] (II) config/devd: adding input device Mouse (/dev/psm0)
[     9.194] (II) Using input driver 'mouse' for 'Mouse'
[     9.194] (**) Mouse: always reports core events
[     9.194] (**) Option "Device" "/dev/psm0"
[     9.194] (==) Mouse: Protocol: "Auto"
[     9.194] (**) Mouse: always reports core events
[     9.227] (==) Mouse: Emulate3Buttons, Emulate3Timeout: 50
[     9.227] (**) Mouse: ZAxisMapping: buttons 4 and 5
[     9.227] (**) Mouse: Buttons: 5
[     9.227] (**) Option "config_info" "devd:psm0"
[     9.227] (II) XINPUT: Adding extended input device "Mouse" (type: MOUSE, id 8)
[     9.227] (**) Mouse: (accel) keeping acceleration scheme 1
[     9.227] (**) Mouse: (accel) acceleration profile 0
[     9.227] (**) Mouse: (accel) acceleration factor: 2.000
[     9.227] (**) Mouse: (accel) acceleration threshold: 4
[     9.233] (II) Mouse: SetupAuto: hw.iftype is 3, hw.model is 4
[     9.233] (II) Mouse: SetupAuto: protocol is IMPS/2
[     9.519] (II) Mouse: ps2EnableDataReporting: succeeded
```

Output of xinput

```
xinput list

⎡ Virtual core pointer                    	id=2	[master pointer  (3)]
⎜   ↳ Virtual core XTEST pointer              	id=4	[slave  pointer  (2)]
⎜   ↳ sysmouse                                	id=7	[slave  pointer  (2)]
⎜   ↳ Mouse                                   	id=8	[slave  pointer  (2)]
⎣ Virtual core keyboard                   	id=3	[master keyboard (2)]
    ↳ Virtual core XTEST keyboard             	id=5	[slave  keyboard (3)]
    ↳ kbdmux                                  	id=6	[slave  keyboard (3)]


xinput list-props 7

Device 'sysmouse':
	Device Enabled (116):	1
	Coordinate Transformation Matrix (117):	1.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 1.000000
	Device Accel Profile (230):	0
	Device Accel Constant Deceleration (231):	1.000000
	Device Accel Adaptive Deceleration (232):	1.000000
	Device Accel Velocity Scaling (233):	10.000000
	Device Node (234):	"/dev/sysmouse"
	Button Labels (235):	"Button Left" (119), "Button Middle" (120), "Button Right" (121), "Button Wheel Up" (122), "Button Wheel Down" (123)
	Mouse Middle Button Emulation (236):	1
	Mouse Middle Button Timeout (237):	50


xinput list-props 8

Device 'Mouse':
	Device Enabled (116):	1
	Coordinate Transformation Matrix (117):	1.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 1.000000
	Device Accel Profile (230):	0
	Device Accel Constant Deceleration (231):	1.000000
	Device Accel Adaptive Deceleration (232):	1.000000
	Device Accel Velocity Scaling (233):	10.000000
	Device Node (234):	"/dev/psm0"
	Button Labels (235):	"Button Left" (119), "Button Middle" (120), "Button Right" (121), "Button Wheel Up" (122), "Button Wheel Down" (123)
	Mouse Middle Button Emulation (236):	1
	Mouse Middle Button Timeout (237):	50
```

My guess is that for some reason in FreeBSD it's unable to make the match based on the tag.  (I don't know how to get the tag to confirm).  By changing `/usr/local/share/X11/xorg.conf.d/50-vmmouse.conf` to match on the device node instead, the correct driver is loaded:

```
Section "InputClass"
	Identifier	"vmmouse"
	MatchIsPointer	"on"
	MatchDevicePath	"/dev/psm0"
	Driver		"vmmouse"
EndSection
```

```
[     9.407] (II) config/devd: adding input device (null) (/dev/sysmouse)
[     9.407] (**) sysmouse: Applying InputClass "vmmouse"
[     9.407] (II) LoadModule: "vmmouse"
[     9.407] (II) Loading /usr/local/lib/xorg/modules/input/vmmouse_drv.so
[     9.408] (II) Module vmmouse: vendor="X.Org Foundation"
[     9.408] 	compiled for 1.18.4, module version = 13.1.0
[     9.408] 	Module class: X.Org XInput Driver
[     9.408] 	ABI class: X.Org XInput driver, version 22.1
[     9.408] (II) VMWARE(0): VMMOUSE module was loaded
[     9.408] (II) Using input driver 'vmmouse' for 'sysmouse'
[     9.408] (**) sysmouse: always reports core events
[     9.408] (II) VMWARE(0): vmmouse is available
[     9.408] (**) Option "Device" "/dev/sysmouse"
[     9.408] (**) sysmouse: ZAxisMapping: buttons 4 and 5
[     9.408] (**) Option "config_info" "devd:sysmouse"
[     9.408] (II) XINPUT: Adding extended input device "sysmouse" (type: MOUSE, id 7)
[     9.408] (II) VMWARE(0): VMMOUSE DEVICE_INIT
[     9.408] (**) sysmouse: (accel) keeping acceleration scheme 1
[     9.408] (**) sysmouse: (accel) acceleration profile 0
[     9.408] (**) sysmouse: (accel) acceleration factor: 2.000
[     9.408] (**) sysmouse: (accel) acceleration threshold: 4
[     9.408] (II) VMWARE(0): VMMOUSE DEVICE_ON
[     9.408] (II) VMWARE(0): vmmouse enabled
[     9.441] (II) config/devd: adding input device Mouse (/dev/psm0)
[     9.441] (**) Mouse: Applying InputClass "vmmouse2"
[     9.441] (II) Using input driver 'vmmouse' for 'Mouse'
[     9.441] (**) Mouse: always reports core events
[     9.441] (II) VMWARE(0): vmmouse is available
[     9.441] (**) Option "Device" "/dev/psm0"
[     9.475] (**) Mouse: ZAxisMapping: buttons 4 and 5
[     9.475] (**) Option "config_info" "devd:psm0"
[     9.475] (II) XINPUT: Adding extended input device "Mouse" (type: MOUSE, id 8)
[     9.475] (II) VMWARE(0): VMMOUSE DEVICE_INIT
[     9.475] (**) Mouse: (accel) keeping acceleration scheme 1
[     9.475] (**) Mouse: (accel) acceleration profile 0
[     9.475] (**) Mouse: (accel) acceleration factor: 2.000
[     9.475] (**) Mouse: (accel) acceleration threshold: 4
[     9.475] (II) VMWARE(0): VMMOUSE DEVICE_ON
[     9.481] (II) VMWARE(0): vmmouse enabled
(II) VMWARE(0): vmmouse enable absolute mode
(II) VMWARE(0): re-requesting absolute mode after reset
```

Or in the case of when you are using moused (sysrc moused_nondefault_enable="YES" moused_enable="YES"), it needs to match on `/dev/sysmouse`:

```
Section "InputClass"
	Identifier	"vmmouse"
	MatchIsPointer	"on"
	MatchDevicePath	"/dev/sysmouse"
	Driver		"vmmouse"
EndSection
```

Even though it 'fixes' the problem, I'm not sure if the correct way is by changing the InputClass match, that's beyond my current know-how.
Comment 1 Daniel Morante 2020-02-27 01:09:05 UTC
I can confirm this is still a problem with xorg-server-1.20.7,1 with xf86-input-vmmouse-13.1.0_4. Just one slight change when using FreeBSD 12.1 with "kern.evdev.rcpt_mask=6".  The 'MatchDevicePath' directive changes to:

```
Section "InputClass"
	Identifier	"vmmouse"
	MatchIsPointer "on"
        MatchDevicePath "/dev/input/event*"
	Driver		"vmmouse"
EndSection
```
Comment 2 Daniel Morante 2020-02-27 01:11:20 UTC
Created attachment 211982 [details]
Working Xorg log