Magic Trackpad 2 with Xorg


Niels - November 11, 2021 - Updated: November 12, 2021

Not quite happy with the solution described in my original post, I took another look at the problem and found:

  1. Xorg defaults to the libinput driver (just like Wayland), not the synaptics driver.
  2. The libinput driver complained about a parse error in /usr/share/libinput/50-system-lenovo.quirks.

I ignored the parse error the first time around because I do not have any lenovo input devices on this computer and assumed the parse error would not affect other devices. However, a parse error in 1 quirks file, does cause all quirks files to be ignored.

Deleting the faulty quirks file resolved the issue. My Magic Trackpad 2 now functions properly with Xorg.

Original post

I've been using an Apple Magic Trackpad 2~~ with my Ubuntu desktop for the past two years or so. When using Wayland this works perfectly out-of-the-box.

Not so much with Xorg. It detects the trackpad and loads the driver, but the cursor won't move unless I press the trackpad at the same time.

Creating /etc/X11/xorg.conf.d/10-touchpad.conf fixed this:

Section "InputClass"
    Option "FingerLow" "2"
    Option "FingerHigh" "2"
EndSection

If you have more - potentially conflicting - input devices you'll want to expand that to:

Section "InputClass"
    Identifier "Apple Magic Trackpad"
    MatchIsTouchpad "on"
    MatchUSBID "05ac:0265"
    Driver "synaptics"
    Option "FingerLow" "2"
    Option "FingerHigh" "2"
EndSection

Use lsusb to check that the USBID is correct for your trackpad:

❯ lsusb
...
Bus 001 Device 005: ID 05ac:0265 Apple, Inc. Magic Trackpad 2
...
 

Jigsaw


Niels - October 31, 2021

Whoops. I accidentally wiped the VM running my Wordpress blog.

Rather than restore the Wordpress blog I decided to go with Jigsaw this time. Jigsaw is one of many static site generators, or as the cool kids say, a way to use Jamstack.

Jamstack

What makes a Jamstack site more than just a regular static website is its use of Javascript and API services to add dynamic features to your website.

The JAM in Jamstack stands for Javascript, API and Markup

I'm not a fan of microservice architectures like Jamstack as it tends to add complexity, cost and a dependency on potentially unreliable 3rd-parties.

That said, I don't need much functionality on my blog. This is JAMstack with very little J and no A. I may add comments at some point, but only if I can self-host them.

Wordpress

The founding developer of Wordpress, Matt Mullenweg, has this to say about it:

JAMstack is a regression for the vast majority of the people adopting it

Matt is biased, of course, but I agree with his arguments. Read them in more detail at thenewstack.io.

 

Ubuntu on the Legion 5 Pro (2021)


Niels - June 8, 2021

Heads up: I’m not a gamer. A combination of specs, pricing, availability and urgency led me to purchase this laptop for productivity reasons. My run-through may not cover all aspects needed for gaming.

As my work depends on this laptop, I did purchase the additional on-site support.

Keyboard Shortcuts

If the RGB show on the keyboard annoys you, use Fn+SPACE to select a less annoying mode for now. Also: Fn+L to toggle the Legion logo, Fn+Q to toggle thermal profile. These shortcuts work on both Windows and Linux.

Windows

I expect support to want to deal with Windows only, so I left Windows installed.

Even if you decide to remove Windows, I recommend you set it up first and use it to apply any BIOS or firmware updates prior to installing Ubuntu. (As it turns out, my laptop already shipped with the latest BIOS version.)

The factory Windows install uses about 60GB, so I shrunk the Windows-SSD down to 75GB. You can use the Disk Management tool to do so.

BIOS

Shutdown the laptop and restart it while pressing F2. This gets you into the BIOS. I made the following changes: * Graphic Device: Dynamic Graphics (you will need to use nomodeset in GRUB if you don’t do this) * Boot > PXE Boot to LAN: Disabled;

That’s it. I left Secure Boot enabled. Ubuntu and Ubuntu based Linux distributions have no problem with it.

Ubuntu

Install Ubuntu. How to install Ubuntu has been well documented, I won’t repeat it here.

You’ll notice that while the brightness function keys appear to work they do not actually change the brightness. You can fix this by editing /etc/default/grub and adding the amdgpu.backlight parameter:

GRUB_CMDLINE_LINUX="amdgpu.backlight=0"

Run update-grub, reboot, and things will work.

Battery Conservation Mode

Battery conservation mode prevents your laptop battery from charging fully and keeps it around 60% instead. This should aid the longevity of the battery.

For convenience I created a systemd unit called /etc/systemd/system/battery-conservation-mode.service with the following content:

[Unit]
Description=Battery Conservation Mode

[Service]
Type=oneshot
ExecStart=/usr/bin/bash -c 'echo 1 > "/sys/devices/pci0000:00/0000:00:14.3/PNP0C09:00/VPC2004:00/conservation_mode"'
ExecStop=/usr/bin/bash -c 'echo 0 > "/sys/devices/pci0000:00/0000:00:14.3/PNP0C09:00/VPC2004:00/conservation_mode"'
RemainAfterExit=yes

[Install]
WantedBy=multi-user.target

Which we then activate using:

systemctl daemon-reload 
systemctl start battery-conservation-mode 
systemctl stop battery-conservation-mode 
systemctl enable battery-conservation-mode 

Function Lock

Maybe you never use the F1, F2,.. keys and just want them to function them as permanent media keys (for volume control, etc.) instead. You can do this by enabling the Fn Lock:

echo 1 > "/sys/devices/pci0000:00/0000:00:14.3/PNP0C09:00/VPC2004:00/fn_lock"

Just like the battery conservation mode, you could put this in a systemd unit to enable it automatically at start-up.

File System

Ubuntu comes with periodic SSD trimming out of the box. No need to enable that yourself. If you use encrypted partitions like I do, Ubuntu also enabled discard in crypttab automatically. Some changes I made to fstab: