LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 07-30-2020, 04:45 PM   #1
ricky_cardo
Member
 
Registered: Feb 2006
Location: Syracuse, NY
Distribution: Slackware64-Current
Posts: 138

Rep: Reputation: 45
acpid question [related to screen brightness]


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
5211
But 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 00000000
Step 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"
    ;;
esac
rich@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
fi
rich@lemur $ cat /etc/acpi/events/intel-backlight
Code:
event=video/brightness*
action=/etc/acpi/intel-backlight.sh %e

Last edited by ricky_cardo; 07-30-2020 at 04:53 PM. Reason: X related
 
Old 07-30-2020, 08:58 PM   #2
ricky_cardo
Member
 
Registered: Feb 2006
Location: Syracuse, NY
Distribution: Slackware64-Current
Posts: 138

Original Poster
Rep: Reputation: 45
well I'm good for now.
(not using acip for now)
I added these: to
.i3/config
exec --no-startup-id xfce4-power-manager
exec --no-startup-id xscreensaver -no-splash &
(xfce4-power-manager has a working brightness builtin, the xscreensaver is just extra)
 
Old 07-31-2020, 04:12 AM   #3
GazL
LQ Guru
 
Registered: May 2008
Distribution: CRUX
Posts: 5,519
Blog Entries: 14

Rep: Reputation: 3345Reputation: 3345Reputation: 3345Reputation: 3345Reputation: 3345Reputation: 3345Reputation: 3345Reputation: 3345Reputation: 3345Reputation: 3345Reputation: 3345
The other option is to append acpi_backlight=video to your kernel parameters in [e]lilo.conf and let the kernel driver handle it, making it desktop independent without any acpid involvement.

If you do use acpid scripts to do this, then better to just update the properties in /sys/class/backlight/.. directly. Having it run xbacklight is a mistake, as acpid doesn't run as part of your X11 session.

--
This is what I do. I also map the brightness keys to void in the keymaps so nothing else acts on them.

Last edited by GazL; 07-31-2020 at 04:14 AM.
 
3 members found this post helpful.
Old 07-31-2020, 01:10 PM   #4
ricky_cardo
Member
 
Registered: Feb 2006
Location: Syracuse, NY
Distribution: Slackware64-Current
Posts: 138

Original Poster
Rep: Reputation: 45
Excellent advice. That makes sense why the acpi script only worked in X and the advice about the append is spot on!!!
- I Appended and brightness adjustments are working everywhere (runlevel3 and X)
Thanks for the suggestion!!!
 
1 members found this post helpful.
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Change brightness percentage that screen brightness keys increase/decrease MozillaUser3172 Slackware 5 03-24-2020 06:07 PM
ACPID scripts only work when restart acpid from terminal jasonkhonlaw Linux - Laptop and Netbook 4 01-22-2020 11:06 AM
Mint 15 = black screen (brightness = 0) on start up - have to manually set brightness Netnovice Linux Mint 4 01-16-2014 08:46 PM
[SOLVED] acpid "xscreensaver-command -lock" not working until acpid is restarted TommyC7 Slackware 1 06-30-2012 03:40 AM
[SOLVED] acpid "Solution: please add acpid to /etc/runlevel.conf to start before hal/dbus" linus72 Linux - General 2 10-04-2009 07:40 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 10:28 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration