mirror of
https://github.com/ublue-os/bazzite.git
synced 2025-01-30 03:32:36 +00:00
76 lines
3.0 KiB
Diff
76 lines
3.0 KiB
Diff
diff --git a/usr/bin/steamos-polkit-helpers/steamos-priv-write b/usr/bin/steamos-polkit-helpers/steamos-priv-write
|
|
index 8fcd1d4..4b47d21 100755
|
|
--- a/usr/bin/steamos-polkit-helpers/steamos-priv-write
|
|
+++ b/usr/bin/steamos-polkit-helpers/steamos-priv-write
|
|
@@ -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" "$@"
|
|
@@ -37,13 +39,14 @@
|
|
|
|
function CommitWrite()
|
|
{
|
|
+ chmod a+w "$WRITE_PATH"
|
|
+ echo "chmod a+w: $WRITE_PATH" | systemd-cat -t p-steamos-priv-write -p warning
|
|
+
|
|
if [ -n "$WRITE_VALUE" ]; then
|
|
Log "commit: $WRITE_VALUE -> $WRITE_PATH"
|
|
printf "%s" "$WRITE_VALUE" > "$WRITE_PATH"
|
|
fi
|
|
|
|
- chgrp deck "$WRITE_PATH"
|
|
- chmod g+w "$WRITE_PATH"
|
|
exit 0
|
|
}
|
|
|
|
@@ -65,15 +68,41 @@
|
|
fi
|
|
|
|
if MatchFilenamePattern "$WRITE_PATH" "/sys/class/drm/card*/device/power_dpm_force_performance_level"; then
|
|
- CommitWrite
|
|
+ if systemctl list-units | grep hhd@; then
|
|
+ echo "commit: Skipped $WRITE_VALUE -> $WRITE_PATH - controlled by HHD" | systemd-cat -t p-steamos-priv-write -p warning
|
|
+ elif /usr/libexec/hwsupport/valve-hardware || [[ "$ENABLE_HARDWARE_CONTROL_ON_NON_DECK_HARDWARE" = 1 ]]; then
|
|
+ for i in $(ls /sys/class/drm/card*/device/power_dpm_force_performance_level)
|
|
+ do
|
|
+ WRITE_PATH="$i"
|
|
+ CommitWrite
|
|
+ done
|
|
+ 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
|
|
|
|
if MatchFilenamePattern "$WRITE_PATH" "/sys/class/drm/card*/device/pp_od_clk_voltage"; then
|
|
- CommitWrite
|
|
+ if systemctl list-units | grep hhd@; then
|
|
+ echo "commit: Skipped $WRITE_VALUE -> $WRITE_PATH - controlled by HHD" | systemd-cat -t p-steamos-priv-write -p warning
|
|
+ elif /usr/libexec/hwsupport/valve-hardware || [[ "$ENABLE_HARDWARE_CONTROL_ON_NON_DECK_HARDWARE" = 1 ]]; then
|
|
+ for i in $(ls /sys/class/drm/card*/device/pp_od_clk_voltage)
|
|
+ do
|
|
+ WRITE_PATH="$i"
|
|
+ CommitWrite
|
|
+ done
|
|
+ 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
|
|
|
|
if MatchFilenamePattern "$WRITE_PATH" "/sys/class/hwmon/hwmon*/power*_cap"; then
|
|
- CommitWrite
|
|
+ if systemctl list-units | grep hhd@; then
|
|
+ echo "commit: Skipped $WRITE_VALUE -> $WRITE_PATH - controlled by HHD" | systemd-cat -t p-steamos-priv-write -p warning
|
|
+ elif /usr/libexec/hwsupport/valve-hardware || [[ "$ENABLE_HARDWARE_CONTROL_ON_NON_DECK_HARDWARE" = 1 ]]; then
|
|
+ CommitWrite
|
|
+ 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
|
|
|
|
if MatchFilenamePattern "$WRITE_PATH" "/sys/devices/platform/*/*/*/iio:device*/in_illuminance_integration_time"; then
|