Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.
Randomly came across this when googling for Leopard multitouch trackpad support, since I'm testing my VoodooInput backend for the "Wellspring" internal USB trackpad whose support allegedly goes down all the way to Leopard. I came from the other thread: https://forums.macrumors.com/threads/magic-trackpad-plus-10-5-leopard-ppc.2380484/

You guys are plumbing upwards the 0x28 packet format into AppleUSBMultitouchDriver::handleReport by first manually starting the real driver, overriding that method, translating to compactv4, then calling the original handleReport with the translation, whereas I replace AppleUSBMultitouch entirely at the class level. What I do is

OSDefineMetaClassAndStructors(AppleUSBMultitouchDriver, IOHIDDevice);

Then I do
OSDefineMetaClassAndStructors(VoodooInputWellspringSimulator, AppleUSBMultitouchDriver);


I don't subclass IOHIDDevice directly because it didn't work. I dissassembled MultitouchSupport.framework and it actually checks that the IOService it finds is actually the real thing:
IOObjectConformsTo(service, "AppleUSBMultitouchDriver")

And I'm not going to make my class name literally the same as Apple's, so I subclass "AppleUSBMultitouchDriver" and basically use it as a shim to make that above check return true. Then I manually reimplement the real driver which was somewhat painstaking but seemed to be a soemwhat cleaner result than trying to use offsets to hack vtables and stuff

I had documented a decent amount of the architecture and it lines up with what you guys found, too

Anyways--really cool work; since you are using AppleUSBMultitouchDriver, in theory you're not that far from going lower than Mavericks. AppleUSBMultitouch.kext exists as far back as Leopard (i checked a 10.5.8 rootfs dmg I had lying around from an AppleTV1 project), but i'm not sure if the compactv4 format does since the Magic Trackpad 1 was released in the snow leopard era, so if that packet format is new for it, then this driver will only go as far back as 10.6.4 (https://support.apple.com/en-us/106655)

I use the 0x74 packet format whcih is the Wellspring internal USB trackpad format so that should actually go back to Leopard at least. But I alrady had a Snow Leopard USB laying around, so I'm going to test on that first.

In any case, mine receives data from VoodooInput client drivers, so it doesn't directly work with the real apple MT2. A low level bus driver would have to be made that feeds into VoodooInput to use my shim instead as-is. I presume that starting the real AppleUSBMultitouchDriver takes care of a lot of logic and initialization like sending the packet to switch from basic HID to multitouch? In any case, once I clean up my code, I'll post it on github. The logic that plumbs wellspring frames upwards should be reusable and could be used to get MT2 even lower than mavericks or Snow leopard 10.6.4. But it depends on whether the real driver you initialize does a lot of initialization black box stuff
 
@iphone2g&3gfan Nice info! Would be interested in seeing that implementation as well.

I think @schmonz had an older implementation which avoided the vtable swizzling of BNBTrackpadDevice, and instead directly drove the AppleMultitouchDevice directly. The issue with that was apparently it breaks the native system preferences pane.


>A clean reimplementation that owns the BT channels + input was viable, but the user pinned stock Apple prefpane = mandatory, and the pane matches BNBTrackpadDevice. Dropping genuine BNB loses the pane. Reopening criterion: if "stock pane mandatory" were relaxed (e.g. an own-pane workstream shipped), REPLACE becomes viable again.

Although @schmonz if you need to use a SIMBL plugin anyway to get the prefpane working for USB, why not just use that plugin to allow it to match your kext as well?

Also @iphone2g&3gfan when you say
>manually reimplement the real driver which was

What od you mean by "reimplemented real driver" here, since you're inheriting from AppleMultitouchDevice you only need to call its `handleTouchFrame` method right? Or for some reason did you instead feed events to AppleMultitouchHID directly?
 
Last edited:
Oooh, subclassing sounds smart. In general, if I understand your project correctly @iphone2g&3gfan, it sounds like (1) it is awesome and (2) maybe we’d be able to combine our efforts at some point? Right now I’m still polishing the UX for my one device on one particular vintage OS X, but once that’s sorted I’m aiming at a 1.0 shaped like this:

- In the middle, a driver interface that might just look exactly like VoodooInput’s
- Underneath, a system interface whose initial implementation is for 10.9
- On top, a tiny little driver for the MT2

…with the hope that we’d get lots more devices pretty easily, and more vintage OS X versions as non-difficultly as possible.

Reading your approach, and thinking about maintainability and compatibility — especially since we want more than just Mavericks — I’m appreciating @f54da's point. Had I foreseen how deeply I’d be going into the prefpane-swizzling business, I’d probably have kept my earlier implementations and just done a little more swizzling. And maybe that’s still the right big-picture answer.

Current status: automated GitHub release workflow is solid (tag and push, the .pkg that comes out actually works), so I’m working on a Sparkle updater. Via a UI control swizzled, of course, into the prefpane.

Great to meet you @iphone2g&3gfan, keep going, and tell us when you post your code! Or anything else interesting you figure out along the way.
 
0.3.0 is out:
  • When switching USB to Bluetooth, no more click-to-reconnect
  • On-device Bluetooth rename, via the usual Bluetooth prefpane device-list context menu UI
  • Sparkle updater
My wishlist for device and UI functionality is getting pretty short. Time to focus on how the code is put together.
 
Very nice! Although another thing i was wondering when I skimmed the code, why does MT2Gesture need to be an actual iokit nub, as opposed to just struct + functions which then calls into the opened AppleMultitouchDevice? Maybe it's a noob question since I'm not too familiar with IOKit. I guess if you want to do C++ OOP within IOKit it's probably cleaner to have it as an actual IOKit object, but it seems like it doesn't really have to be one.
 
I hope to be able to answer that question in a week or so, possibly with "whoops, gonna try that”
🙂
 
Since the MT2 trackpads use "force touch", can you customize the click sensitivity? I didn't see it mentioned in the readme, is it currently hardcoded to default or can that be configured (maybe just via a config file, or if you want to be really fancy, have your simbl plugin modify the trackpad preference pane to add a slider for that)?
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.