Skip to content

Commit

Permalink
Added automated script to switch to old touchbar driver (#553)
Browse files Browse the repository at this point in the history
  • Loading branch information
angelobdev authored Jul 5, 2024
1 parent e7a65c1 commit 0b70fb8
Showing 1 changed file with 119 additions and 0 deletions.
119 changes: 119 additions & 0 deletions docs/guides/postinstall.md
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,125 @@ blacklist cdc_mbim" >> /etc/modprobe.d/blacklist.conf'
Please note that this internal ethernet interface is required for various services including touchid that there currently is no Linux support for. In the future, if any of these services are supported, you'll need to undo this.

# How to use old touchbar driver

Some users want to use `apple-touchbar` driver instead of `tiny-dfr`, here's how to do so:
1. Create and edit the script file: `switch-touchbar-drv.sh`
2. Paste this content:
```bash
#!/bin/bash
# Switching to root
sudo $0
if [ "$EUID" -ne 0 ]; then
exit 1
fi
# Detecting Package Manager
PM_INSTALL=""
PM_REMOVE="null"
if apt --help >/dev/null 2>&1; then
echo "Debian-based OS are not supported!"
echo "Please use 'sudo touchbar --switch' instead."
exit 1
elif dnf >/dev/null 2>&1; then
echo "Fedora-based OS are not supported!"
exit 1
elif pacman -h >/dev/null 2>&1; then
PM_INSTALL="pacman -Sy"
PM_REMOVE="pacman -Rnsu"
else
echo "No valid package manager has been found!"
exit 1
fi
# Checking dependencies
echo "Cheking dependencies..."
if ! command -v git &>/dev/null; then # GIT
echo "git could not be found! Installing..."
$PM_INSTALL git
fi
if ! command -v dkms &>/dev/null; then # DKMS
echo "dkms could not be found! Installing..."
$PM_INSTALL dkms
fi
# SWITCH TO OLD DRIVER
if [[ "$1" == "--old" ]]; then
# Switching to old driver
echo "Switching to old driver..."
# Removing tiny-dfr
$PM_REMOVE tiny-dfr
# Blacklisting new driver
echo "Blacklisting new touchbar driver..."
cat <<- EOF > /etc/modprobe.d/touchbar.conf
# Disable new Apple Touchbar driver
blacklist appletbdrm
blacklist hid_appletb_kbd
blacklist hid_appletb_bl
EOF
# Installing old driver
echo "Cloning driver repo..."
git clone https://github.com/AdityaGarg8/apple-touchbar-drv /usr/src/apple-touchbar-0.1
dkms install -m apple-touchbar -v 0.1
# SWITCH TO NEW DRIVER
elif [[ "$1" == "--new" ]]; then
# Switching to new driver
echo "Switching to new driver..."
# Installing tiny-dfr
$PM_INSTALL tiny-dfr
# Removing blacklist conf
rm /etc/modprobe.d/touchbar.conf
# Removing old driver
dkms unbuild -m apple-touchbar -v 0.1 -k all
rm -r /usr/src/apple-touchbar-0.1
else
echo "Choose a valid option:"
echo "--new (Switches to the new driver)"
echo "--old (Switches to the old driver)"
exit 1
fi
# DONE!
echo "All done! You can now reboot..."
read -p "Do you want to reboot now? [y/N]" -n 1 -r -s
echo
if [[ $REPLY =~ ^[Yy]$ ]]; then
echo "Rebooting..."
reboot
fi
```
3. Make the script executable: `chmod +x switch-touchbar-drv.sh`
4. Run the script `./switch-touchbar-drv.sh --old`
!!! note
If you are on a Debian-based distro (e.g Ubuntu) just run `sudo touchbar --switch`
!!! note
If you want to revert changes run `./switch-touchbar-drv.sh --new`
# Suspend Workaround
S3 suspend has been broken since macOS Sonoma, it has never been fixed, but this workaround will make deep suspend work:
Expand Down

0 comments on commit 0b70fb8

Please sign in to comment.