magic-trackpad-2-linux icon indicating copy to clipboard operation
magic-trackpad-2-linux copied to clipboard

Working driver

Open mwyborski opened this issue 8 years ago • 12 comments

I incorporated the Magic Trackpad into the bcm5974 (MacBook Tochpad) driver: https://github.com/robotrovsky/Linux-Magic-Trackpad-2-Driver

It makes the switch to activate the multitouch fingers but is still not stable.

mwyborski avatar Oct 09 '16 15:10 mwyborski

hi @robotrovsky, do you have any instructions to install the driver? Thanks!

pacuna avatar Oct 10 '16 19:10 pacuna

You have to compile the kernel modules. Right now the driver only works over USB.

On Arch Linux: See https://wiki.archlinux.org/index.php/Kernels/Arch_Build_System. The clean way would be to create a patch from the changes in https://github.com/robotrovsky/linux/commit/7b50169c3a8948e67a67eb530b91117a7f5d9d5b and add that patch to the prepare routine. A quick unclean way would be as follows:

 $ cd ~/
 $ mkdir build
 $ cd build/
 $ ABSROOT=. abs core/linux
 $ cd core/linux

Edit

PKGBUILD

and look for the pkgbase parameter. Change this to your custom package name, e.g.:

pkgbase=linux-custom

Then:

$ updpkgsums
$ makepkg -s --skippgpcheck

When the makepkg has downloaded the kernel applied the patches and begins to compile just hit "Ctrl C" to stop the creation of the package and the compilation.

Now apply the changes to your source:

$ cd src/linux-{version}/

Insert the hid-id in

drivers/hid/hid-ids.h
drivers/hid/hid-apple.c
drivers/hid/hid-core.c

Replace the bcm5974-driver source with the modified one drivers/input/mouse/bcm5974.c

Then:

$ make modules
$ make modules_install

Now you have recompiled all kernel modules and installed them to/lib/modules/{kernel-version}-custom/

Just copy the folder /lib/modules/{kernel-version}-custom/kernel/drivers over to your ARCH Kernel /lib/modules/{kernel-version}-ARCH/kernel/drivers

After a reboot your Magic Trackpad 2 should work. You can check, that it now uses the bcm5974 driver with usb-devices

I hope this helps.

mwyborski avatar Oct 11 '16 16:10 mwyborski

@robotrovsky would you be able to make that patch file?

dcousens avatar Oct 11 '16 23:10 dcousens

are you planning to upstream your work to mainline kernel?

zbraniecki avatar Oct 12 '16 20:10 zbraniecki

@robotrovsky What's the blocker for activating the driver for a bluetooth HID?

coxley avatar Oct 27 '16 21:10 coxley

Sorry. I haven't had time to work on this. There are two drivers in the kernel. One for the Touchpad of the MacBook Pro and another one for MagicMouse and MagicTrackpad I. The latter i didn't saw when starting on the driver. It has Bluetooth and is more simple in its structure. The "secret" lies in the mode switch, to switch to finger reporting and the structure of the finger reports (9 Byte). So maybe the best would be to dump the current driver and implement it alongside to the MagicTrackpad I. But as i have a MacBook with Touchpad it was easier for me to compare the outcome of the driver. Another reason to go for the MacBook Tochpad driver would have been, that both MacBook Touchpad and the Tackpad 2 support ForceTouch. So implementing the two devices in different drivers, would make it necessary to implement ForceTouch as well in two drivers, but then again it doesn't have Bluetooth.

All in all, it should not be too difficult. But i don't know when i will find the time for this. If someone wants to give it a shot, i would be glad to help.

mwyborski avatar Oct 27 '16 21:10 mwyborski

@robotrovsky: thank you very much for your kernel patches. :+1: I've created an dkms package with them that is known to work with kernel 4.4.0-57-generic on Ubuntu 16.04 LTS: https://github.com/robbi5/magictrackpad2-dkms

robbi5 avatar Dec 22 '16 14:12 robbi5

@robbi5 That are awesome news!! Thank you for taking this a step further.

mwyborski avatar Dec 23 '16 13:12 mwyborski

@robbi5 Time for something in the AUR now eh? ;)

coxley avatar Jan 03 '17 19:01 coxley

@coxley Yep, but I have not used Arch Linux yet ;)

robbi5 avatar Jan 03 '17 19:01 robbi5

Hi all.

If anyone wants to give my bluetooth enabled driver a try, find details here: https://github.com/robbi5/magictrackpad2-dkms/issues/1#issuecomment-328340731

ponyfleisch avatar Sep 10 '17 12:09 ponyfleisch

In case anyone else runs into this, two finger scrolling on trackpad 2 worked with bluetooth as of kernel 4.13. Starting with kernel 4.14 it stopped working. The kernels were the versions used on Manjaro, Fedora, and I think Ubuntu.

jwp23 avatar Feb 25 '18 17:02 jwp23