acpid question [related to screen brightness]
by ricky_cardo from LinuxQuestions.org on (#56BJ4)
Question where should I place a restart command for acpid? (and why do I need to restart it when it appears to be running)
-- also I need to restart each time I [CTRL]-[ALT]-[BACKSPACE] / startx
I need to run "/etc/rc.d/rc.acpid restart" after Xwindows starts ie "startx from runlevel 3" for my WM of choice i3 to allow screen brightness adjustments.
To start off some background:
KDE - no issue (maybe it has it's own way of adjusting screen brightness which works out of the box)
i3 - I found some scripts to adjust brightness that use acpid.
I see if it is executable rc.M starts it. (I pgrep it and see an ID)
Code:rich@lemur ~ $ pgrep acpid
5067
5211But to get desired function I need to restart it.
Code:rich@lemur ~ $ sudo /etc/rc.d/rc.acpid restart
Starting ACPI daemon: /usr/sbin/acpid
rich@lemur ~ $ pgrep acpid
5067
6192
Here are the supporting files/helper :
Step 1: Test keys with acpi_listen (and press the keyboard buttons)
Code:rich@lemur ~ $ acpi_listen
video/brightnessup BRTUP 00000086 00000000
video/brightnessdown BRTDN 00000087 00000000Step 2:
add/check these:
rich@lemur $ cat /etc/acpi/acpi_handler.sh
Code:#!/bin/sh
# Default acpi script that takes an entry for all actions
IFS=${IFS}/
set $@
case "$1" in
button)
case "$2" in
power) /sbin/init 0
;;
*) logger "ACPI action $2 is not defined"
;;
esac
;;
*)
logger "ACPI group $1 / action $2 is not defined"
;;
esacrich@lemur /etc/acpi $ cat intel-backlight.sh
Code:#!/bin/bash
x=$(cat /sys/class/backlight/intel_backlight/actual_brightness)
if [ "$2" == "BRTUP" ]
then
#x=$(echo $x+490 | bc)
#echo $x > /sys/class/backlight/intel_backlight/brightness
#echo -n 467 > /sys/class/backlight/intel_backlight/brightness
/usr/bin/xbacklight +10
fi
if [ "$2" == "BRTDN" ]
then
#x=$(echo $x-490 | bc)
#echo $x > /sys/class/backlight/intel_backlight/brightness
/usr/bin/xbacklight -10
firich@lemur $ cat /etc/acpi/events/intel-backlight
Code:event=video/brightness*
action=/etc/acpi/intel-backlight.sh %e


-- also I need to restart each time I [CTRL]-[ALT]-[BACKSPACE] / startx
I need to run "/etc/rc.d/rc.acpid restart" after Xwindows starts ie "startx from runlevel 3" for my WM of choice i3 to allow screen brightness adjustments.
To start off some background:
KDE - no issue (maybe it has it's own way of adjusting screen brightness which works out of the box)
i3 - I found some scripts to adjust brightness that use acpid.
I see if it is executable rc.M starts it. (I pgrep it and see an ID)
Code:rich@lemur ~ $ pgrep acpid
5067
5211But to get desired function I need to restart it.
Code:rich@lemur ~ $ sudo /etc/rc.d/rc.acpid restart
Starting ACPI daemon: /usr/sbin/acpid
rich@lemur ~ $ pgrep acpid
5067
6192
Here are the supporting files/helper :
Step 1: Test keys with acpi_listen (and press the keyboard buttons)
Code:rich@lemur ~ $ acpi_listen
video/brightnessup BRTUP 00000086 00000000
video/brightnessdown BRTDN 00000087 00000000Step 2:
add/check these:
rich@lemur $ cat /etc/acpi/acpi_handler.sh
Code:#!/bin/sh
# Default acpi script that takes an entry for all actions
IFS=${IFS}/
set $@
case "$1" in
button)
case "$2" in
power) /sbin/init 0
;;
*) logger "ACPI action $2 is not defined"
;;
esac
;;
*)
logger "ACPI group $1 / action $2 is not defined"
;;
esacrich@lemur /etc/acpi $ cat intel-backlight.sh
Code:#!/bin/bash
x=$(cat /sys/class/backlight/intel_backlight/actual_brightness)
if [ "$2" == "BRTUP" ]
then
#x=$(echo $x+490 | bc)
#echo $x > /sys/class/backlight/intel_backlight/brightness
#echo -n 467 > /sys/class/backlight/intel_backlight/brightness
/usr/bin/xbacklight +10
fi
if [ "$2" == "BRTDN" ]
then
#x=$(echo $x-490 | bc)
#echo $x > /sys/class/backlight/intel_backlight/brightness
/usr/bin/xbacklight -10
firich@lemur $ cat /etc/acpi/events/intel-backlight
Code:event=video/brightness*
action=/etc/acpi/intel-backlight.sh %e