From c20416644b6b4a18bd84e91b98bd6230b4598c9d Mon Sep 17 00:00:00 2001 From: Jan Philipp Timme Date: Mon, 25 Mar 2019 16:02:50 +0100 Subject: [PATCH] Save hints about backlight hack on laptop --- sbin/99-intelbacklighthack.rules | 1 + sbin/backlighthack.sh | 14 ++++++++++++++ 2 files changed, 15 insertions(+) create mode 100644 sbin/99-intelbacklighthack.rules create mode 100755 sbin/backlighthack.sh diff --git a/sbin/99-intelbacklighthack.rules b/sbin/99-intelbacklighthack.rules new file mode 100644 index 0000000..bb11ff0 --- /dev/null +++ b/sbin/99-intelbacklighthack.rules @@ -0,0 +1 @@ +ACTION=="change", SUBSYSTEM=="backlight", RUN+="/usr/local/sbin/backlighthack.sh" diff --git a/sbin/backlighthack.sh b/sbin/backlighthack.sh new file mode 100755 index 0000000..f23adf0 --- /dev/null +++ b/sbin/backlighthack.sh @@ -0,0 +1,14 @@ +#!/bin/bash + +intelmaxbrightness=`cat /sys/class/backlight/intel_backlight/max_brightness` +acpimaxbrightness=`cat /sys/class/backlight/acpi_video0/max_brightness` +scale=`expr $intelmaxbrightness / $acpimaxbrightness` +acpibrightness=`cat /sys/class/backlight/acpi_video0/brightness` +newintelbrightness=`expr $acpibrightness \* $scale` +curintelbrightness=`cat /sys/class/backlight/intel_backlight/actual_brightness` + +if [ "$newintelbrightness" -ne "$curintelbrightness" ]; then + echo $newintelbrightness > /sys/class/backlight/intel_backlight/brightness +fi + +exit 0