Symptom:
Macbook resets to full brightness every reboot, instead of remembering brightness settting.
Scenario:
*OS: Debian 9 Stretch
*System: 2011 Macbook Pro, with Nvidia 320M
*Xorg.conf includes this line in the Device section: Option “RegistryDwords” “EnableBrightnessControl=1”
*The current backlight value is recorded in: /sys/class/backlight/apple/backlight/brightness
Fix:
During shutdown systemd should save the brightness setting in: /var/lib/systemd/backlight/
and load it during startup. This action can be done manually using the following command:
sudo /lib/systemd/systemd-backlight load backlight:apple_backlight
sudo /lib/systemd/systemd-backlight save backlight:apple_backlight
If the above commands work but the system does not restore brightness value during reboot then udev is not working correctly to identify or action the hardware/button presses. We can write our own systemd service unit to do the commands for us:
#/etc/systemd/system/my-monitor-backlight.service:
[Unit]
Description = Load/Save apple_backlight settings
[Service]
Type = oneshot
RemainAfterExit=yes
ExecStart = /lib/systemd/systemd-backlight load backlight:apple_backlight
ExecStop = /lib/systemd/systemd-backlight save backlight:apple_backlight
[Install]
WantedBy = multi-user.target
Enable and start the new service:
systemctl enable my-monitor-brightness
systemctl start my-monitor-brightness