magic-trackpad-2-linux
magic-trackpad-2-linux copied to clipboard
Working driver
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.
hi @robotrovsky, do you have any instructions to install the driver? Thanks!
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.
@robotrovsky would you be able to make that patch file?
are you planning to upstream your work to mainline kernel?
@robotrovsky What's the blocker for activating the driver for a bluetooth HID?
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.
@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 That are awesome news!! Thank you for taking this a step further.
@robbi5 Time for something in the AUR now eh? ;)
@coxley Yep, but I have not used Arch Linux yet ;)
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
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.