Make click-and-drag work for Macbook(Pro) 5,1+ (touchpads with integrated button)

Bug #356317 reported by Erkin Bahceci
52
This bug affects 7 people
Affects Status Importance Assigned to Milestone
Mactel Support
New
Wishlist
Unassigned

Bug Description

This patch makes the click-and-drag work for MacBook(Pro) 5,1+ (the ones with a touchpad with integrated button). Two-finger-clicking is still functional with the patch. The behavior when clicking with two fingers on the touchpad should closely resemble that of OS X. Also attached is a deb package to test the patch.

Revision history for this message
Erkin Bahceci (cornelius1) wrote :
Revision history for this message
Erkin Bahceci (cornelius1) wrote :
Revision history for this message
Ricky Campbell (cyberdork33) wrote :

thanks.

If you want to create a patch against the kernel version, you will need to look at the differences between the latest kernel source and your changes. A patch against the kernel source can be submitted upstream and eventually make it into Ubuntu (probably not this release).

Changed in mactel-support:
importance: Undecided → Wishlist
Revision history for this message
P. Dunbar (vigilcode) wrote :

quite nice. still has room for improvement but much more useable than the previous version.
some notes: With the touchpad as an entire button I find "tapping" does more to get in the way. So I set all tapclicks to 0 again and also palmdetect to 0. With tapping enabled I find I frequently and inadvertently get the pointer in odd states like with the hand grab icon and a + symbol even if i release my hand away entirely.
Regardless, even with my changes to the .fdi above grabbing windows and resizing them while holding my thumb down at the bottom is working perfectly.
At this point I'd say we are 90% at fully mimicking the functionality from Mac OSX. The one thing i can identify that is missing is the following:
Within Mac OSX i can physically rest my thumb at the lower portion of the trackpad. While the thumb is resting there and not moving I can move my finger around above it to move the cursor and click with my thumb as needed. This makes the touchpad act as the old maclaptop that had the button there. I can tell they actually disable touching down there during this time cause as i move the finger above, if I then move the thumb it takes about 2 seconds to register the thumb moving.
This functionality would be great to add but this might get hard.

Revision history for this message
Ricky Campbell (cyberdork33) wrote :

It sounds like they have something similar to a palm detect algorithm that applies only to the bottom of the touchpad.

The other issue here is that this kernel driver is not only used for the Macbook(Pro)5,x machines. It is also used for the MacbookPro4,1 (which has an actual button). It might be an ugly way to do it, but we may need to look at spiltting the driver functions based on the specific hardware ID... Most of this doesn't apply to the MacBookPro4,1 and it may cause issues there because something is now working better on the 5,x machines. So, before commiting these patches, we need to make sure that someone tests on MacBookPro4,1 hardware too.

Revision history for this message
P. Dunbar (vigilcode) wrote :

Would you need to split on hardware ID? It seems the code makes these changes based on an if statement on whether or not it has an integrated button. That should just trigger false on the MBP4,1 I'd assume. If that's the case then even the other functionality I mentioned could be added based on the same IF statement.

Apple def has special rules for that bottom quarter of the touchpad to literally mimic the button on the 4,1.

Revision history for this message
Erkin Bahceci (cornelius1) wrote :

Ricky, this version should behave exactly the same as bcm5974-dkms v1.1.3 for earlier MacBook models since (as P. Dunbar said) the part that changes the behavior only runs when the hardware has an integrated button. So, unless the integrated button detection method in the code is wrong, it should work fine for earlier MacBooks.

As for the "ignoring the thumb at the bottom quarter" feature, it would be nice to have that too (shouldn't be too hard to do anyway), but I think that needs its own bug report, as it is out of the scope of this one.

Revision history for this message
Ricky Campbell (cyberdork33) wrote :

OK sounds good. I haven't seen the code, just double-checking. It was my understanding the that 5,x models do have a hardware button (it is just under the actual touchpad). So I did not know you could test for the existence of a hardware button that way. In any regard, since this driver affects not only 5,x models we should be sure that it is tested on a MBP4,1 othewise we could get into a pass-back-and-forth situation alternately fixing bugs for the 4,1 and 5,x machines.

Revision history for this message
Henrik Rydberg (rydberg) wrote : Re: [Mactel-support] [Bug 356317] Re: Make click-and-drag work for Macbook(Pro) 5, 1+ (touchpads with integrated button)

P. Dunbar wrote:
> Would you need to split on hardware ID? It seems the code makes these
> changes based on an if statement on whether or not it has an integrated
> button. That should just trigger false on the MBP4,1 I'd assume. If
> that's the case then even the other functionality I mentioned could be
> added based on the same IF statement.
>
> Apple def has special rules for that bottom quarter of the touchpad to
> literally mimic the button on the 4,1.
>

Yu might be interested in this kernel thread:

http://lkml.org/lkml/2008/11/7/146

It deals with extensions to the kernel to, among other things, properly
handle the unibody trackpad. The patches are in Andrew Mortons -mm tree
http://userweb.kernel.org/~akpm/mmotm/broken-out/:

input-allow-certain-ev_abs-events-to-bypass-all-filtering.patch
input-add-a-detailed-multi-touch-finger-data-report-protocol-rev2.patch

Basic support for Macbook5 is in the pipeline since long; it got stuck
upstream because of a vanished maintainer, but should appear in 2.6.30:

input-bcm5974-prepare-for-a-new-trackpad-header-type.patch
input-bcm5974-add-quad-finger-tapping.patch
input-bcm5974-add-support-for-the-macbook-5-unibody.patch
input-bcm5974-augmented-debug-information.patch
input-bcm5974-declare-alignment-usage.patch

As can be seen from the unibody ubuntu thread, the click-and-drag
problem is known and is being worked; there are more patches in the
pipeline not listed here because they depend on additional kernel
changes not upstream yet. If you do have kernel patches for bcm5974,
please read the Documentation/SubmittingPatches document of the kernel
GIT tree, and send the patches to me for review.

Cheers!
Henrik

Revision history for this message
Henrik Rydberg (rydberg) wrote :

Here is the mail address for bcm5974 patches: <email address hidden>

Revision history for this message
Henrik Rydberg (rydberg) wrote :

Cornelius,

thanks for your patches. I have now looked at it, and although the code per se is fine, it should really go into the synaptics X driver, not the bcm5974. The reason the integrated button is added to the kernel interface is for this to be possible; as a patch to bcm5975, it will not be accepted. If you wish to make modifications to the synaptics driver, the git tree is at:

git://anongit.freedesktop.org/git/xorg/driver/xf86-input-synaptics/

You can send patches to Christoph Brill (<email address hidden>) or Peter Hutterer (<email address hidden>) or myself (<email address hidden>).

Cheers!

Revision history for this message
P. Dunbar (vigilcode) wrote :

I've created a new bug for what I consider the last large issue with the integrated touchpad to mimic mac osx functionality:
https://bugs.edge.launchpad.net/mactel-support/+bug/357094

If a fix for this could get added to bcm5974 it would then be great to try to get these into a kernel patch so those who install karmic koala have a fully working touchpad day1.
If sound and reboot were fixed for 9.10 that would give the user a near perfect install on the latest apple hardware. An exciting thing!

Revision history for this message
Chris Lasher (chris.lasher) wrote :

By September 2009, Apple will have made another hardware release, which will possibly cause another flurry of these bug reports, so be careful about what you mean by "latest hardware". I think "the current generation of hardware" is what you mean. ;-)

Revision history for this message
Erkin Bahceci (cornelius1) wrote :

Henrik, thanks for having a look at the patch. I had thought that synaptics was the right place for this functionality, and that's why I looked at that first, but seeing that synaptics wasn't receiving the coordinates for multiple fingers, I wrote a patch for bcm5974. Now, as I understand it, you haven't yet released the bcm5974 patch to add MT protocol support or the new driver that takes advantage of this MT information, right? (or synaptics modifications? which one will it be?) Since you wrote that you already have some code for these (and also for click-and-drag?), I was wondering what remains to be done and how I could help without duplicating any effort. Should we just wait for MT protocol kernel support and your remaining (unreleased) code to arrive?

Cheers.

PS: Since it is drag related, I'll ask here: Is there a way to disable tap-and-drag but keep taps enabled (to click)? I couldn't see a synaptics option for that. If I added such an option to synaptics, would it have any chance of getting accepted?

Revision history for this message
Henrik Rydberg (rydberg) wrote :

Hello Cornelius,

> Henrik, thanks for having a look at the patch. I had thought that
> synaptics was the right place for this functionality, and that's why I
> looked at that first, but seeing that synaptics wasn't receiving the
> coordinates for multiple fingers, I wrote a patch for bcm5974. Now, as I
> understand it, you haven't yet released the bcm5974 patch to add MT
> protocol support or the new driver that takes advantage of this MT
> information, right?

I see. Well, the patches were reviewed and accepted by Andrew Morton
more than half a year ago. The fact is that the whole MB5 and MT
development got held back half a year simply because there was noone
actually merging the code into linus tree. The MB5 patches are being
merged now, but the MT patches are in for a second review. This whole
business put me off a little, so my plan is simply to hold until all
merging and negotiation is done. Sometimes things just take time, sorry.

> PS: Since it is drag related, I'll ask here: Is there a way to disable
> tap-and-drag but keep taps enabled (to click)? I couldn't see a
> synaptics option for that. If I added such an option to synaptics, would
> it have any chance of getting accepted?

Yes! You work would be very much appreciated.

Thanks,
Henrik

Revision history for this message
benchang (ben-bcchang) wrote :

In the meantime, while this is getting sorted out, the patch above is working well for me - thanks!

I noticed something else interesting, not sure how to fix it. When clicking with my thumb, the pointer moves around a bit, so the click occurs down and to the left of where I meant to click. The thumb click motion is, I guess, more of a rotational motion than a simply linear one like finger clicking, so there's this little bit of rolling that happens through the wrist. Is there any way to compensate for that?

Revision history for this message
Rob W. (rob-wilmoth) wrote :

Installed this today, Looks like I'm seeing the exact same behavior that benchang is experiencing.

Also -- what is the plausibility that this patch can be pushed upstream, so that other distributions can benefit? I'm also working with Fedora 11 to get this functionality...

Thanks!
-Rob

Revision history for this message
Ricky Campbell (cyberdork33) wrote :

Rob, please see comments by rydberg above about getting this included upstream.

Revision history for this message
rsiebel (riley-siebel) wrote :

Installed the patch (actually, my patch-compile-install under ubuntu). Have not gained click-with-one-finger-drag-with-another functionality.

Am I misunderstanding the purpose of the patch, or did I screw up?

git clone'd source from bitmath.org/git/bcm5974-dkms.git
dwnld'd patch from cornelius' link

I issued these commands:
patch -p2 < ./0001-Make-click-and-drag-work-for-Macbook5-1.patch
when prompted: "File to patch: " -> bcm5974-dkms/usr/src/dkms_source_tree/bcm5974.c
Both the bcm5974-dkms directory and the patch were sitting in ~/

did make, did make install (couldn't find ./configure or make configure) rebooted.

Is there something that I'm missing here? I am a definate noob so its very probable.

How would I use the deb package to test?

Thanks in advance

Revision history for this message
Erkin Bahceci (cornelius1) wrote :

rsiebel, doesn't double-clicking the deb package work in Ubuntu?

Revision history for this message
David S. (d-sylva) wrote :

Does anybody know a way to get two-finger click-and-drag working under Karmic (on the MacBook 5,1)? There doesn't seem to even be a bcm5974-dkms package for Karmic.

Revision history for this message
Jason 'vanRijn' Kasper (vr-movingparts) wrote :

Just wondering if there's been any progress on this? I read above that 2.6.30 was supposed to contain working click+drag for the single clickable touchpad that's in the newer MBP's, but I have a MBP 5,5 and am running Karmic, which has 2.6.31-17-generic-pae, and I still have to manually install http://launchpadlibrarian.net/24871974/bcm5974-dkms_1.1.4_all_test.deb every time a bcm5974-dkms update comes in to get this working again.

Revision history for this message
Henrik Rydberg (rydberg) wrote :

Jason 'vanRijn' Kasper wrote:
> Just wondering if there's been any progress on this? I read above that
> 2.6.30 was supposed to contain working click+drag for the single
> clickable touchpad that's in the newer MBP's, but I have a MBP 5,5 and
> am running Karmic, which has 2.6.31-17-generic-pae, and I still have to
> manually install
> http://launchpadlibrarian.net/24871974/bcm5974-dkms_1.1.4_all_test.deb
> every time a bcm5974-dkms update comes in to get this working again.
>

There is an ongoing project, http://ubuntuforums.org/showthread.php?t=1334696,
which aims at utilizing the kernel multitouch (MT) interface to implement this
functionality properly in a new MT-based X driver. The MT X driver will
eventually, most likely together with the lucid release, be provided as a mactel
package, which will remove the necessity to install the special bcm5974 patch.

Revision history for this message
vaughn (vaughngrisham) wrote :

Anyone have an update on this? I could get drag and drop working in Lucid, but it's dead again in Maverick. The instructions given here (https://help.ubuntu.com/community/MacBookPro5-3/Lucid#Touchpad) no longer have any effect.

Revision history for this message
rbhkamal (rbhkamal) wrote :

Me too, my friends laugh at me when I'm trying to resize windows or highlight text.... I know this is not a place to ask for help, but as vaughn said, the instructions don't work (I tried all of them)

Revision history for this message
Eric Kerby (erickerby) wrote :

Same goes for Natty...how can we get this working in 11.04?

Revision history for this message
ike (ikeahloe) wrote :

same for oneiric... as a non-programmer, it's hard for me to see how this would be so hard to fix since it's been done before, and also it's hard to see how a bug that affect this many people just sits so long unanswered

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.