/* Site under maintenance */

[Linux] Restore brightness after reboot/wakeup under Ubuntu (nvidiabl module)

If you are using the nvidiabl module on your notebook (e.g., Macbook) then you can restore the brightness level after a reboot or wakeup from suspend in the following way:
  • create restore script /etc/restore_br_level.sh:#!/bin/bash cat /etc/brightness.save > /sys/class/backlight/nvidia_backlight/brightness exit 0
  • create save script /etc/save_br_level.sh:#!/bin/bash cat /sys/class/backlight/nvidia_backlight/actual_brightness > /etc/brightness.save exit 0
  • Setup restore after reboot: create and save script /etc/init/brightness.conf# Restore backlight after restart # description "Restore backlight after restart" author "Id2ndR" start on ((filesystem and runlevel [!06] and started dbus and login-session-start) or runlevel PREVLEVEL=S) stop on runlevel [016] script exec /etc/restore_br_level.sh end script
  • Setup save when rebooting/halting:sudo ln -s /etc/save_br_level.sh /etc/rc0.d/S10brightnesssudo ln -s /etc/save_br_level.sh /etc/rc6.d/S10brightness
  • Setup save/restore before/after suspend by creating script /etc/pm/sleep.d/brightness:case "${1}" in suspend) /etc/save_br_level.sh ;; resume|thaw) /etc/restore_br_level.sh ;; esac
  • make scripts executable:chmod +x /etc/restore_br_level.shchmod +x /etc/save_br_level.shchmod +x /etc/pm/sleep.d/brightness

• Nessun commento • Inserisci un commento • Pubblicato il 21 November 2013 • Ultima modifica 23 July 2014 • Feed commenti