Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Magic Trackpad or Mouse upon (re)connection #49

Merged
merged 7 commits into from
Nov 15, 2022

Conversation

aaronkollasch
Copy link
Collaborator

@aaronkollasch aaronkollasch commented Nov 11, 2022

On recent versions of macOS, or possibly on newer Apple devices, Jitouch does not respond to a newly connected Magic Trackpad or Magic Mouse without reloading all devices.

This is because the Magic Trackpad does not show up as a BNBTrackpadDevice, and the Magic Mouse does not show up as a BNBMouseDevice in the I/O Registry. For example, the output of ioreg -l -w 180 | grep -i BNBTrackpadDevice is empty even with a Magic Trackpad connected.

This prevents Jitouch from detecting when those devices are connected and disconnected, so it can't refresh its device list or add its callback to those devices.

Instead, Jitouch should watch for the connection of I/O devices named AppleMultitouchDevice, which have a Multitouch ID that corresponds to the ID produced by MTDeviceGetDeviceID, and a Family ID that corresponds to the output of MTDeviceGetFamilyID. When such a device is connected, Jitouch's stored device list can be searched by Multitouch ID and the matching device stopped, before starting a new device for that ID.

See the IOKitLib API and example ioreg outputs.

Fixes #28 and fixes #40 and fixes #46

@aaronkollasch
Copy link
Collaborator Author

aaronkollasch commented Nov 12, 2022

Debug build linked below (updated 2022-11-13):

Install-Jitouch.zip

Consolidates BNBMouseDevice and BNBTrackpadDevice notifications,
which do not appear on newer devices/OS versions.
Could replace familyIsBuiltinTrackpad and other functions with
[NSArray containsObject:] at some point, but this would ideally require
the NSArray defined as a constant literal, which requires a
deployment target of macOS 11 or above.
https://blog.andrewmadsen.com/2021/06/07/constant-literals-in.html
https://developer.apple.com/documentation/xcode-release-notes/xcode-13-release-notes
@aaronkollasch aaronkollasch merged commit e99d952 into main Nov 15, 2022
@aaronkollasch aaronkollasch deleted the fix/28/trackpad-reconnect branch December 28, 2022 21:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant