Display backlight level save and restore as a init-script / upstart job for laptops
Nrbrtx
nrbrtx at gmail.com
Sun Mar 29 16:37:38 UTC 2015
Dear all!
As you can read from bug 1270579 description
<https://bugs.launchpad.net/bugs/1270579>, I created Ubuntu package for
saving and restoring backlight (brightness) level on laptops.
This package installs one file - "/etc/init.d/sysvinit-backlight" (sysvinit
script <https://bazaar.launchpad.net/~nrbrtx/+junk/sysvinit-backlight/files>
).
You can install my package from PPA
<https://launchpad.net/~nrbrtx/+archive/ubuntu/sysvinit-backlight> with the
commands below:
sudo add-apt-repository ppa:nrbrtx/sysvinit-backlight
sudo apt-get update
sudo apt-get install sysvinit-backlight
You can remove it by
sudo apt-get purge sysvinit-backlight
Please note: if you have installed the previous version of my script,
please remove it by
sudo rm /etc/rc?.d/?25backlight /etc/init.d/brightness
/etc/rc?.d/?25brightness
The script functionality is:
* save backlight (brightness) levels of all video adapters on reboot and
shutdown (runlevel 0 and 6)
* load backlight (brightness) levels for all video adapters on boot
(runlevel S and 2)
* this version supports hybrid graphics
The script options are:
* sudo service sysvinit-backlight status (show current brightness levels
and saved in files values)
* sudo service sysvinit-backlight start (set saved level from files)
* sudo service sysvinit-backlight stop (save current level to files)
Known problems:
* brightness resets to maximum on login to MATE session (may be related
to https://github.com/mate-desktop/mate-power-manager/issues/76)
Changes:
I removed all bashisms and made code more clear - thanks to Andreas
Mohr (andi).
I tested my package on Ubuntu 12.04.5 LTS, 14.04.2 LTS and Ubuntu 14.10.
With best regards,
Ubuntu user,
Norbert.
On Sat, Jan 10, 2015 at 9:24 PM, Nrbrtx <nrbrtx at gmail.com> wrote:
> Dear Ubuntu and Debian developers!
>
> I understand that you are very busy, but laptop users have problems
> with saving and restoring display backlight level in Debian and Ubuntu.
>
> Systemd-based distros (Fedora, OpenSuSe, Arch, Sabayon, Mageia) have this
> functionality out the box (they have systemd-backlight at .service
> <https://github.com/systemd/systemd/commits/56f64d95763a799ba4475daf44d8e9f72a1bd474/src/backlight/backlight.c>),
> but sysvinit and upstart not.
>
> Here is a list:
>
> - in Arch backlight brightness load and save are provided by systemd
> (see Arch wiki
> <https://wiki.archlinux.org/index.php/backlight#systemd-backlight_service>),
> it is in systemd
> <https://www.archlinux.org/packages/core/x86_64/systemd/> package.
> - in OpenSUSE 13.1, OpenSUSE 13.2, CentOS 7, Fedora 20, Fedora 21,
> Mageia 4 - systemd package
> <http://pkgs.org/search//usr/lib/systemd/systemd-backlight?type=files>
> - Sabayon has /usr/lib/systemd/systemd-backlight service
> - ALT Linux p7 has systemd, but does not have /usr/lib/systemd/systemd-
> backlight service
> - in Debian Jessie
> <https://packages.debian.org/search?suite=jessie&arch=any&mode=path&searchon=contents&keywords=systemd-backlight>
> and Debian sid
> <https://packages.debian.org/search?suite=sid&arch=any&mode=path&searchon=contents&keywords=systemd-backlight>
> there is /usr/lib/systemd/systemd-backlight service
> - in Ubuntu Utopic
> <http://packages.ubuntu.com/search?searchon=contents&keywords=systemd-backlight&mode=filename&suite=utopic&arch=any>
> and Ubuntu Vivid
> <http://packages.ubuntu.com/search?searchon=contents&keywords=systemd-backlight&mode=filename&suite=vivid&arch=any>
> there is /usr/lib/systemd/systemd-backlight service
>
> There is no backlight load/save functionality in (neither upstart nor
> systemd):
>
> - Ubuntu Lucid
> - Ubuntu Precise
> - Ubuntu Trusty
> - Debian Wheezy
> - Debian Squeeze
>
> So it seems that modern distros have backlight load/save functionality
> via systemd-backlight service
> <http://www.freedesktop.org/software/systemd/man/systemd-backlight@.service.html>,
> but older systems does not have this functionality at all.
>
>
> This problem is well-described on launchpad (see bug 1270579
> <http://bugs.launchpad.net/bugs/1270579> ) and on
> AskUbuntu (see my comment
> <http://askubuntu.com/questions/151651/brightness-is-reset-to-maximum-on-every-restart/227553#227553>
> on it). Around 160 users are affected.
>
> Steps to reproduce:
> 1. User boots laptop (cold boot, not wake from suspend)
> 2. User sets comfortable backlight level
> 3. User ends his/her work by shutting down the laptop (not suspend, so
> backlight level is not saved)
> 4. Go to 1 (another cold boot with resetted backlight level).
>
> I prepared draft version for saving and restoring display backlight level
> on laptops - it is saved on launchpad (upstart_brightness.tar.gz archive
> <https://bugs.launchpad.net/ubuntu/+source/sysvinit/+bug/1270579/+attachment/4288756/+files/upstart_brightness.tar.gz>
> , see comment #18 on launchpad
> <https://bugs.launchpad.net/ubuntu/+source/sysvinit/+bug/1270579/comments/18>)
> and may be installed to the system manually with
> sudo tar -zxvf upstart_brightness.tar.gz -C /
>
> My script was tested on Ubuntu 12.04 and Ubuntu 14.04 - see reports on
> AskUbuntu
> <http://askubuntu.com/questions/151651/brightness-is-reset-to-maximum-on-every-restart/227553#227553>,
> Launchpad
> <https://bugs.launchpad.net/ubuntu/+source/sysvinit/+bug/1270579/comments/22>
> and forum.ubuntu.ru <http://forum.ubuntu.ru/index.php?topic=255145.0;all>
> on laptops with discrete, integrated and hybrid graphics card.
>
> Please reply to this message if you are interested in such init-script.
>
> Thank you!
>
>
> With best regards,
> Debian and Ubuntu user,
> Norbert.
>
> P.S. I found interesting projects for the same purpose - first is named
> Light and hosted on GitHub <https://github.com/haikarainen/light>
> (previously known as LightScript
> <http://haikarainen.dotgeek.org/lightscript/>), second is named Relight
> <http://xyne.archlinux.ca/projects/relight/>. But I think that
> init-script approach is better.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ubuntu.com/archives/ubuntu-devel-discuss/attachments/20150329/cd5ccec1/attachment.html>
More information about the Ubuntu-devel-discuss
mailing list