Merge pull request #574 from fewtarius/dev

Integer scaling on Win600 and Brightness bug work.
This commit is contained in:
fewtarius 2022-09-28 07:59:57 -04:00 committed by GitHub
commit 6af2a74596
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 3 additions and 75 deletions

View file

@ -75,7 +75,7 @@ then
fi
# Disable integer scaling by default on Win600
if [[ "${DEVICE}" =~ handheld ]]
if [[ "${HW_DEVICE}" =~ handheld ]]
then
sed -i "s#.integerscale=1#.integerscale=0#g" /storage/.config/system/configs/system.cfg
fi

View file

@ -1,52 +0,0 @@
#!/bin/bash
if test ! -e /sys/class/backlight/backlight/brightness
then
echo "no brightness found" >&2
exit 1
fi
setValue() {
NEWVAL=$1
XMAX=$2
test "${NEWVAL}" -lt 0 && NEWVAL=0
test "${NEWVAL}" -gt "${XMAX}" && NEWVAL="${XMAX}"
echo "${NEWVAL}" > /sys/class/backlight/backlight/brightness
}
# get
if test $# = 0
then
X=$(cat /sys/class/backlight/backlight/brightness)
XMAX=$(cat /sys/class/backlight/backlight/max_brightness)
echo $(expr "${X}" "*" "100" / "${XMAX}")
exit 0
fi
# set
if test $# = 1
then
XMAX=$(cat /sys/class/backlight/backlight/max_brightness)
NEWVAL=$(expr "${1}" "*" "${XMAX}" / 100)
setValue "${NEWVAL}" "${XMAX}"
exit 0
fi
# set +
if test $# = 2
then
X=$(cat /sys/class/backlight/backlight/brightness)
XMAX=$(cat /sys/class/backlight/backlight/max_brightness)
DELTA=$(expr "${2}" '*' ${XMAX} / 100)
NEWVAL=$(expr "${X}" "${1}" "${DELTA}")
setValue "${NEWVAL}" "${XMAX}"
exit 0
fi
# help
echo "${0}" >&2
echo "${0} + 10" >&2
echo "${0} - 20" >&2
exit 1

View file

@ -54,7 +54,8 @@ case $1 in
DEVICE_VOLUME=$(get_setting "audio.volume" 2>/dev/null)
amixer -M set "${DEVICE_AUDIO_MIXER}" ${DEVICE_VOLUME}% 2>&1 >/dev/null
BRIGHTNESS_DEV="$(ls /sys/class/backlight | head -n 1)"
BRIGHTNESS=$(get_setting system.brightness)
echo ${BRIGHTNESS} >/sys/class/backlight/backlight/brightness
echo ${BRIGHTNESS} >/sys/class/backlight/${BRIGHTNESS_DEV}/brightness
;;
esac

View file

@ -67,24 +67,3 @@ MINVOL=0
set_setting "audio.volume" ${STEPVOL}
fi
if [ "${1}" == "bright" ]; then
STEPS="5"
BRIGHTNESS_DEV="$(ls /sys/class/backlight)"
CURRENTBRIGHT=$(cat /sys/class/backlight/${BRIGHTNESS_DEV}/brightness)
MAXBRIGHT="100" #$(cat /sys/class/backlight/${BRIGHTNESS_DEV}/max_brightness)
MINBRIGHT="2"
if [ "${2}" == "+" ]; then
STEPBRIGHT=$(($CURRENTBRIGHT+$(round $STEPS)))
elif [ "${2}" == "-" ]; then
STEPBRIGHT=$(($CURRENTBRIGHT-$(round $STEPS)))
else
STEPBRIGHT=${2}
fi
[ "$STEPBRIGHT" -ge "$MAXBRIGHT" ] && STEPBRIGHT="$MAXBRIGHT"
[ "$STEPBRIGHT" -le "$MINBRIGHT" ] && STEPBRIGHT="$MINBRIGHT"
#echo "Setting bright to $STEPBRIGHT"
echo "${STEPBRIGHT}" > /sys/class/backlight/${BRIGHTNESS_DEV}/brightness
set_setting "system.brightness" $(cat /sys/class/backlight/${BRIGHTNESS_DEV}/brightness)
fi