:: [devuan-dev] bug#617: initscripts: …
Top Pagina
Delete this message
Reply to this message
Auteur: Mark Hindley
Datum:  
Aan: Martin Steigerwald
CC: 617, Jacob Lundberg
Onderwerp: [devuan-dev] bug#617: initscripts: brightness init script sets brightness to zero, thus blanking laptop display
Martin,

On Wed, Dec 22, 2021 at 11:19:17AM +0100, Martin Steigerwald wrote:
> I'd really welcome this after I "bricked" another device due to exactly
> this bug. I needed to put GRML to an USB stick and boot from there in
> order to recover.


How does the attached patch look? Are you able to test?

Thanks.

Mark
>From 0bbb9d27a673826a2fa2611c62913107a7809f88 Mon Sep 17 00:00:00 2001
From: Mark Hindley <mark@???>
Date: Wed, 22 Dec 2021 11:42:29 +0000
Subject: [PATCH] brightness initscript: don't save value of 0 when stopping
(Closes: #617).

Fix for Devuan #617.

Some DEs switch off the backlight when idle. If the box is rebooted remotely in
this state, 0 is copied to /var/lib/initscripts/brightness which causes a blank
display on reboot.
---
debian/src/initscripts/etc/init.d/brightness | 4 ++++
1 file changed, 4 insertions(+)

diff --git a/debian/src/initscripts/etc/init.d/brightness b/debian/src/initscripts/etc/init.d/brightness
index 2b4921f7..c1a5f1fd 100755
--- a/debian/src/initscripts/etc/init.d/brightness
+++ b/debian/src/initscripts/etc/init.d/brightness
@@ -67,6 +67,10 @@ do_stop() {
     local label=$1 knob=$2 max=$3 file=$SAVEFILE_PREFIX${1:+.$1}
     test -e "$knob" || return 0


+    # If the backlight is off, don't save to avoid blank display after
+    # reboot. See Devuan #617.
+    test "$(cat $knob)" -eq 0 && return 0
+
     test x"$VERBOSE" = x"no" || \
         log_action_begin_msg Saving $label brightness level
     cat "$knob" >"$file"
-- 
2.20.1