I'm using Magic Trackpad 2 on Ubuntu 20.04 LTS Sometimes the cursor freezes, as shown below.
When the battery capacity of Magic Trackpad 2 is decreasing, Because it was operating to disconnect the connection to reduce battery consumption, The cursor was stuck, wasn't it?
So, like this person's response, targeting only Magic Trackpad 2 I will apply a patch to the kernel that turns off the function that reduces battery consumption.
This will be helpful.
I don't like the environment for building the Ubuntu kernel when the desktop environment gets dirty. I will build it on Docker.
docker pull ubuntu:focal
docker run -it --name ubuntu ubuntu:focal bash
On the Docker container, install the packages required for kernel build.
apt update && apt upgrade -y
apt install -y git fakeroot build-essential libncurses5 libncurses5-dev libelf-dev binutils-dev devscripts u-boot-tools
sed 's/# deb-src/deb-src/g' -i /etc/apt/sources.list
apt update
apt-get -y build-dep linux
Download the kernel source.
cd
git clone git://git.launchpad.net/~ubuntu-kernel/ubuntu/+source/linux/+git/focal
cd focal
Since the kernel version of Ubuntu desktop is below
uname -a
Linux ryzen 5.4.0-42-generic #46-Ubuntu SMP Fri Jul 10 00:24:02 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
Check out the kernel source for the same version.
git tag -l Ubuntu-5.4.0-42*
Ubuntu-5.4.0-42.46
git checkout -b focal+mt2patch Ubuntu-5.4.0-42.46
Apply the patch.
apt install -y vim
vim drivers/hid/hid-input.c
git diff
diff --git a/drivers/hid/hid-input.c b/drivers/hid/hid-input.c
index dea9cc65bf80..194231ffabee 100644
--- a/drivers/hid/hid-input.c
+++ b/drivers/hid/hid-input.c
@@ -310,6 +310,9 @@ static const struct hid_device_id hid_battery_quirks[] = {
{ HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE,
USB_DEVICE_ID_APPLE_ALU_WIRELESS_ANSI),
HID_BATTERY_QUIRK_PERCENT | HID_BATTERY_QUIRK_FEATURE },
+ { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE,
+ USB_DEVICE_ID_APPLE_MAGICMOUSE),
+ HID_BATTERY_QUIRK_IGNORE },
{ HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_ELECOM,
USB_DEVICE_ID_ELECOM_BM084),
HID_BATTERY_QUIRK_IGNORE },
Build by referring to this article.
First, copy the config file from Ubuntu on the host to docker.
docker cp /boot/config-5.4.0-42-generic ubuntu:/tmp/
Move the copied configuration file on the docker container to reflect the settings.
mkdir ../build
cp /tmp/config-5.4.0-42-generic ../build/.config
scripts/config --file ../build/.config --disable DEBUG_INFO
make O=../build/ oldconfig
Build the kernel and modules.
time make -j 32 O=../build/ LOCALVERSION=-mt2patch
real 5m32.215s
user 140m10.856s
sys 16m43.152s
time make modules -j 32 O=../build/ LOCALVERSION=-mt2patch
real 0m27.762s
user 1m30.672s
sys 1m41.236s
time make bindeb-pkg -j 32 O=../build/ LOCALVERSION=-mt2patch
real 1m3.661s
user 4m49.134s
sys 2m14.784s
Ryzen 9 3950x is explosive ...
As a result of building, the package is created in the directory one level above.
ls -l ../*.deb
-rw-r--r-- 1 root root 11424784 Aug 26 17:45 ../linux-headers-5.4.44-mt2patch_5.4.44-mt2patch-1_amd64.deb
-rw-r--r-- 1 root root 61014544 Aug 26 17:45 ../linux-image-5.4.44-mt2patch_5.4.44-mt2patch-1_amd64.deb
-rw-r--r-- 1 root root 1071376 Aug 26 17:45 ../linux-libc-dev_5.4.44-mt2patch-1_amd64.deb
Here, the file name is 5.4.44-mt2patch
.
The kernel config version is CONFIG_VERSION_SIGNATURE =" Ubuntu 5.4.0-42.46-generic 5.4.44 "
Is it because it was?
Copy these to the host side and install.
docker cp ubuntu:/root/linux-headers-5.4.44-mt2patch_5.4.44-mt2patch-1_amd64.deb .
docker cp ubuntu:/root/linux-image-5.4.44-mt2patch_5.4.44-mt2patch-1_amd64.deb .
docker cp ubuntu:/root/linux-libc-dev_5.4.44-mt2patch-1_amd64.deb .
sudo apt install ./linux-headers-5.4.44-mt2patch_5.4.44-mt2patch-1_amd64.deb
sudo apt install ./linux-image-5.4.44-mt2patch_5.4.44-mt2patch-1_amd64.deb
sudo apt install ./linux-libc-dev_5.4.44-mt2patch-1_amd64.deb
accomplished. From now on, I hope the cursor doesn't freeze.
When the kernel you built doesn't work as expected
You will want to boot with the original kernel.
In that case, modify / etc / default / grub
.
sudo vim /etc/default/grub
The fix is to set GRUB_TIMEOUT_STYLE = menu
to extend the timeout period.
You can now select the kernel to use at boot time.
--- grub.ucf-dist 2020-08-02 19:43:53.512717712 +0900
+++ grub 2020-08-26 17:25:45.283739309 +0900
@@ -4,8 +4,9 @@
# info -f grub -n 'Simple configuration'
GRUB_DEFAULT=0
-GRUB_TIMEOUT_STYLE=hidden
-GRUB_TIMEOUT=0
+#GRUB_TIMEOUT_STYLE=hidden
+GRUB_TIMEOUT_STYLE=menu
+GRUB_TIMEOUT=5
GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`
GRUB_CMDLINE_LINUX_DEFAULT=""
GRUB_CMDLINE_LINUX=""
Update grub when the fix is complete.
sudo update-grub
Recommended Posts