From 9f69672f64aa5b48ec6a9e9cffd91129a529a621 Mon Sep 17 00:00:00 2001
From: Theluga <96307393+Theluga@users.noreply.github.com>
Date: Sat, 16 Dec 2023 13:48:27 +0000
Subject: [PATCH] give r+w permission to any user on offset reduce brightness
 to less 1

---
 autobrightness.sh | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/autobrightness.sh b/autobrightness.sh
index ed7df1f..5c06a05 100644
--- a/autobrightness.sh
+++ b/autobrightness.sh
@@ -64,6 +64,7 @@ if [[ -f /tmp/AB.offset ]]; then
 else
   OffSet=0
   echo $OffSet > /tmp/AB.offset
+  chmod 666 /tmp/AB.offset
 fi
 
 OffSet=$((OffSet < 0 ? 0 : OffSet))
@@ -77,6 +78,7 @@ if [[ $op -lt 2 ]]; then
 
   OffSet=$((OffSet < 0 ? 0 : OffSet))
   echo $OffSet > /tmp/AB.offset
+  chmod 666 /tmp/AB.offset
   exit
 fi
 
@@ -101,6 +103,7 @@ until [ -f /tmp/AB.kill ]; do
     else
       OffSet=0
       echo $OffSet > /tmp/AB.offset
+      chmod 666 /tmp/AB.offset
     fi
 
     Light=$(cat /sys/bus/iio/devices/iio:device5/in_illuminance_raw)
@@ -144,7 +147,7 @@ until [ -f /tmp/AB.kill ]; do
       OldLight=$Light
     fi
 
-    if [[ $Light -lt 3 ]]; then
+    if [[ $Light -lt 1 ]]; then
       smoothly_increase_brightness
     fi