I'm trying to get the magic mouse 2 scrolling setup on Ubuntu 20.04. I've followed the instructions from the Github driver page - https://github.com/rohitpid/Linux-Magic-Trackpad-2-Driver and this great blog post on tuning the variables http://sneclacson.blogspot.com/2016/09/using-apple-magic-mouse-with-ubuntu-1604.html
I understand these were based on 16.04 which relied on Xorg and since 18 this has moved to Wayland so it's not 100% applicable to this scenario.
I've got scrolling working but i'm unable to make it persistent across reboots. Everytime I restart I need to unload/load the hid_magicmouse module to get it working again.
I created a service to run a script that does this automatically after the user session has loaded but this doesn't appear to be work (I'm guessing it's still executing prior to the mouse connecting):
cat mouse.service
[Unit]
Description=mouse scroll
After=systemd-user-sessions.service
[Service]
ExecStart=/Scripts/mouse.sh
[Install]
WantedBy=multi-user.target
cat /Scripts/mouse.sh
#!/bin/sh
rmmod hid_magicmouse
modprobe hid_magicmouse
Is there a simple way to run this script/service as root when a user logs in given the mouse connects prior to a user logging in?