Navigation Menu

Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Maximilian Richt committed Dec 22, 2016
0 parents commit 40773c3
Show file tree
Hide file tree
Showing 24 changed files with 15,344 additions and 0 deletions.
11 changes: 11 additions & 0 deletions .gitignore
@@ -0,0 +1,11 @@
*.o
*.o.cmd
*.mod.c
*.ko
*.ko.cmd
Module.symvers
modules.order

.tmp_versions

build
5 changes: 5 additions & 0 deletions CHANGELOG
@@ -0,0 +1,5 @@
magictrackpad2-dkms (1.0.0-1) UNRELEASED; urgency=low

* Initial release.

-- robbi5 <robbi5@robbi5.de> Thu, 22 Dec 2016 15:45:00 +0000
340 changes: 340 additions & 0 deletions LICENSE

Large diffs are not rendered by default.

20 changes: 20 additions & 0 deletions Makefile
@@ -0,0 +1,20 @@
#!/usr/bin/make -f

PKG_NAME=magictrackpad2-dkms
PKG_VERSION=1.0.0
PKG_DESCRIPTION="Patched BCM-5974 and hid-apple modules from kernel 4.4 for including Magic Trackpad 2 support."

MAINTAINER="robbi5 <robbi5@robbi5.de>"
HOMEPAGE="https://github.com/robbi5/magictrackpad2-dkms"

all:
test -d build || mkdir build
fpm -f -s dir -t deb -n $(PKG_NAME) -v $(PKG_VERSION) -a all -p build/ \
-d dkms -d build-essential -d linux-headers-generic \
-m $(MAINTAINER) --vendor robbi5 --license GPLv2 --description $(PKG_DESCRIPTION) \
--url $(HOMEPAGE) --deb-changelog CHANGELOG \
--post-install scripts/post-install.sh --pre-uninstall scripts/pre-uninstall.sh \
--exclude '.git*' usr/

clean:
rm -f build/$(PKG_NAME)_$(PKG_VERSION)_all.deb
57 changes: 57 additions & 0 deletions README.md
@@ -0,0 +1,57 @@
magictrackpad2-dkms
-------------------

A DKMS module for patching the bcm5947 and hid drivers to support the Apple Magic Trackpad 2.

Tested with Kernel 4.4.0-57-generic on Ubuntu 16.04 LTS.

How to install
==============

It should be enough to install the package. If it still doesn't work, you may have to copy the kernel modules from
`/lib/modules/4.4.0-57-generic/updates/dkms/` to `/lib/modules/4.4.0-57-generic/kernel/drivers/hid/`

* http://unix.stackexchange.com/questions/240593/kernel-not-recognizing-new-devices-from-dkms-module


How to configure
================

Configuration happens in `xorg.conf` at
`/usr/share/X11/xorg.conf.d/49-synaptics-bcm5974.conf` and with `xinput`.

If your mouse only moves when you press hard, modify the thresholds:

`xinput set-prop "bcm5974" "Synaptics Finger" 0 10 0`


How to update
=============

Install the current kernel sources: `sudo apt-get install linux-source`

The sources are then available at `/usr/src/linux-source-4.4.0/linux-source-4.4.0.tar.bz2`.

Extract following files to `src/bcm5974...`:
* `/linux-source-4.4.0/drivers/input/mouse/bcm5974.c`

Extract following files to `src/hid...`:
* `/linux-source-4.4.0/drivers/hid/hid-apple.c`
* `/linux-source-4.4.0/drivers/hid/hid-core.c`
* `/linux-source-4.4.0/drivers/hid/hid-debug.c`
* `/linux-source-4.4.0/drivers/hid/hid-ids.h`
* `/linux-source-4.4.0/drivers/hid/hid-input.c`
* `/linux-source-4.4.0/drivers/hid/hidraw.c`

Apply the patches in the same folders.

Build a package with `make`

Thanks:
=======

* https://github.com/robotrovsky/linux/commit/7b50169c3a8948e67a67eb530b91117a7f5d9d5b
* https://github.com/naftulikay/bcm5974-3.19
* https://bbs.archlinux.org/viewtopic.php?id=66397
* https://github.com/SicVolo/hid-apple-4.0.x
* https://github.com/SicVolo/hid-apple-3.19
42 changes: 42 additions & 0 deletions scripts/post-install.sh
@@ -0,0 +1,42 @@
#!/bin/bash

set -e

PARTS="bcm5974 hid"

for PART in $PARTS; do
dkms_name="$PART"
dkms_version="4.4+magictrackpad2"

case "$1" in
configure)
# add
if ! dkms status -m $dkms_name -v $dkms_version | egrep '(added|built|installed)' >/dev/null ; then
# if it's not been added yet, add it
dkms add -m $dkms_name -v $dkms_version
fi

# build
if ! dkms status -m $dkms_name -v $dkms_version | egrep '(built|installed)' >/dev/null ; then
# if it's not been built yet, build it
dkms build $dkms_name/$dkms_version
fi

# install
if ! dkms status -m $dkms_name -v $dkms_version | egrep '(installed)' >/dev/null; then
# if it's not been installed yet, install it
dkms install $dkms_name/$dkms_version
fi
;;

*)
echo "postinst called with unknown argument: $1"
exit 1
;;
esac

done

#DEBHELPER#

exit 0
28 changes: 28 additions & 0 deletions scripts/pre-uninstall.sh
@@ -0,0 +1,28 @@
#!/bin/bash

set -e

PARTS="bcm5974 hid"

for PART in $PARTS; do
dkms_name="$PART"
dkms_version="4.4+magictrackpad2"

case "$1" in
remove|upgrade|deconfigure)
if dkms status -m $dkms_name -v $dkms_version | egrep '(added|built|installed)' >/dev/null ; then
# if dkms bindings exist, remove them
dkms remove $dkms_name/$dkms_version --all
fi
;;

*)
echo "prerm called with unknown argument: $1"
exit 1
;;
esac
done

#DEBHELPER#

exit 0
27 changes: 27 additions & 0 deletions usr/share/X11/xorg.conf.d/49-synaptics-bcm5974.conf
@@ -0,0 +1,27 @@
Section "InputClass"
Identifier "Apple Magic Trackpad 2"
MatchUSBID "05ac:0265"
MatchIsTouchpad "on"
MatchDriver "synaptics"

# lookup options here: http://linux.die.net/man/5/synaptics

# detect your palm over the trackpad and disable while typing
Option "PalmDetect" "0"

# require actual clicks, no tapping!
Option "TapButton1" "0"
Option "TapButton2" "0"

# disable edge scrolling
Option "VertEdgeScroll" "0"
Option "HorizEdgeScroll" "0"

# don't do corner taps for things
Option "RTCornerButton" "0"
Option "RBCornerButton" "0"

# raise the minimum and maximum tracking speeds
Option "MinSpeed" "1.2"
Option "MaxSpeed" "1.85"
EndSection
12 changes: 12 additions & 0 deletions usr/src/bcm5974-4.4+magictrackpad2/Makefile
@@ -0,0 +1,12 @@
KERNEL_VERSION := $(shell uname -r)
KERNEL_MODULES := /lib/modules/$(KERNEL_VERSION)/build

hid-y := bcm5974.o

obj-m += bcm5974.o

all:
$(MAKE) -C $(KERNEL_MODULES) M=$(PWD) modules

clean:
$(MAKE) -C $(KERNEL_MODULES) M=$(PWD) clean

0 comments on commit 40773c3

Please sign in to comment.