Note

The Funtoo Linux project has transitioned to "Hobby Mode" and this wiki is now read-only.

Difference between revisions of "Apple Magic Trackpad 2 on Funtoo"

From Funtoo
Jump to navigation Jump to search
Line 163: Line 163:


After that, edit {{c|/etc/bluetooth/main.conf}}, uncomment the following line:
After that, edit {{c|/etc/bluetooth/main.conf}}, uncomment the following line:
{{file|body=
{{file|name=/etc/bluetooth/main.conf|body=
#ReconnectUUIDs=00001112-0000-1000-8000-00805f9b34fb,0000111f-0000-1000-8000-00805f9b34fb,0000110a-0000-1000-8000-00805f9b34fb,0000110b-0000-1000-8000-00805f9b34fb
#ReconnectUUIDs=00001112-0000-1000-8000-00805f9b34fb,0000111f-0000-1000-8000-00805f9b34fb,0000110a-0000-1000-8000-00805f9b34fb,0000110b-0000-1000-8000-00805f9b34fb
}}
}}

Revision as of 09:35, January 24, 2024

Apple produces a standalone trackpad known as the Magic Trackpad. It is used widely, not only in "Appleland", but also on platforms like Windows and Linux.

The Magic Trackpad 2 provides additional features on top of the original Magic Trackpad, mainly its ability to be used both wirelessly(via Bluetooth) and using a cable.

Connecting the trackpad

The trackpad is designed to be used with both new and old iMac models. Because old models don't have a Bluetooth adapter, a USB-C(male) to Lightning(Male) cable is provided in the packaging. Most PC motherboards don't have USB-C ports, so you might need to either use a USB-C(female) to USB-A(Male) adapter, or a USB-A(male) to Lightning(Male) cable.

To turn the trackpad on, flip the power switch on the top of the pad so that it shows green.

Wired connection

Plug the cable in and try using the trackpad. Sometimes your desktop environment may have the correct configuration added automatically, so no configuration needs to be done.

However, if you cannot move the mouse pointer, then skip to Fixing no pointer movement.

Note: while plugged in, Bluetooth will be turned off.

Wireless connection

If not installed, install Bluez:

root # emerge bluez

Pairing to the pad can be done using the bluetoothctl command, or through a GUI Bluetooth manager, like Blueman:

root # emerge blueman

If the device does not show when scanning, try scanning on another device. If both devices don't find it, try charging the pad.

Once connected, try using the pad. Sometimes your desktop environment may have the correct configuration added automatically, so no configuration needs to be done.

However, if you cannot move the mouse pointer, then skip to Fixing no pointer movement.

Fixing no pointer movement

If your desktop environment has not set up configuration for it automatically, you might notice that the pad only responds to clicks. You might also find that you can only move the mouse cursor when clicking and holding on the pad.

To fix this, run the following command:

user $ xinput list

It should produce output similar to this:

⎡ Virtual core pointer                    	id=2	[master pointer  (3)]
⎜   ↳ Virtual core XTEST pointer              	id=4	[slave  pointer  (2)]
⎜   ↳ SONiX USB DEVICE Keyboard               	id=12	[slave  pointer  (2)]
⎜   ↳ SONiX USB DEVICE Wireless Radio Control 	id=13	[slave  pointer  (2)]
⎜   ↳ E-Signal/A-One COUGAR Minos X2 Keyboard 	id=8	[slave  pointer  (2)]
⎜   ↳ E-Signal/A-One COUGAR Minos X2          	id=9	[slave  pointer  (2)]
⎜   ↳ Apple Inc. Magic Trackpad 2             	id=14	[slave  pointer  (2)]
⎣ Virtual core keyboard                   	id=3	[master keyboard (2)]
    ↳ Virtual core XTEST keyboard             	id=5	[slave  keyboard (3)]
    ↳ Power Button                            	id=6	[slave  keyboard (3)]
    ↳ Power Button                            	id=7	[slave  keyboard (3)]
    ↳ SONiX USB DEVICE                        	id=11	[slave  keyboard (3)]
    ↳ Trust GXT 242 Microphone                	id=10	[slave  keyboard (3)]

Find the line where it says Apple Inc. Magic Trackpad 2 and remember its ID, in this case 14. If connected using a wired connection, there may be 2 IDs. You can use either.

Next, using the ID, list the props for the trackpad:

user $ xinput list-props 14

This should return output similar to this:

Device 'Apple Inc. Magic Trackpad 2':
	Device Enabled (155):	1
	Coordinate Transformation Matrix (157):	1.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 1.000000
	Device Accel Profile (282):	1
	Device Accel Constant Deceleration (283):	2.500000
	Device Accel Adaptive Deceleration (284):	1.000000
	Device Accel Velocity Scaling (285):	12.500000
	Synaptics Edges (822):	-3374, 3630, -2205, 2314
	Synaptics Finger (823):	2, 2, 0
	Synaptics Tap Time (824):	180
	Synaptics Tap Move (825):	402
	Synaptics Tap Durations (826):	180, 180, 100
	Synaptics ClickPad (827):	1
	Synaptics Middle Button Timeout (828):	0
	Synaptics Two-Finger Pressure (829):	279
	Synaptics Two-Finger Width (830):	7
	Synaptics Scrolling Distance (831):	182, 182
	Synaptics Edge Scrolling (832):	0, 0, 0
	Synaptics Two-Finger Scrolling (833):	1, 0
	Synaptics Move Speed (834):	1.000000, 1.750000, 0.021875, 0.000000
	Synaptics Off (835):	1
	Synaptics Locked Drags (836):	0
	Synaptics Locked Drags Timeout (837):	5000
	Synaptics Tap Action (838):	0, 0, 0, 0, 1, 3, 2
	Synaptics Click Action (839):	1, 3, 2
	Synaptics Circular Scrolling (840):	0
	Synaptics Circular Scrolling Distance (841):	0.100000
	Synaptics Circular Scrolling Trigger (842):	0
	Synaptics Circular Pad (843):	0
	Synaptics Palm Detection (844):	1
	Synaptics Palm Dimensions (845):	10, 198
	Synaptics Coasting Speed (846):	20.000000, 50.000000
	Synaptics Pressure Motion (847):	29, 158
	Synaptics Pressure Motion Factor (848):	1.000000, 1.000000
	Synaptics Grab Event Device (849):	0
	Synaptics Gestures (850):	1
	Synaptics Capabilities (851):	1, 0, 0, 1, 1, 1, 0
	Synaptics Pad Resolution (852):	44, 47
	Synaptics Area (853):	0, 0, 0, 0
	Synaptics Soft Button Areas (854):	0, 0, 0, 0, 0, 0, 0, 0
	Synaptics Noise Cancellation (855):	45, 45
	Device Product ID (274):	76, 613
	Device Node (275):	"/dev/input/event19"

The reason for the touch surface not being active is a wrong integer value for the Synaptics Finger property. Using its ID(in this case 823), run the following command:

user $ xinput set-prop 14 823 2, 2, 0

Now, you might notice you can use your touchpad as normal, however tapping may not work as expected. Additionally, you might want to enable palm detection if using right in front of your keyboard.

Enabling palm detection

You can enable palm detection by setting the Synaptics Palm Detection property like this:

user $ xinput set-prop 14 844 1

Enabling tap to click

If you want to use the same click gestures by just tapping(1 finger left click, 2 fingers right click, 3 fingers middle click), you can enable tap to click using synclient:

user $ synclient TapButton1=1 TapButton2=3 TapButton3=2

will map tap gestures to their corresponding buttons.

Enabling scrolling

If not yet enabled, you can enable vertical 2-finger scrolling using synclient:

user $ synclient VertTwoFingerScroll=1

You can also enable horizontal scrolling like this:

user $ synclient HorizTwoFingerScroll=1

Getting the battery capacity

To get the battery capacity of your trackpad, get its MAC address, either from your graphical manager, or from bluetoothctl:

user $ bluetoothctl devices

Then, cat the following file:

user $ cat /sys/class/power_supply/hid-YOURMACADDRESS-battery/capacity

Connecting automatically on startup and wake

Additional configuration needs to be done, to not only connect, but also keep your settings after startup or awake events.

First, make sure you have paired and connected to the device. Next, make sure the device is trusted:

user $ bluetoothctl trust YOURMACADDRESSHERE

Next, run the following sed command to enable automatic connection:

root # sed -i "s/#AutoEnable=true/AutoEnable=true/g" /etc/bluetooth/main.conf

After that, edit /etc/bluetooth/main.conf, uncomment the following line:

   /etc/bluetooth/main.conf
#ReconnectUUIDs=00001112-0000-1000-8000-00805f9b34fb,0000111f-0000-1000-8000-00805f9b34fb,0000110a-0000-1000-8000-00805f9b34fb,0000110b-0000-1000-8000-00805f9b34fb

and add the device UUIDs of the trackpad to the list. You can get them using:

user $ bluetoothctl info

The output should look like this:

Device 34:B1:EB:EB:CB:E9 (public)
	Name: Magic Trackpad
	Alias: Magic Trackpad
    ...
	UUID: Human Interface Device... (00001124-0000-1000-8000-00805f9b34fb)
	UUID: PnP Information           (00001200-0000-1000-8000-00805f9b34fb)
    ...

You need to add these 2 UUIDs to the Template:Code line.

Then, restart the bluetooth service:

root # /etc/init.d/bluetooth restart

You will notice that the device will work, but with the same issues, we previously fixed.

Add your desired configuration in a shell script, similar to this:

   reload-magic-trackpad.sh
#!/bin/bash
xinput set-prop "Apple Inc. Magic Trackpad 2" "Synaptics Two-Finger Scrolling" 1, 1
xinput set-prop "Apple Inc. Magic Trackpad 2" "Synaptics Finger" 2, 2, 0
xinput set-prop "Apple Inc. Magic Trackpad 2" "Synaptics Palm Detection" 1
synclient TapButton1=1 TapButton2=3 TapButton3=2 VertTwoFingerScroll=1 HorizTwoFingerScroll=1

More features and further learning

This page simply scrapes the surface of configuring your Magic Trackpad, as it's written to accommodate the most common workload. More features can be modified using xinput and synclient. You can list all synclient options using the following command:

user $ synclient -l

You can also learn about these options on the synaptics man page:

user $ man synaptics