From 031a86d73b24331608a68b63055a1d1a3e640493 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maxime=20Chourr=C3=A9?= Date: Thu, 18 Apr 2024 08:36:24 +0200 Subject: [PATCH 1/2] Changed printf LANG to LC_NUMERIC It was displaying an error almost every time : invalid number float --- AutomaticBrightness.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/AutomaticBrightness.sh b/AutomaticBrightness.sh index defea77..559bb98 100644 --- a/AutomaticBrightness.sh +++ b/AutomaticBrightness.sh @@ -122,7 +122,7 @@ do # Gernate a TempLight value for the screen to be set to # Float math thanks Matthias_Wachter - TempLight=$(LANG=C printf "%.0f" $(echo "scale=2; $Light * $SensorToDisplayScale" | bc)) + TempLight=$(LC_NUMERIC=C printf "%.0f" $(echo "scale=2; $Light * $SensorToDisplayScale" | bc)) # Check we dont ask the screen to go brighter than it can @@ -134,7 +134,7 @@ do fi # How diffrent should each stop be - DiffCount=$(LANG=C printf "%.0f" $(echo "scale=2; ( $NewLight - $CurrentBrightness ) / $LevelSteps" | bc )) + DiffCount=$(LC_NUMERIC=C printf "%.0f" $(echo "scale=2; ( $NewLight - $CurrentBrightness ) / $LevelSteps" | bc )) # Step once per Screen Hz to make animation for i in $(eval echo {1..$LevelSteps} ) From e15c2060a6b191d6bbbaed7bc912ad4af5eb3d21 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maxime=20Chourr=C3=A9?= Date: Thu, 18 Apr 2024 08:39:01 +0200 Subject: [PATCH 2/2] Add execute permission to script If the file is not executable, the service system will not load it, and will return a 203/EXEC error (file not found). --- setup.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/setup.sh b/setup.sh index 85f7af1..8921b11 100755 --- a/setup.sh +++ b/setup.sh @@ -46,6 +46,7 @@ fi echo "Cloning AutomaticBrighness.sh..." sudo cp AutomaticBrightness.sh /usr/local/bin/AutomaticBrightness.sh +sudo chmod u+x /usr/local/bin/AutomaticBrightness.sh echo "Cloning AB.service for systemD..." sudo cp AB.service /etc/systemd/system/AB.service