You are not logged in.

#1 2012-02-02 18:45:12

williamkray
Member
Registered: 2010-11-06
Posts: 64

[SOLVED] YASBI (yet another screen brightness issue)

i feel silly posting this, as there seems to be a lot of documentation about this, but i'm kind of baffled.  if i run

echo "5" > /sys/class/backlight/acpi_video0/brightness

as root, everything works nicely, my screen turns it's brightness down to half-way (max brightness is 10).

if i run the same command as sudo, i get a permissions error.  my final goal is to bind this to a key in openbox, but first i need to figure out what i'm doing wrong.  do i need to be part of a certain group?  do i need to edit my sudoers file?

thanks in advance.

Last edited by williamkray (2012-02-02 22:49:56)

Offline

#2 2012-02-02 19:55:27

fraherm
Member
Registered: 2011-12-07
Posts: 4

Re: [SOLVED] YASBI (yet another screen brightness issue)

I think you can fix this by using tee.

echo "5" | sudo tee /sys/class/backlight/acpi_video0/brightness

//EDIT
Your problem is also described in this blog post:
http://www.refining-linux.org/archives/ … seful-tee/

Last edited by fraherm (2012-02-02 19:57:00)

Offline

#3 2012-02-02 22:49:34

williamkray
Member
Registered: 2010-11-06
Posts: 64

Re: [SOLVED] YASBI (yet another screen brightness issue)

i have solved this, and am posting how here for anyone else who might come across this in a search. this is what i came up with:

added the following to my /etc/rc.local:

chgrp users /sys/class/backlight/acpi_video0/brightness && chmod g=+rw /sys/class/backlight/acpi_video0/brightness

then i came across this script on another forum post, and saved it to /usr/sbin/brightness, made it executable and chgrp users:

#!/bin/bash

file="/sys/class/backlight/acpi_video0/brightness"
level=$(cat $file)

if [[ "$#" -eq 0 ]]; then
    cat $file
elif [[ "$1" = "-" ]]; then
    echo $(( level - 1 )) > $file
elif [[ "$1" = "+" ]]; then
    echo $(( level + 1 )) > $file
fi

then in my ~/.config/openbox/rc.xml i added the following code to bind the commands to my Super+Up and Super+Down :

    <keybind key="W-Up">
      <action name="Execute">
        <command>brightness +</command>
      </action>
    </keybind>
    <keybind key="W-Down">
      <action name="Execute">
        <command>brightness -</command>
      </action>
    </keybind>

Last edited by williamkray (2012-02-02 22:51:28)

Offline

#4 2012-02-14 18:49:34

ludwis
Member
Registered: 2011-01-17
Posts: 29

Re: [SOLVED] YASBI (yet another screen brightness issue)

Although this post is marked as solved, I'd like to add my solution to this problem. I found a very handy script here. It uses ACPI events, so it can be controled with the standard brightness keys, and it is able to react to events like unplugging the power cable.  I run it as a daemon, and had to modify some parts of the code to adapt it to Arch (like the default path of the deamon directory). I also used

acpi_listen

to find the ACPI event codes for my Fn + brightness key combinations. The script controls backlight using

/sys/class/backlight/nvidia_backlight/brightness

file but it can easily be adapted to using any other file. Hope it helps someone smile

Offline

Board footer

Powered by FluxBB