From e5821e9b5def49e91d6818a60732fd174fbf7627 Mon Sep 17 00:00:00 2001 From: Kyle Gospodnetich Date: Mon, 2 Oct 2023 23:18:18 -0700 Subject: [PATCH 1/3] fix: Modify HandyGCCS setup to be explicit on device, automatically install Steam Patch (https://github.com/Maclay74/steam-patch/) on Handhelds that require it. --- .../shared/usr/bin/bazzite-hardware-setup | 18 +++++++++++++----- .../desktop/shared/usr/bin/bazzite-user-setup | 16 +++++++++++++++- 2 files changed, 28 insertions(+), 6 deletions(-) diff --git a/system_files/desktop/shared/usr/bin/bazzite-hardware-setup b/system_files/desktop/shared/usr/bin/bazzite-hardware-setup index 2d679067..c2f6cc5b 100755 --- a/system_files/desktop/shared/usr/bin/bazzite-hardware-setup +++ b/system_files/desktop/shared/usr/bin/bazzite-hardware-setup @@ -6,7 +6,7 @@ IMAGE_FLAVOR=$(jq -r '."image-flavor"' < $IMAGE_INFO) BASE_IMAGE_NAME=$(jq -r '."base-image-name"' < $IMAGE_INFO) # SCRIPT VERSION -HWS_VER=4 +HWS_VER=5 HWS_VER_FILE="/etc/bazzite/hws_version" HWS_VER_RAN=$(cat $HWS_VER_FILE) @@ -19,6 +19,7 @@ KNOWN_IMAGE_FLAVOR=$(cat $KNOWN_IMAGE_FLAVOR_FILE) # GLOBAL SYS_ID="$(cat /sys/devices/virtual/dmi/id/product_name)" GPU_ID=$(lspci -k | grep -A 3 -E "(VGA|3D)") +PRODUCT_NAME="$(cat /sys/devices/virtual/dmi/id/product_name)" KARGS=$(rpm-ostree kargs) NEEDED_KARGS="" echo "Current kargs: $KARGS" @@ -139,12 +140,19 @@ if [[ -f $HWS_VER_FILE && $HWS_VER = $HWS_VER_RAN ]]; then fi if [[ $IMAGE_NAME =~ "deck" ]]; then - if [[ ":Jupiter:" =~ ":$SYS_ID:" ]]; then - # Future updates to deck on jupiter here + if [[ ":Jupiter:" =~ ":$SYS_ID:" ]]; then + # Future updates to Deck on Jupiter here else echo "Generic device detected. Performing setup..." - - systemctl enable --now handycon.service + if [[ \ + ":AYA NEO:AYANEO:AIR Plus:" =~ ":$PRODUCT_NAME:" || \ + "ONEXPLAYER" =~ "$PRODUCT_NAME" || \ + "AOKZOE" =~ "$PRODUCT_NAME" || \ + ":G1619-01:G1621-02:MicroPC:" =~ ":$SYS_ID:" \ + ]]; then + echo "HandyGCCS supported handheld detected, enabling." + systemctl enable --now handycon.service + fi systemctl disable --now jupiter-fan-control.service systemctl disable --now vpower.service systemctl disable --now jupiter-biosupdate.service diff --git a/system_files/desktop/shared/usr/bin/bazzite-user-setup b/system_files/desktop/shared/usr/bin/bazzite-user-setup index e8f329ae..992b4325 100755 --- a/system_files/desktop/shared/usr/bin/bazzite-user-setup +++ b/system_files/desktop/shared/usr/bin/bazzite-user-setup @@ -1,7 +1,7 @@ #!/usr/bin/env bash # SCRIPT VERSION -USER_SETUP_VER=2 +USER_SETUP_VER=3 USER_SETUP_VER_FILE="$HOME/.bazzite-configured" USER_SETUP_VER_RAN=$(cat $USER_SETUP_VER_FILE) @@ -14,6 +14,8 @@ fi IMAGE_INFO="/usr/share/ublue-os/image-info.json" IMAGE_NAME=$(jq -r '."image-name"' < $IMAGE_INFO) BASE_IMAGE_NAME=$(jq -r '."base-image-name"' < $IMAGE_INFO) +SYS_ID="$(cat /sys/devices/virtual/dmi/id/product_name)" +PRODUCT_NAME="$(cat /sys/devices/virtual/dmi/id/product_name)" if [[ $BASE_IMAGE_NAME =~ "kinoite" ]]; then echo 'Running setup for Kinoite' @@ -109,6 +111,18 @@ else fi fi +# Steam Patch setup +if [[ \ + ":ROG Ally RC71L_RC71L:" =~ ":$SYS_ID:" || \ + ":AYA NEO:AYANEO:AIR Plus:" =~ ":$PRODUCT_NAME:" || \ + "ONEXPLAYER" =~ "$PRODUCT_NAME" || \ + "AOKZOE" =~ "$PRODUCT_NAME" || \ + ":G1619-01:G1621-02:MicroPC:" =~ ":$SYS_ID:" \ + ]]; then + echo "Steam Patch supported handheld detected, installing (https://github.com/Maclay74/steam-patch/)" + curl -L https://github.com/Maclay74/steam-patch/releases/latest/download/install.sh | sh +fi + # Enable NTP timedatectl set-ntp true From fd5be6585fc8b5931583de23f900364d04055648 Mon Sep 17 00:00:00 2001 From: Kyle Gospodnetich Date: Tue, 3 Oct 2023 18:14:20 -0700 Subject: [PATCH 2/3] chore: Manually install steam-patch, use polkit rules to allow it to run with root permissions as a user service --- .../usr/lib/systemd/user/steam-patch.service | 11 ++++++++++ .../actions/org.bazzite.steam-fix.policy | 21 +++++++++++++++++++ .../share/polkit-1/rules.d/70-steam-fix.rules | 6 ++++++ .../shared/usr/bin/bazzite-hardware-setup | 6 +++++- .../desktop/shared/usr/bin/bazzite-user-setup | 4 ++-- 5 files changed, 45 insertions(+), 3 deletions(-) create mode 100644 system_files/deck/shared/usr/lib/systemd/user/steam-patch.service create mode 100644 system_files/deck/shared/usr/share/polkit-1/actions/org.bazzite.steam-fix.policy create mode 100644 system_files/deck/shared/usr/share/polkit-1/rules.d/70-steam-fix.rules diff --git a/system_files/deck/shared/usr/lib/systemd/user/steam-patch.service b/system_files/deck/shared/usr/lib/systemd/user/steam-patch.service new file mode 100644 index 00000000..1271b52f --- /dev/null +++ b/system_files/deck/shared/usr/lib/systemd/user/steam-patch.service @@ -0,0 +1,11 @@ +[Unit] +Description=Steam Patches Loader +Wants=network.target +After=network.target + +[Service] +Type=simple +ExecStart=/usr/bin/pkexec /usr/bin/steam-patch --user=%u + +[Install] +WantedBy=multi-user.target \ No newline at end of file diff --git a/system_files/deck/shared/usr/share/polkit-1/actions/org.bazzite.steam-fix.policy b/system_files/deck/shared/usr/share/polkit-1/actions/org.bazzite.steam-fix.policy new file mode 100644 index 00000000..4b9db607 --- /dev/null +++ b/system_files/deck/shared/usr/share/polkit-1/actions/org.bazzite.steam-fix.policy @@ -0,0 +1,21 @@ + + + + + Bazzite + https://github.com/ublue-os/bazzite/ + + + Some Steam patches, fixing broken Steam features on Asus Rog Ally and other third-party handhelds + package-x-generic + + yes + yes + yes + + /usr/bin/steam-patch + + + diff --git a/system_files/deck/shared/usr/share/polkit-1/rules.d/70-steam-fix.rules b/system_files/deck/shared/usr/share/polkit-1/rules.d/70-steam-fix.rules new file mode 100644 index 00000000..528de951 --- /dev/null +++ b/system_files/deck/shared/usr/share/polkit-1/rules.d/70-steam-fix.rules @@ -0,0 +1,6 @@ +polkit.addRule(function(action, subject) { + if (action.id == "org.bazzite.steam-patch.pkexec" && + subject.isInGroup("wheel")) { + return polkit.Result.YES; + } +}); \ No newline at end of file diff --git a/system_files/desktop/shared/usr/bin/bazzite-hardware-setup b/system_files/desktop/shared/usr/bin/bazzite-hardware-setup index c2f6cc5b..7991d3c2 100755 --- a/system_files/desktop/shared/usr/bin/bazzite-hardware-setup +++ b/system_files/desktop/shared/usr/bin/bazzite-hardware-setup @@ -150,8 +150,12 @@ if [[ $IMAGE_NAME =~ "deck" ]]; then "AOKZOE" =~ "$PRODUCT_NAME" || \ ":G1619-01:G1621-02:MicroPC:" =~ ":$SYS_ID:" \ ]]; then - echo "HandyGCCS supported handheld detected, enabling." + echo "HandyGCCS supported handheld detected, enabling handycon & steam-patch." systemctl enable --now handycon.service + systemctl enable --now --global steam-patch.service + elif [[ ":ROG Ally RC71L_RC71L:" =~ ":$SYS_ID:" ]] + echo "ROG Ally detected. Enabling steam-patch." + systemctl enable --now --global steam-patch.service fi systemctl disable --now jupiter-fan-control.service systemctl disable --now vpower.service diff --git a/system_files/desktop/shared/usr/bin/bazzite-user-setup b/system_files/desktop/shared/usr/bin/bazzite-user-setup index 992b4325..3d9ce815 100755 --- a/system_files/desktop/shared/usr/bin/bazzite-user-setup +++ b/system_files/desktop/shared/usr/bin/bazzite-user-setup @@ -119,8 +119,8 @@ if [[ \ "AOKZOE" =~ "$PRODUCT_NAME" || \ ":G1619-01:G1621-02:MicroPC:" =~ ":$SYS_ID:" \ ]]; then - echo "Steam Patch supported handheld detected, installing (https://github.com/Maclay74/steam-patch/)" - curl -L https://github.com/Maclay74/steam-patch/releases/latest/download/install.sh | sh + mkdir -p "$HOME/.steam/steam/" + touch "$HOME/.steam/steam/.cef-enable-remote-debugging" fi # Enable NTP From c3fbf31f2f50aebeb2ea46b545332f575456209c Mon Sep 17 00:00:00 2001 From: Kyle Gospodnetich Date: Tue, 3 Oct 2023 18:15:19 -0700 Subject: [PATCH 3/3] chore: Pull steam-patch binary from the latest GitHub release --- Containerfile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Containerfile b/Containerfile index f06e7203..53b7c98f 100644 --- a/Containerfile +++ b/Containerfile @@ -350,7 +350,8 @@ RUN rpm-ostree install \ wget https://gitlab.com/evlaV/linux-firmware-neptune/-/raw/jupiter/cs35l41-dsp1-spk-prot.wmfw -O /tmp/linux-firmware-neptune/cs35l41-dsp1-spk-prot.wmfw && \ xz --check=crc32 /tmp/linux-firmware-neptune/cs35l41-dsp1-spk-{cali.bin,cali.wmfw,prot.bin,prot.wmfw} && \ mv -vf /tmp/linux-firmware-neptune/* /usr/lib/firmware/cirrus/ && \ - rm -rf /tmp/linux-firmware-neptune + rm -rf /tmp/linux-firmware-neptune && \ + wget $(jq -r '.assets[].browser_download_url | select(endswith("steam-patch"))' <<< $(curl -s 'https://api.github.com/repos/Maclay74/steam-patch/releases' | jq -r "first(.[] | select(.prerelease == "false"))")) -O /usr/bin/steam-patch # Install Steam and Lutris into their own OCI layer # Add bootstraplinux_ubuntu12_32.tar.xz used by gamescope-session (Thanks ChimeraOS! - https://chimeraos.org/)