From: Hugo Villeneuve Date: Sat, 6 Aug 2016 00:28:32 +0000 (-0400) Subject: Add missing ACPI volume and brightness scripts X-Git-Url: http://gitweb.hugovil.com/?p=hvlinux.git;a=commitdiff_plain;h=fe6a2f45f0ff01e47edba9439b488a6f09dbd428 Add missing ACPI volume and brightness scripts --- diff --git a/stage2/misc/acpi/brightness.sh b/stage2/misc/acpi/brightness.sh new file mode 100755 index 0000000..5e884dc --- /dev/null +++ b/stage2/misc/acpi/brightness.sh @@ -0,0 +1,35 @@ +#!/bin/bash + +basedir=/sys/class/backlight + +# In percent +min=10 +step=10 + +dir=$(find ${basedir} -type l) + +read max_raw < ${dir}/max_brightness +read cur_raw < ${dir}/brightness + +min_raw=$(echo "scale=0; (${min} * ${max_raw}) / 100" | bc) +step_raw=$(echo "scale=0; (${step} * ${max_raw}) / 100" | bc) + +case $1 in + -) + new=`expr ${cur_raw} - ${step_raw}` + if [ ${new} -le ${min_raw} ]; then + new=${min_raw} + fi + ;; + +) + new=`expr ${cur_raw} + ${step_raw}` + if [ ${new} -ge ${max_raw} ]; then + new=${max_raw} + fi + ;; + *) + exit 1 + ;; +esac + +echo ${new} > ${dir}/brightness diff --git a/stage2/misc/acpi/events/brightness-dn b/stage2/misc/acpi/events/brightness-dn new file mode 100644 index 0000000..e2a5d09 --- /dev/null +++ b/stage2/misc/acpi/events/brightness-dn @@ -0,0 +1,2 @@ +event=video/brightnessdown +action=/etc/acpi/brightness.sh - diff --git a/stage2/misc/acpi/events/brightness-up b/stage2/misc/acpi/events/brightness-up new file mode 100644 index 0000000..e2c049e --- /dev/null +++ b/stage2/misc/acpi/events/brightness-up @@ -0,0 +1,2 @@ +event=video/brightnessup +action=/etc/acpi/brightness.sh + diff --git a/stage2/misc/acpi/vol.sh b/stage2/misc/acpi/vol.sh new file mode 100755 index 0000000..caf4972 --- /dev/null +++ b/stage2/misc/acpi/vol.sh @@ -0,0 +1,12 @@ +#!/bin/bash + +step=5 + +case $1 in + -) + amixer set Master $step- + ;; + +) + amixer set Master $step+ + ;; +esac diff --git a/stage2/pkg/acpid b/stage2/pkg/acpid index f9156b9..50684d7 100644 --- a/stage2/pkg/acpid +++ b/stage2/pkg/acpid @@ -6,8 +6,7 @@ hvbuild_post() install -v -m644 ${SCRDIR}/misc/acpi/events/* /etc/acpi/events - install -v -m755 ${SCRDIR}/misc/acpi/suspend2ram.sh /etc/acpi - install -v -m755 ${SCRDIR}/misc/acpi/shutdown.sh /etc/acpi + install -v -m755 ${SCRDIR}/misc/acpi/*.sh /etc/acpi install -v -m740 ${SCRDIR}/bootscripts/acpid /etc/rc.d/init.d bootscript_add_rcsysinit acpid 65 90