#!/bin/bash # # This is needed to load a third-party driver that duplicates but conflicts # with the mainline MagicTrackpad driver. The changes from this driver are in # mainline as of 4.20 so this can be removed then. # # # Should be run as root from a udev hook # Also needs to be run as the user to set xinput settings # # /etc/udev/rules.d/83-magicmouse.rules # KERNEL=="mouse[0-9]*", SUBSYSTEM=="input", ATTRS{uniq}=="04:4b:ed:eb:0d:d8", RUN+="/home/ANT.AMAZON.COM/crutem/bin/fixmouse.sh" if (( $EUID == 0 )); then if ! lsmod | grep hid_magicmouse &>/dev/null; then >&2 echo "Loading Magic Mouse Driver" insmod $(realpath ~crutem/.local/lib/hid-magicmouse.ko) sleep 2 fi POINTER=$(for m in /dev/input/mouse*; do udevadm info $m | grep DEVPATH= | egrep -o '0005:004C:0265.[0-9A-F]+'; done) if [ ! -d "/sys/bus/hid/drivers/magicmouse/$POINTER" ]; then echo "$POINTER" > /sys/bus/hid/drivers/hid-generic/unbind echo "$POINTER" > /sys/bus/hid/drivers/magicmouse/bind fi fi