История изменений
Исправление
merhalak,
(текущая версия)
:
Так даже чутка попроще будет.
#!/usr/bin/env bash
sensor_file="/sys/bus/acpi/devices/ACPI0008:00/iio\:device0/in_illuminance_raw"
max_brightness_file="/sys/class/backlight/acpi_video0/max_brightness"
brightness_file="/sys/class/backlight/acpi_video0/brightness"
while :; do
read sensor < $sensor_file
read max_brightness < $max_brightness_file
result=$sensor
if (( $sensor <= 5 )); then
result=5
else
((result = result * 11 / 10))
if (( $result > $max_brightness )); then
result=$max_brightness
fi
fi
echo $result > $brightness_file
sleep 5
done
sleep поправь на нужное количество секунд, которое тебе комфортно для авторегулировки. Можно даже десятые доли брать, типа sleep 0.5.
Исходная версия Deleted, :
Так даже чутка попроще будет.
#!/usr/bin/env bash
sensor_file="/sys/bus/acpi/devices/ACPI0008:00/iio\:device0/in_illuminance_raw"
max_brightness_file="/sys/class/backlight/acpi_video0/max_brightness"
brightness_file="/sys/class/backlight/acpi_video0/brightness"
while :; do
read sensor < $sensor_file
read max_brightness < $max_brightness_file
result=$sensor
if (( $sensor <= 5 )); then
result=5
else
((result = result * 11 / 10))
if (( $result > $max_brightness )); then
result=$max_brightness
fi
fi
echo $result > $brightness_file
sleep 5
done