feat: Add hhd for Lenovo Legion

This commit is contained in:
Kyle Gospodnetich 2023-12-21 00:37:35 -08:00
parent f47dc5f14d
commit a7af503577
6 changed files with 47 additions and 8 deletions

View File

@ -467,6 +467,7 @@ RUN rpm-ostree install \
galileo-mura \
powerbuttond \
HandyGCCS \
hhd \
vpower \
ds-inhibit \
steam_notif_daemon \

View File

@ -0,0 +1,3 @@
#!/usr/bin/env bash
systemctl enable --now hhd@$(systemd-escape $1).service

View File

@ -0,0 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE policyconfig PUBLIC
"-//freedesktop//DTD PolicyKit Policy Configuration 1.0//EN"
"http://www.freedesktop.org/standards/PolicyKit/1/policyconfig.dtd">
<policyconfig>
<vendor>Bazzite</vendor>
<vendor_url>https://github.com/ublue-os/bazzite/</vendor_url>
<action id="org.bazzite.hhd.pkexec">
<description>Handheld Daemon is a project that aims to provide utilities for managing handheld devices</description>
<icon_name>package-x-generic</icon_name>
<defaults>
<allow_any>yes</allow_any>
<allow_inactive>yes</allow_inactive>
<allow_active>yes</allow_active>
</defaults>
<annotate key="org.freedesktop.policykit.exec.path">/usr/libexec/bazzite-enable-hhd</annotate>
</action>
</policyconfig>

View File

@ -0,0 +1,6 @@
polkit.addRule(function(action, subject) {
if (action.id == "org.bazzite.hhd.pkexec" &&
subject.isInGroup("wheel")) {
return polkit.Result.YES;
}
});

View File

@ -7,7 +7,7 @@ BASE_IMAGE_NAME=$(jq -r '."base-image-name"' < $IMAGE_INFO)
FEDORA_VERSION=$(jq -r '."fedora-version"' < $IMAGE_INFO)
# SCRIPT VERSION
HWS_VER=17
HWS_VER=18
HWS_VER_FILE="/etc/bazzite/hws_version"
HWS_VER_RAN=$(cat $HWS_VER_FILE)
@ -173,10 +173,15 @@ if [[ $IMAGE_NAME =~ "deck" || $IMAGE_NAME =~ "ally" || $IMAGE_NAME =~ "framegam
systemctl --global enable --now sdgyrodsu.service
else
echo "Generic device detected. Performing setup..."
if [[ ":ROG Ally RC71L_RC71L:AYANEO GEEK:AYANEO 2:AYANEO 2S:AOKZOE A1 AR07:G1618-04:G1619-04:83E1:" =~ ":$SYS_ID:" ]]; then
if [[ ":ROG Ally RC71L_RC71L:AYANEO GEEK:AYANEO 2:AYANEO 2S:AOKZOE A1 AR07:G1618-04:G1619-04:" =~ ":$SYS_ID:" ]]; then
echo "HandyGCCS supported handheld detected, enabling handycon & TDP control..."
systemctl enable --now handycon.service
sed -i 's/ENABLE_HARDWARE_CONTROL_ON_NON_DECK_HARDWARE=0/ENABLE_HARDWARE_CONTROL_ON_NON_DECK_HARDWARE=1/g' /etc/default/steam-hardware-control
elif [[ ":83E1:" =~ ":$SYS_ID:" ]]; then
echo "Lenovo Legion detected. Swapping to X11 by default. Disabling handycon & TDP control..."
systemctl disable --now handycon.service
sed -i 's/DESKTOP_WAYLAND=true/DESKTOP_WAYLAND=false/g' /etc/desktop-wayland
sed -i 's/ENABLE_HARDWARE_CONTROL_ON_NON_DECK_HARDWARE=1/ENABLE_HARDWARE_CONTROL_ON_NON_DECK_HARDWARE=0/g' /etc/default/steam-hardware-control
fi
systemctl disable --now jupiter-fan-control.service
systemctl disable --now vpower.service
@ -185,11 +190,6 @@ if [[ $IMAGE_NAME =~ "deck" || $IMAGE_NAME =~ "ally" || $IMAGE_NAME =~ "framegam
systemctl disable --now ryzenadj.service
systemctl disable --now batterylimit.service
systemctl --global disable --now sdgyrodsu.service
if [[ ":83E1:" =~ ":$SYS_ID:" ]]; then
echo "Lenovo Legion detected. Swapping to X11 by default."
sed -i 's/DESKTOP_WAYLAND=true/DESKTOP_WAYLAND=false/g' /etc/desktop-wayland
fi
fi
fi

View File

@ -7,7 +7,7 @@ FEDORA_VERSION=$(jq -r '."fedora-version"' < $IMAGE_INFO)
SYS_ID="$(cat /sys/devices/virtual/dmi/id/product_name)"
# SCRIPT VERSION
USER_SETUP_VER=18
USER_SETUP_VER=19
USER_SETUP_VER_FILE="$HOME/.bazzite-configured"
USER_SETUP_VER_RAN=$(cat $USER_SETUP_VER_FILE)
USER_SETUP_FEDORA_VER_FILE="$HOME/.bazzite-configured-fedora-version"
@ -84,6 +84,14 @@ else
fi
fi
# HHD Setup for Lenovo Legion Go
if [[ $IMAGE_NAME =~ "deck" ]]; then
if [[ ":83E1:" =~ ":$SYS_ID:" ]]; then
echo 'Enabling HHD'
pkexec /usr/libexec/bazzite-enable-hhd "$USER"
fi
fi
# Previous images used Bazzite-Arch to run Steam, Lutris, and Protontricks on desktop images
if [[ -f "$HOME/.local/share/applications/bazzite-arch-steam.desktop" ]]; then
rm -f "$HOME/.local/share/applications/bazzite-arch-steam.desktop"