mikhail-m1 / illuminanced

Ambient Light Sensor Daemon for Linux
GNU General Public License v3.0
57 stars 19 forks source link

Does not change brightness #16

Open dehlong opened 3 months ago

dehlong commented 3 months ago

Hello, I am on my FW16 and I installed the service via paru from AUR. It was installed correctly, my config was edited but it does not do anything. My brightness stays at the same level. However, the reading from the ambient light sensor changes. My desktop environment is KDE with wayland.

Here is my config:


[daemonize]
# log_to = "syslog" or /file/path
log_to = "/var/log/illuminanced.log"
pid_file = "/run/illuminanced.pid"
# log_level = "OFF", "ERROR", "WARN", "INFO", "DEBUG", "TRACE"
log_level = "ERROR"

[general]
check_period_in_seconds = 5
light_steps = 10
min_backlight = 70
step_barrier = 0.1
max_backlight_file = "/sys/class/backlight/amdgpu_bl1/max_brightness"
backlight_file = "/sys/class/backlight/amdgpu_bl1/brightness"
illuminance_file = "/sys/bus/iio/devices/iio:device0/in_illuminance_raw"
event_device_mask = "/dev/input/event*"
event_device_name = "Asus WMI hotkeys"
enable_max_brightness_mode = true
filename_for_sensor_activation = ""

[kalman]
q = 1
r = 20
covariance = 10

[light]
points_count = 6

illuminance_0 = 0
light_0 = 0

illuminance_1 = 20
light_1 = 1

illuminance_2 = 300
light_2 = 3

illuminance_3 = 700
light_3 = 4

illuminance_4 = 1100
light_4 = 5

illuminance_5 = 7100
light_5 = 10

I have installed it and started the service. Am I supposed to somehow enable it further? I saw there are 3 modes but I do not understand how am I supposed to alter between them.

My laptop config is FW16 with ryzen 7 and no dGPU. Service seems to be running correctly. Only in journal I have:

Jun 12 14:01:41 Samo-PCFW kernel: i2c_hid_acpi i2c-FRMW0003:00: failed to set a report to device: -121
Jun 12 14:02:23 Samo-PCFW kernel: i2c_hid_acpi i2c-FRMW0003:00: failed to set a report to device: -121
Jun 12 14:02:37 Samo-PCFW kernel: i2c_hid_acpi i2c-FRMW0003:00: failed to set a report to device: -121
Jun 12 14:07:26 Samo-PCFW kernel: i2c_hid_acpi i2c-FRMW0003:00: failed to set a report to device: -121
Jun 12 14:07:39 Samo-PCFW kernel: i2c_hid_acpi i2c-FRMW0003:00: failed to set a report to device: -121

This does not happen when the service is disabled.

mikhail-m1 commented 3 months ago

You can try to change brightness manually by writing to /sys/class/backlight/amdgpu_bl1/brightness file. If it doesn't work you need to solve issue with the video driver.

idkwhatido commented 2 months ago

Hi, i also have the FW 16 and got the same problem with Arch and Openbox as DE. I fixed the path's to the max_brightness, brightness and sensor files, but it still won't adapt the brightness. If i set the brightness manually using the path that @mikhail-m1 provided it changed the brightness without any issues.

Do i need to change another setting, or is there a way to get a more detailed log to track this issue down?

mikhail-m1 commented 2 months ago

hey, @idkwhatido!

you can stop the daemon through systemd and run it in foreground mode with traces, to do so you run next commands as root:

systemctl stop illuminanced.service
RUST_LOG=debug /usr/local/sbin/illuminanced -d 
idkwhatido commented 2 months ago

Hi @mikhail-m1, i run it in foreground (see below for log). I noticed that it seem to change the brightness one time at boot, but after that won't change it again.

17:06:22 [DEBUG] (1) illuminanced: Points: [LightPoint { illuminance: 0, light: 0 }, LightPoint { illuminance: 20, light: 1 }, LightPoint { illuminance: 300, light: 3 }, LightPoint { illuminance: 700, light: 4 }, LightPoint { illuminance: 1100, light: 5 }, LightPoint { illuminance: 7100, light: 10 }]
17:06:22 [INFO] Use `/sys/bus/iio/devices/iio:device0/in_illuminance_raw` as illuminance input
17:06:24 [DEBUG] (1) illuminanced::switch_monitor: found input device "/dev/input/event0" `Lid Switch`
17:06:24 [DEBUG] (1) illuminanced::switch_monitor: found input device "/dev/input/event1" `Power Button`
17:06:24 [DEBUG] (1) illuminanced::switch_monitor: found input device "/dev/input/event10" `Framework Laptop 16 Keyboard Module - ISO Keyboard`
17:06:24 [DEBUG] (1) illuminanced::switch_monitor: found input device "/dev/input/event11" `HD-Audio Generic HDMI/DP,pcm=3`
17:06:24 [DEBUG] (1) illuminanced::switch_monitor: found input device "/dev/input/event12" `HD-Audio Generic HDMI/DP,pcm=7`
17:06:24 [DEBUG] (1) illuminanced::switch_monitor: found input device "/dev/input/event13" `HD-Audio Generic HDMI/DP,pcm=8`
17:06:24 [DEBUG] (1) illuminanced::switch_monitor: found input device "/dev/input/event2" `Video Bus`
17:06:24 [DEBUG] (1) illuminanced::switch_monitor: found input device "/dev/input/event3" `PC Speaker`
17:06:24 [DEBUG] (1) illuminanced::switch_monitor: found input device "/dev/input/event4" `PIXA3854:00 093A:0274 Mouse`
17:06:24 [DEBUG] (1) illuminanced::switch_monitor: found input device "/dev/input/event5" `PIXA3854:00 093A:0274 Touchpad`
17:06:24 [DEBUG] (1) illuminanced::switch_monitor: found input device "/dev/input/event6" `Framework Laptop 16 Keyboard Module - ISO`
17:06:24 [DEBUG] (1) illuminanced::switch_monitor: found input device "/dev/input/event7" `Framework Laptop 16 Keyboard Module - ISO System Control`
17:06:24 [DEBUG] (1) illuminanced::switch_monitor: found input device "/dev/input/event8" `Framework Laptop 16 Keyboard Module - ISO Consumer Control`
17:06:24 [DEBUG] (1) illuminanced::switch_monitor: found input device "/dev/input/event9" `Framework Laptop 16 Keyboard Module - ISO Wireless Radio Control`
17:06:24 [DEBUG] (1) illuminanced: k: s:DiscreteValue { min: 70, _max: 255, step_size: 20.555555, barrier: 0.1, last_level: 0 }
17:06:24 [DEBUG] (1) illuminanced: right index: 2
17:06:24 [DEBUG] (1) illuminanced: 32, 32, 1.0857143
17:06:24 [DEBUG] (1) illuminanced::discrete_value: step diff 1.0857143
17:06:25 [DEBUG] (1) illuminanced: right index: 2
17:06:25 [DEBUG] (1) illuminanced: 33, 32.35484, 1.0857143
17:06:25 [DEBUG] (1) illuminanced::discrete_value: step diff 1.0857143
17:06:26 [DEBUG] (1) illuminanced: right index: 2
17:06:26 [DEBUG] (1) illuminanced: 32, 32.252583, 1.0857143
17:06:26 [DEBUG] (1) illuminanced::discrete_value: step diff 1.0857143
17:06:27 [DEBUG] (1) illuminanced: right index: 2
17:06:27 [DEBUG] (1) illuminanced: 1, 24.35464, 1.0285715
17:06:27 [DEBUG] (1) illuminanced::discrete_value: step diff 1.0285715
17:06:28 [DEBUG] (1) illuminanced: right index: 1
17:06:28 [DEBUG] (1) illuminanced: 0, 18.695318, 0.90000004
17:06:28 [DEBUG] (1) illuminanced::discrete_value: step diff 0.90000004
17:06:29 [DEBUG] (1) illuminanced: right index: 1
17:06:29 [DEBUG] (1) illuminanced: 0, 14.578709, 0.7
17:06:29 [DEBUG] (1) illuminanced::discrete_value: step diff 0.7
17:06:30 [DEBUG] (1) illuminanced: right index: 1
17:06:30 [DEBUG] (1) illuminanced: 0, 11.477539, 0.55
17:06:30 [DEBUG] (1) illuminanced::discrete_value: step diff 0.55
17:06:31 [DEBUG] (1) illuminanced: right index: 1
17:06:31 [DEBUG] (1) illuminanced: 0, 9.089542, 0.45000002
17:06:31 [DEBUG] (1) illuminanced::discrete_value: step diff 0.45000002
17:06:32 [DEBUG] (1) illuminanced: right index: 1
17:06:32 [DEBUG] (1) illuminanced: 0, 7.2250566, 0.35
17:06:32 [DEBUG] (1) illuminanced::discrete_value: step diff 0.35
17:06:33 [DEBUG] (1) illuminanced: right index: 1
17:06:33 [DEBUG] (1) illuminanced: 0, 5.7564473, 0.25
17:06:33 [DEBUG] (1) illuminanced::discrete_value: step diff 0.25
17:06:34 [DEBUG] (1) illuminanced: right index: 1
17:06:34 [DEBUG] (1) illuminanced: 0, 4.5931563, 0.2
17:06:34 [DEBUG] (1) illuminanced::discrete_value: step diff 0.2
17:06:35 [DEBUG] (1) illuminanced: right index: 1
17:06:35 [DEBUG] (1) illuminanced: 0, 3.6684065, 0.15
17:06:35 [DEBUG] (1) illuminanced::discrete_value: step diff 0.15
17:06:36 [DEBUG] (1) illuminanced: right index: 1
17:06:36 [DEBUG] (1) illuminanced: 0, 2.931601, 0.1
17:06:36 [DEBUG] (1) illuminanced::discrete_value: step diff 0.1
17:06:37 [DEBUG] (1) illuminanced: right index: 1
17:06:37 [DEBUG] (1) illuminanced: 0, 2.3436842, 0.1
17:06:37 [DEBUG] (1) illuminanced::discrete_value: step diff 0.1
17:06:38 [DEBUG] (1) illuminanced: right index: 1
17:06:38 [DEBUG] (1) illuminanced: 0, 1.8741307, 0.05
17:06:38 [DEBUG] (1) illuminanced::discrete_value: step diff 0.05
17:06:39 [DEBUG] (1) illuminanced: right index: 1
17:06:39 [DEBUG] (1) illuminanced: 0, 1.4988868, 0.05
17:06:39 [DEBUG] (1) illuminanced::discrete_value: step diff 0.05
17:06:40 [DEBUG] (1) illuminanced: right index: 1
17:06:40 [DEBUG] (1) illuminanced: 0, 1.1988957, 0.05
17:06:40 [DEBUG] (1) illuminanced::discrete_value: step diff 0.05
17:06:41 [DEBUG] (1) illuminanced: right index: 1
17:06:41 [DEBUG] (1) illuminanced: 0, 0.9590071, 0
17:06:41 [DEBUG] (1) illuminanced::discrete_value: step diff 0
17:06:42 [DEBUG] (1) illuminanced: right index: 1
17:06:43 [DEBUG] (1) illuminanced: 0, 0.7671496, 0
17:06:43 [DEBUG] (1) illuminanced::discrete_value: step diff 0
17:06:44 [DEBUG] (1) illuminanced: right index: 1
17:06:44 [DEBUG] (1) illuminanced: 0, 0.61369103, 0
17:06:44 [DEBUG] (1) illuminanced::discrete_value: step diff 0
17:06:45 [DEBUG] (1) illuminanced: right index: 1
17:06:45 [DEBUG] (1) illuminanced: 0, 0.49093816, 0
17:06:45 [DEBUG] (1) illuminanced::discrete_value: step diff 0
17:06:46 [DEBUG] (1) illuminanced: right index: 1
17:06:46 [DEBUG] (1) illuminanced: 0, 0.392743, 0
17:06:46 [DEBUG] (1) illuminanced::discrete_value: step diff 0
17:06:47 [DEBUG] (1) illuminanced: right index: 1
17:06:47 [DEBUG] (1) illuminanced: 32, 6.7145047, 0.3
17:06:47 [DEBUG] (1) illuminanced::discrete_value: step diff 0.3
17:06:48 [DEBUG] (1) illuminanced: right index: 1
17:06:48 [DEBUG] (1) illuminanced: 31, 11.571756, 0.55
17:06:48 [DEBUG] (1) illuminanced::discrete_value: step diff 0.55
17:06:49 [DEBUG] (1) illuminanced: right index: 1
17:06:49 [DEBUG] (1) illuminanced: 31, 15.457483, 0.75
17:06:49 [DEBUG] (1) illuminanced::discrete_value: step diff 0.75
17:06:50 [DEBUG] (1) illuminanced: right index: 1
17:06:50 [DEBUG] (1) illuminanced: 32, 18.76603, 0.90000004
17:06:50 [DEBUG] (1) illuminanced::discrete_value: step diff 0.90000004
17:06:51 [DEBUG] (1) illuminanced: right index: 2
17:06:51 [DEBUG] (1) illuminanced: 32, 21.412846, 1.0071429
17:06:51 [DEBUG] (1) illuminanced::discrete_value: step diff 1.0071429
17:06:52 [DEBUG] (1) illuminanced: right index: 2
17:06:52 [DEBUG] (1) illuminanced: 32, 23.530289, 1.0214286
17:06:52 [DEBUG] (1) illuminanced::discrete_value: step diff 1.0214286
17:06:53 [DEBUG] (1) illuminanced: right index: 2
17:06:53 [DEBUG] (1) illuminanced: 31, 25.024237, 1.0357143
17:06:53 [DEBUG] (1) illuminanced::discrete_value: step diff 1.0357143
17:06:54 [DEBUG] (1) illuminanced: right index: 2
17:06:54 [DEBUG] (1) illuminanced: 31, 26.21939, 1.0428572
17:06:54 [DEBUG] (1) illuminanced::discrete_value: step diff 1.0428572

It looks like it detect the brightness, but doesn't change it.

mikhail-m1 commented 2 months ago

Lines like this illuminanced: 31, 26.21939, 1.0428572 say that 31 was read from illuminance_file, after the noise filter it's 26.21939 and was mapped to brightness level 1. Base on the data I see that you have ~32 which was mapped to level 1 and than 0 (level 0). There is a code to prevent back light switching when the value is close to the the pivot point, and it blocked switching the levels in your case.

In your case values the daemon getting from the sensor are really small, I don't know was it just dark or maximum value is far from several thousands that is expected. You can change step_barrier value to 0.01 or/and illuminance_<n> values.