chore: Update priv-write patch for HHD

This commit is contained in:
Kyle Gospodnetich 2024-07-06 14:41:40 -07:00
parent 56101cc5aa
commit 49cb506760

View File

@ -2,17 +2,16 @@ diff --git a/usr/bin/steamos-polkit-helpers/steamos-priv-write b/usr/bin/steamos
index 8fcd1d4..4b47d21 100755 index 8fcd1d4..4b47d21 100755
--- a/usr/bin/steamos-polkit-helpers/steamos-priv-write --- a/usr/bin/steamos-polkit-helpers/steamos-priv-write
+++ b/usr/bin/steamos-polkit-helpers/steamos-priv-write +++ b/usr/bin/steamos-polkit-helpers/steamos-priv-write
@@ -3,6 +3,9 @@ @@ -3,6 +3,8 @@
set -euo pipefail set -euo pipefail
shopt -s nullglob shopt -s nullglob
+source /etc/default/steam-hardware-control +source /etc/default/steam-hardware-control
+SYS_ID="$(cat /sys/devices/virtual/dmi/id/product_name)"
+ +
if [[ $EUID -ne 0 ]]; if [[ $EUID -ne 0 ]];
then then
exec pkexec --disable-internal-agent "$0" "$@" exec pkexec --disable-internal-agent "$0" "$@"
@@ -37,13 +40,14 @@ function MatchFilenamePattern() @@ -37,13 +39,14 @@
function CommitWrite() function CommitWrite()
{ {
@ -29,42 +28,48 @@ index 8fcd1d4..4b47d21 100755
exit 0 exit 0
} }
@@ -65,15 +69,35 @@ if MatchFilenamePattern "$WRITE_PATH" "/dev/drm_dp_aux0"; then @@ -65,15 +68,41 @@
fi fi
if MatchFilenamePattern "$WRITE_PATH" "/sys/class/drm/card*/device/power_dpm_force_performance_level"; then if MatchFilenamePattern "$WRITE_PATH" "/sys/class/drm/card*/device/power_dpm_force_performance_level"; then
- CommitWrite - CommitWrite
+ if /usr/libexec/hwsupport/valve-hardware || [[ "$ENABLE_HARDWARE_CONTROL_ON_NON_DECK_HARDWARE" = 1 ]]; then + if systemctl list-units | grep hhd@; then
+ for i in $(ls /sys/class/drm/card*/device/power_dpm_force_performance_level) + echo "commit: Skipped $WRITE_VALUE -> $WRITE_PATH - controlled by HHD" | systemd-cat -t p-steamos-priv-write -p warning
+ do + elif /usr/libexec/hwsupport/valve-hardware || [[ "$ENABLE_HARDWARE_CONTROL_ON_NON_DECK_HARDWARE" = 1 ]]; then
+ WRITE_PATH="$i" + for i in $(ls /sys/class/drm/card*/device/power_dpm_force_performance_level)
+ CommitWrite + do
+ done + WRITE_PATH="$i"
+ else + CommitWrite
+ echo "commit: Skipped $WRITE_VALUE -> $WRITE_PATH - see /etc/default/steam-hardware-control" | systemd-cat -t p-steamos-priv-write -p warning + done
+ fi + else
+ echo "commit: Skipped $WRITE_VALUE -> $WRITE_PATH - see /etc/default/steam-hardware-control" | systemd-cat -t p-steamos-priv-write -p warning
+ fi
fi fi
if MatchFilenamePattern "$WRITE_PATH" "/sys/class/drm/card*/device/pp_od_clk_voltage"; then if MatchFilenamePattern "$WRITE_PATH" "/sys/class/drm/card*/device/pp_od_clk_voltage"; then
- CommitWrite - CommitWrite
+ if /usr/libexec/hwsupport/valve-hardware || [[ "$ENABLE_HARDWARE_CONTROL_ON_NON_DECK_HARDWARE" = 1 ]]; then + if systemctl list-units | grep hhd@; then
+ for i in $(ls /sys/class/drm/card*/device/pp_od_clk_voltage) + echo "commit: Skipped $WRITE_VALUE -> $WRITE_PATH - controlled by HHD" | systemd-cat -t p-steamos-priv-write -p warning
+ do + elif /usr/libexec/hwsupport/valve-hardware || [[ "$ENABLE_HARDWARE_CONTROL_ON_NON_DECK_HARDWARE" = 1 ]]; then
+ WRITE_PATH="$i" + for i in $(ls /sys/class/drm/card*/device/pp_od_clk_voltage)
+ CommitWrite + do
+ done + WRITE_PATH="$i"
+ else + CommitWrite
+ echo "commit: Skipped $WRITE_VALUE -> $WRITE_PATH - see /etc/default/steam-hardware-control" | systemd-cat -t p-steamos-priv-write -p warning + done
+ fi + else
+ echo "commit: Skipped $WRITE_VALUE -> $WRITE_PATH - see /etc/default/steam-hardware-control" | systemd-cat -t p-steamos-priv-write -p warning
+ fi
fi fi
if MatchFilenamePattern "$WRITE_PATH" "/sys/class/hwmon/hwmon*/power*_cap"; then if MatchFilenamePattern "$WRITE_PATH" "/sys/class/hwmon/hwmon*/power*_cap"; then
- CommitWrite - CommitWrite
+ if /usr/libexec/hwsupport/valve-hardware || [[ "$ENABLE_HARDWARE_CONTROL_ON_NON_DECK_HARDWARE" = 1 ]]; then + if systemctl list-units | grep hhd@; then
+ CommitWrite + echo "commit: Skipped $WRITE_VALUE -> $WRITE_PATH - controlled by HHD" | systemd-cat -t p-steamos-priv-write -p warning
+ else + elif /usr/libexec/hwsupport/valve-hardware || [[ "$ENABLE_HARDWARE_CONTROL_ON_NON_DECK_HARDWARE" = 1 ]]; then
+ echo "commit: Skipped $WRITE_VALUE -> $WRITE_PATH - see /etc/default/steam-hardware-control" | systemd-cat -t p-steamos-priv-write -p warning + CommitWrite
+ fi + else
+ echo "commit: Skipped $WRITE_VALUE -> $WRITE_PATH - see /etc/default/steam-hardware-control" | systemd-cat -t p-steamos-priv-write -p warning
+ fi
fi fi
if MatchFilenamePattern "$WRITE_PATH" "/sys/devices/platform/*/*/*/iio:device*/in_illuminance_integration_time"; then if MatchFilenamePattern "$WRITE_PATH" "/sys/devices/platform/*/*/*/iio:device*/in_illuminance_integration_time"; then