2023-07-20 20:09:24 -06:00
|
|
|
diff --git a/usr/bin/steamos-polkit-helpers/steamos-priv-write b/usr/bin/steamos-polkit-helpers/steamos-priv-write
|
2024-09-10 17:27:35 +02:00
|
|
|
index d1456c8..6cb906d 100755
|
2023-07-20 20:09:24 -06:00
|
|
|
--- a/usr/bin/steamos-polkit-helpers/steamos-priv-write
|
|
|
|
+++ b/usr/bin/steamos-polkit-helpers/steamos-priv-write
|
2024-09-10 17:27:35 +02:00
|
|
|
@@ -3,6 +3,8 @@
|
|
|
|
set -euo pipefail
|
|
|
|
shopt -s nullglob
|
|
|
|
|
|
|
|
+source /etc/default/steam-hardware-control
|
|
|
|
+
|
|
|
|
if [[ $EUID -ne 0 ]];
|
|
|
|
then
|
|
|
|
exec pkexec --disable-internal-agent "$0" "$@"
|
|
|
|
@@ -21,15 +23,11 @@ function MatchFilenamePattern()
|
2024-07-07 15:19:11 -07:00
|
|
|
{
|
|
|
|
local path="$1"
|
|
|
|
local pattern="$2"
|
|
|
|
- local IFS=
|
|
|
|
- local candidates=($pattern)
|
|
|
|
|
|
|
|
- for candidate in "${candidates[@]}"; do
|
|
|
|
- if [[ "$path" == "$candidate" ]]; then
|
|
|
|
- true
|
|
|
|
- return
|
|
|
|
- fi
|
|
|
|
- done
|
|
|
|
+ if [[ "$1" == $2 ]]; then
|
|
|
|
+ true;
|
|
|
|
+ return;
|
|
|
|
+ fi
|
|
|
|
|
|
|
|
false;
|
|
|
|
return;
|
2024-09-10 17:27:35 +02:00
|
|
|
@@ -37,13 +35,14 @@ function MatchFilenamePattern()
|
2023-09-19 14:45:51 -07:00
|
|
|
|
2023-07-20 20:09:24 -06:00
|
|
|
function CommitWrite()
|
|
|
|
{
|
2024-06-30 00:34:08 -07:00
|
|
|
+ chmod a+w "$WRITE_PATH"
|
2024-07-07 13:14:29 -07:00
|
|
|
+ Log "chmod a+w: $WRITE_PATH"
|
2023-11-23 10:53:24 -08:00
|
|
|
+
|
2024-06-30 00:34:08 -07:00
|
|
|
if [ -n "$WRITE_VALUE" ]; then
|
|
|
|
Log "commit: $WRITE_VALUE -> $WRITE_PATH"
|
2024-07-07 13:14:29 -07:00
|
|
|
- printf "%s" "$WRITE_VALUE" > "$WRITE_PATH"
|
|
|
|
+ echo "$WRITE_VALUE" > "$WRITE_PATH"
|
2024-06-30 00:34:08 -07:00
|
|
|
fi
|
2023-07-20 20:09:24 -06:00
|
|
|
|
2024-06-30 00:34:08 -07:00
|
|
|
- chgrp deck "$WRITE_PATH"
|
|
|
|
- chmod g+w "$WRITE_PATH"
|
|
|
|
exit 0
|
2023-07-20 20:09:24 -06:00
|
|
|
}
|
|
|
|
|
2024-09-10 17:27:35 +02:00
|
|
|
@@ -65,15 +64,35 @@ if MatchFilenamePattern "$WRITE_PATH" "/dev/drm_dp_aux0"; then
|
2023-11-23 10:53:24 -08:00
|
|
|
fi
|
2023-11-05 16:29:29 -08:00
|
|
|
|
2024-06-30 00:34:08 -07:00
|
|
|
if MatchFilenamePattern "$WRITE_PATH" "/sys/class/drm/card*/device/power_dpm_force_performance_level"; then
|
|
|
|
- CommitWrite
|
2024-07-07 12:51:42 -07:00
|
|
|
+ if /usr/libexec/hwsupport/valve-hardware; then
|
2024-07-06 14:41:40 -07:00
|
|
|
+ for i in $(ls /sys/class/drm/card*/device/power_dpm_force_performance_level)
|
|
|
|
+ do
|
|
|
|
+ WRITE_PATH="$i"
|
|
|
|
+ CommitWrite
|
|
|
|
+ done
|
2024-07-07 12:51:42 -07:00
|
|
|
+ else
|
2024-07-07 13:14:29 -07:00
|
|
|
+ Log "commit: Skipped $WRITE_VALUE -> $WRITE_PATH - Valve Hardware not detected"
|
2024-07-06 14:41:40 -07:00
|
|
|
+ fi
|
2023-11-05 16:29:29 -08:00
|
|
|
fi
|
|
|
|
|
2024-06-30 00:34:08 -07:00
|
|
|
if MatchFilenamePattern "$WRITE_PATH" "/sys/class/drm/card*/device/pp_od_clk_voltage"; then
|
|
|
|
- CommitWrite
|
2024-07-07 12:51:42 -07:00
|
|
|
+ if /usr/libexec/hwsupport/valve-hardware; then
|
2024-07-06 14:41:40 -07:00
|
|
|
+ for i in $(ls /sys/class/drm/card*/device/pp_od_clk_voltage)
|
|
|
|
+ do
|
|
|
|
+ WRITE_PATH="$i"
|
|
|
|
+ CommitWrite
|
|
|
|
+ done
|
2024-07-07 12:51:42 -07:00
|
|
|
+ else
|
2024-07-07 13:14:29 -07:00
|
|
|
+ Log "commit: Skipped $WRITE_VALUE -> $WRITE_PATH - Valve Hardware not detected"
|
2024-07-06 14:41:40 -07:00
|
|
|
+ fi
|
2023-11-05 16:29:29 -08:00
|
|
|
fi
|
|
|
|
|
2024-06-30 00:34:08 -07:00
|
|
|
if MatchFilenamePattern "$WRITE_PATH" "/sys/class/hwmon/hwmon*/power*_cap"; then
|
|
|
|
- CommitWrite
|
2024-09-10 17:27:35 +02:00
|
|
|
+ if /usr/libexec/hwsupport/valve-hardware && [[ "$DISABLE_STEAM_TDP_CONTROL" != 1 ]]; then
|
2024-07-06 14:41:40 -07:00
|
|
|
+ CommitWrite
|
2024-07-07 12:51:42 -07:00
|
|
|
+ else
|
2024-07-07 13:14:29 -07:00
|
|
|
+ Log "commit: Skipped $WRITE_VALUE -> $WRITE_PATH - Valve Hardware not detected"
|
2024-07-06 14:41:40 -07:00
|
|
|
+ fi
|
2023-12-30 11:24:01 -08:00
|
|
|
fi
|
|
|
|
|
2024-06-30 00:34:08 -07:00
|
|
|
if MatchFilenamePattern "$WRITE_PATH" "/sys/devices/platform/*/*/*/iio:device*/in_illuminance_integration_time"; then
|