Bug 93367 - DWT not working on 13 inch Macbook Pro 2015 due to wrong dwt keyboard assignment
Summary: DWT not working on 13 inch Macbook Pro 2015 due to wrong dwt keyboard assignment
Status: RESOLVED FIXED
Alias: None
Product: Wayland
Classification: Unclassified
Component: libinput (show other bugs)
Version: unspecified
Hardware: x86-64 (AMD64) Linux (All)
: medium normal
Assignee: Wayland bug list
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-12-14 06:44 UTC by Caibin Chen
Modified: 2016-01-11 02:28 UTC (History)
1 user (show)

See Also:
i915 platform:
i915 features:


Attachments
[PATCH] touchpad: for apple unibody touchpad, disable keyboards that are not the same product id for dwt (1.97 KB, text/plain)
2015-12-14 06:44 UTC, Caibin Chen
Details
Updated patch (2.02 KB, patch)
2015-12-23 06:48 UTC, Caibin Chen
Details | Splinter Review
evemu-describe for touchpad (5.00 KB, text/plain)
2016-01-04 16:00 UTC, Caibin Chen
Details
evemu-describe for the right keyboard (8.22 KB, text/plain)
2016-01-04 16:00 UTC, Caibin Chen
Details
evemu-describe for the wrong keyboard (7.02 KB, text/plain)
2016-01-04 16:01 UTC, Caibin Chen
Details
0001-touchpad-fix-DWT-pairing-for-Macbook-Pro-2015.patch (18.69 KB, patch)
2016-01-04 23:42 UTC, Peter Hutterer
Details | Splinter Review

Description Caibin Chen 2015-12-14 06:44:42 UTC
Created attachment 120491 [details]
[PATCH] touchpad: for apple unibody touchpad, disable keyboards that  are not the same product id for dwt

Hi, I have a 13 inch Macbook Pro 2015. DWT is completely broken on it.

The version I'm using is compiled from Master branch. The problem is that there are two (or more?) keyboard devices: "Broadcom Corp. Bluetooth USB Host Controller" and "Apple Inc. Apple Internal Keyboard / Trackpad". libinput picked the wrong one for DWT detection.

Here is the hardware information:

[tiger@mbp ~]$ xinput
⎡ Virtual core pointer                    	id=2	[master pointer  (3)]
⎜   ↳ Virtual core XTEST pointer              	id=4	[slave  pointer  (2)]
⎜   ↳ Broadcom Corp. Bluetooth USB Host Controller	id=11	[slave  pointer  (2)]
⎜   ↳ bcm5974                                 	id=13	[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)]
    ↳ Power Button                            	id=8	[slave  keyboard (3)]
    ↳ Sleep Button                            	id=9	[slave  keyboard (3)]
    ↳ Broadcom Corp. Bluetooth USB Host Controller	id=10	[slave  keyboard (3)]
    ↳ Apple Inc. Apple Internal Keyboard / Trackpad	id=12	[slave  keyboard (3)]
[tiger@mbp ~]$ xinput list-props 10
Device 'Broadcom Corp. Bluetooth USB Host Controller':
        <......>
	Device Product ID (261):	1452, 33424
        <......>
[tiger@mbp ~]$ xinput list-props 12
Device 'Apple Inc. Apple Internal Keyboard / Trackpad':
        <......>
	Device Product ID (261):	1452, 627
        <......>
[tiger@mbp ~]$ xinput list-props 13
Device 'bcm5974':
	Device Enabled (139):	1
        <......>
	libinput Disable While Typing Enabled (297):	1
	libinput Disable While Typing Enabled Default (298):	1
        <......>
	Device Product ID (261):	1452, 627
        <......>

I have a workaround by forcing the touchpad to use the keyboard with the same vendor and product ID as the dwt keyboard. See the attached patch. Although it works, I highly doubt it's the right solution. A better solution may be supporting multiple dwt keyboards, or checking some other properties that can filter out the fake keyboard device.
Comment 1 Peter Hutterer 2015-12-22 00:47:50 UTC
Looks good, thanks. Please use your real name as git author and sign-off your patch though, once you attach the updated version I'll merge it. Please also attach an evemu-record for both the touchpad and the keyboard so I can add those as test devices.

In the touchpad case, please record a simple short touch sequence.
Comment 2 Caibin Chen 2015-12-23 06:48:10 UTC
Created attachment 120661 [details] [review]
Updated patch

Updated the patch, PTAL
Comment 3 Peter Hutterer 2016-01-03 22:46:50 UTC
Thanks, merged locally with two minor coding style changes (moved && to the previous line) and a reworded commit message. Please attach an evemu-describe of your touchpad and the keyboard device, I want to write a test-case for this.
Comment 4 Caibin Chen 2016-01-04 16:00:11 UTC
Created attachment 120793 [details]
evemu-describe for touchpad
Comment 5 Caibin Chen 2016-01-04 16:00:39 UTC
Created attachment 120794 [details]
evemu-describe for the right keyboard
Comment 6 Caibin Chen 2016-01-04 16:01:02 UTC
Created attachment 120795 [details]
evemu-describe for the wrong keyboard
Comment 7 Caibin Chen 2016-01-04 16:01:54 UTC
Please see the attached files. I have evemu-describe for the touchpad, right keyboard and wrong keyboard separately.
Comment 8 Peter Hutterer 2016-01-04 23:42:26 UTC
Created attachment 120802 [details] [review]
0001-touchpad-fix-DWT-pairing-for-Macbook-Pro-2015.patch

Updated. When writing the test case I found the original patch to be too narrow, it would only apply to this specific macbook. The new approach uses the hwdb to label the keyboard as an apple-internal one, then we just pair up the tp and the kbd based on that tag. Let me know if that works for you (it passes the tests here)
Comment 9 Caibin Chen 2016-01-06 04:35:48 UTC
The patch doesn't work. I can't apply the whole patch to master branch, so I removed the test diffs.

Will try to print some logs.
Comment 10 Caibin Chen 2016-01-06 04:45:20 UTC
90-libinput-model-quirks.hwdb doesn't seem to work, model_flags is still 0
Comment 11 Peter Hutterer 2016-01-06 04:49:20 UTC
did you install the file and run udevadm hwdb --update?

please check that there isn't a typo or something in the match string.
Comment 12 Peter Hutterer 2016-01-06 04:50:36 UTC
oh, and you need to trigger the update, either by reboot or sudo udevadm test /sys/class/input/eventX. That'll show what and whether it's applied, after that 
udevadm info /sys/class/input/eventX shows it too. If the new property doesn't show up with info, libinput won't see it either.
Comment 13 Caibin Chen 2016-01-06 04:53:33 UTC
I didn't run udevadm hwdb --update. It works now
Comment 14 Peter Hutterer 2016-01-11 02:28:03 UTC
pushed as b3f11180e337d6cd7fd997685b65e5ed48acc661, thanks


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.