Merge pull request #2428 from fewtarius/dev

Bug fixes: Online threads, Powerstate looping.
This commit is contained in:
fewtarius 2023-11-27 09:15:15 -05:00 committed by GitHub
commit 2b086daa1b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 59 additions and 40 deletions

View file

@ -25,42 +25,9 @@ fi
### to last known good state if corrupt.
/usr/bin/chksysconfig verify
### Clean up settings
sort_settings
### We do not want to mount the cloud drive on startup
### so we'll reset the mount option to 0.
set_setting clouddrive.mounted 0
### Enable the desired number of threads.
tocon "Restoring cpu threads..."
NUMTHREADS=$(get_setting "system.threads")
if [ -n "${NUMTHREADS}" ]
then
onlinethreads ${NUMTHREADS} 0
else
onlinethreads all 1
fi
### If we don't have a default governor set, set it
### to schedutil.
if [ -z "$(get_setting system.cpugovernor)" ]
then
set_setting system.cpugovernor schedutil
fi
### Set the default GPU performance mode
GPUPERF=$(get_setting system.gpuperf)
if [ -n "${GPUPERF}" ]
then
gpu_performance_level ${GPUPERF}
fi
### Configure suspend mode.
MYSLEEPMODE=$(get_setting system.suspendmode)
if [ -n "${MYSLEEPMODE}" ]
then
/usr/bin/suspendmode ${MYSLEEPMODE}
else
/usr/bin/suspendmode mem
fi
### Clean up settings
sort_settings

View file

@ -0,0 +1,33 @@
#!/bin/sh
# SPDX-License-Identifier: GPL-2.0
# Copyright (C) 2023 JELOS (https://github.com/JustEnoughLinuxOS)
# Minimal OS variable loading for performance
. /etc/profile.d/001-functions
. /etc/profile.d/099-freqfunctions
tocon "Setting performance mode..."
### Enable the desired number of threads.
tocon "Restoring cpu threads..."
NUMTHREADS=$(get_setting "system.threads")
if [ -n "${NUMTHREADS}" ]
then
onlinethreads ${NUMTHREADS} 0
else
onlinethreads all 1
fi
### If we don't have a default governor set, set it
### to schedutil but don't enable it.
if [ -z "$(get_setting system.cpugovernor)" ]
then
set_setting system.cpugovernor schedutil
fi
### Set the default GPU performance mode
GPUPERF=$(get_setting system.gpuperf)
if [ -n "${GPUPERF}" ]
then
gpu_performance_level ${GPUPERF}
fi

View file

@ -0,0 +1,17 @@
#!/bin/sh
# SPDX-License-Identifier: GPL-2.0
# Copyright (C) 2023 JELOS (https://github.com/JustEnoughLinuxOS)
# Minimal OS variable loading for performance
. /etc/profile.d/001-functions
tocon "Configure suspend mode..."
### Configure suspend mode.
MYSLEEPMODE=$(get_setting system.suspendmode)
if [ -n "${MYSLEEPMODE}" ]
then
/usr/bin/suspendmode ${MYSLEEPMODE}
else
/usr/bin/suspendmode mem
fi

View file

@ -11,14 +11,16 @@
. /etc/profile
BATCNT=0
unset CURRENT_MODE
unset AC_STATUS
while true
do
if [ "$(get_setting system.powersave)" = 1 ]
then
STATUS="$(cat /sys/class/power_supply/{BAT*,bat*}/status 2>/dev/null)"
if [ ! "${STATUS}" = "${CURRENT_MODE}" ]
AC_STATUS="$(cat /sys/class/power_supply/[bB][aA][tT]*/status 2>/dev/null)"
if [[ ! "${CURRENT_MODE}" =~ ${AC_STATUS} ]]
then
case ${STATUS} in
case ${AC_STATUS} in
Disch*)
log $0 "Switching to battery mode."
if [ -e "/tmp/.gpu_performance_level" ]
@ -56,7 +58,7 @@ do
;;
esac
fi
CURRENT_MODE="${STATUS}"
CURRENT_MODE="${AC_STATUS}"
fi
### Until we have an overlay. :rofl:
if (( "${BATCNT}" >= "90" )) &&