Package: initscripts
Version: 2.88dsf-41+deb7u1
Severity: normal

Dear Maintainer,

I have tested many distros - Arch, OpenSuSe 13.1, Fedora 20, ALT Linux p7,
Sabayon, Mageia 4.
Many of them are based on systemd.
It does not matter what init system they use, but all of them have very usefull
script (or binary program, I don't know) for saving and restoring backlight
level on laptop.

In these distros there is a script for save and restore backlight levels for
two video-cards (acpi_video0 and acpi_video1). During system boot it is
indicated as follows:
"
[ OK ] Started Load/Save Screen Backlight Brightness of acpi_video1.
[ OK ] Started Load/Save Screen Backlight Brightness of acpi_video0.
".

I have a draft version, which works normally on my VAIO F13Z1R laptop with
Ubuntu 12.04.4. It is in attachment.
You can use it unmodified or modify it for compatibility or something. I made
symlinks for it:
ln -s /etc/init.d/brightness /etc/rc0.d/S25backlight
ln -s /etc/init.d/brightness /etc/rcS.d/S25backlight
ln -s /etc/init.d/brightness /etc/rc6.d/S25backlight

For details you can read my comment on askubuntu
(http://askubuntu.com/a/227553/66509).

I think that having a script for saving and restoring backlight level is very
useful for laptop Debian users.
So, please, add such init script to default Debian installation.



-- System Information:
Debian Release: 7.5
  APT prefers stable-updates
  APT policy: (500, 'stable-updates'), (500, 'stable')
Architecture: i386 (i686)

Kernel: Linux 3.2.0-4-686-pae (SMP w/8 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages initscripts depends on:
ii  coreutils       8.13-3.5
ii  debianutils     4.3.2
ii  libc6           2.13-38+deb7u1
ii  lsb-base        4.1+Debian8+deb7u1
ii  mount           2.20.1-5.3
ii  sysv-rc         2.88dsf-41+deb7u1
ii  sysvinit-utils  2.88dsf-41+deb7u1

Versions of packages initscripts recommends:
ii  e2fsprogs  1.42.5-1.1
ii  psmisc     22.19-1+deb7u1

initscripts suggests no packages.

-- no debconf information
#! /bin/sh
### BEGIN INIT INFO
# Provides:          brightness
# Required-Start:    $local_fs
# Required-Stop:     $local_fs
# Default-Start:     S
# Default-Stop:      0 6
# Short-Description: Save and restore brightness level between restarts.
# Description:       This script saves the brightness level between restarts.
#                    It is called from the boot, halt and reboot scripts.
### END INIT INFO

PATH=/sbin:/bin
SAVEDFILE=/var/lib/brightness-level
DEFAULT_LEVEL=4
BRIGHTNESS_CONTROL=/sys/class/backlight/acpi_video0/brightness

.. /lib/init/vars.sh
.. /lib/lsb/init-functions

do_status () {
	echo -n "Current brightness level is `cat $BRIGHTNESS_CONTROL`"

	if [ -f $SAVEDFILE ] ; then
		echo ", saved value is `cat $SAVEDFILE`."
		return 0
	else
		echo ", there is no saved value."
		return 4
	fi
}

case "$1" in
  start|"")
	[ "$VERBOSE" = no ] || log_action_begin_msg "Initializing brightness level"
	# Restore brightness level
	if [ ! -f "$SAVEDFILE" ]
	then
		echo "$DEFAULT_LEVEL" > "$SAVEDFILE"
	fi
	cat "$SAVEDFILE" > "$BRIGHTNESS_CONTROL"
	ES=$?

	[ "$VERBOSE" = no ] || log_action_end_msg $ES
	;;
  stop)
	# Save brightness level
	[ "$VERBOSE" = no ] || log_action_begin_msg "Saving brightness level"
	cat "$BRIGHTNESS_CONTROL" > "$SAVEDFILE"
	ES=$?
	[ "$VERBOSE" = no ] || log_action_end_msg $ES
	;;
  status)
	do_status
	exit 0
	;;
  restart|reload|force-reload)
	echo "Error: argument '$1' not supported" >&2
	exit 3
	;;
  *)
	echo "Usage: brightness start|stop" >&2
	exit 3
	;;
esac

:
#! /bin/sh
### BEGIN INIT INFO
# Provides:          brightness
# Required-Start:    $local_fs
# Required-Stop:     $local_fs
# Default-Start:     S
# Default-Stop:      0 6
# Short-Description: Save and restore brightness level between restarts.
# Description:       This script saves the brightness level between restarts.
#                    It is called from the boot, halt and reboot scripts.
### END INIT INFO

PATH=/sbin:/bin
SAVEDFILE=/var/lib/brightness-level
DEFAULT_LEVEL=4
BRIGHTNESS_CONTROL=/sys/class/backlight/acpi_video0/brightness

.. /lib/init/vars.sh
.. /lib/lsb/init-functions

do_status () {
	echo -n "Current brightness level is `cat $BRIGHTNESS_CONTROL`"

	if [ -f $SAVEDFILE ] ; then
		echo ", saved value is `cat $SAVEDFILE`."
		return 0
	else
		echo ", there is no saved value."
		return 4
	fi
}

case "$1" in
  start|"")
	[ "$VERBOSE" = no ] || log_action_begin_msg "Initializing brightness level"
	# Restore brightness level
	if [ ! -f "$SAVEDFILE" ]
	then
		echo "$DEFAULT_LEVEL" > "$SAVEDFILE"
	fi
	cat "$SAVEDFILE" > "$BRIGHTNESS_CONTROL"
	ES=$?

	[ "$VERBOSE" = no ] || log_action_end_msg $ES
	;;
  stop)
	# Save brightness level
	[ "$VERBOSE" = no ] || log_action_begin_msg "Saving brightness level"
	cat "$BRIGHTNESS_CONTROL" > "$SAVEDFILE"
	ES=$?
	[ "$VERBOSE" = no ] || log_action_end_msg $ES
	;;
  status)
	do_status
	exit 0
	;;
  restart|reload|force-reload)
	echo "Error: argument '$1' not supported" >&2
	exit 3
	;;
  *)
	echo "Usage: brightness start|stop" >&2
	exit 3
	;;
esac

:

Reply via email to