You are not logged in.

#1 2010-12-31 18:28:10

androith
Member
Registered: 2009-03-16
Posts: 14

Changing Brightness and Reducing Shrillness

Hello:

I've recently installed Arch on my Lenovo U350. I don't know how to change my brightness! Here's what I tried:
- I have the brightness keys working on Ubuntu 10.04 after passing nomodeset acpi_backlight=video to the kernel (vmlinuz-2.6.32). On Arch the kernel version is 2.6.36. I tried  passing nomodeset acpi_backlight=video as well as only acpi_backlight=video. The former breaks the graphics (X goes down to mesa or something) and the latter doesn't do anything on its own.
- I considered echo -n 50 > /proc/acpi/... but this won't work because of

$ cat /proc/acpi/video/GFX0/DD01/brightness 
<not supported>

I can run redshift-gtk which changes the color temperature and makes the screen bareable to look at, but it's still very SHRILL! Ideas?

$ echo "cry" 
cry

Offline

#2 2010-12-31 18:55:54

Daniel_F
Member
From: Brazil
Registered: 2010-12-28
Posts: 69

Re: Changing Brightness and Reducing Shrillness

Try this:

as root, execute

lspci | grep VGA

write the device adress, in this example it is 00:02.0

then

setpci -s 00:02.0 F4.B=XX

replacing 00:02.0 with your device address and XX with a value between 00 and FF (FF = 100%, 7F = 50%, etc...)

Let me know if it works.

Offline

#3 2010-12-31 18:59:45

androith
Member
Registered: 2009-03-16
Posts: 14

Re: Changing Brightness and Reducing Shrillness

It worked beautifully! My eyes can stop bleeding now! I'll make a little script to control these and post it here (within the month, I'm travelling to Rio -- I say this because I see you're from Brazil).

Offline

#4 2011-05-15 23:19:51

androith
Member
Registered: 2009-03-16
Posts: 14

Re: Changing Brightness and Reducing Shrillness

This is a little late, but hopefully it will be helpful for people who can't properly control their brightness.

  • I bound the following three scripts to convenient keys (CTRL+ALT+PGUP for brightness up, CTRL+ALT+PGDN for brigthtness down and CTRL+ALT+HOME for restoring brigtness to a default value).

  • The scripts require sudoless setpci (you can probably play with some chmods after looking at errors you get by running setpci to avoid editing sudoers) via a line like:

    androith ALL=(ALL) NOPASSWD: /usr/bin/setpci
  • Finally, you will have to hold a "state file" in something akin to /home/androith/.scripts/brightness/state containing only a state (BF to begin with is OK).

brightness-up.sh

#!/bin/bash

# Get the stored state from file
exec < /home/androith/.scripts/brightness/state # stdin replaced by this file
read state # first line of file goes to state variable

# Increase the state, up to FF
new_state=$(echo "$[0x$state+0x10]") # in decimal
if [ "$new_state" -gt 255 ] # 255 = FF in hex
then
    echo "Already at maximal brightness."
else
    state=$(echo "obase=16; $new_state" | bc) # put into hex
    echo "Setting brightness to $state and storing state..."
    sudo setpci -s 00:02.0 F4.B=$state # passwordless sudo
    echo $state > /home/androith/.scripts/brightness/state
fi

brightness-down.sh

#!/bin/bash

# Get the stored state from file
exec < /home/androith/.scripts/brightness/state # stdin replaced by this file
read state # first line of file goes to state variable

# Decrease the state, down to FF
new_state=$(echo "$[0x$state-0x10]") # in decimal
if [ "$new_state" -lt 15 ] # 15 = 0F in hex
then
    echo "Already at minimal brightness."
else
    state=$(echo "obase=16; $new_state" | bc) # update and put into hex
    echo "Setting brightness to $state and storing state..."
    sudo setpci -s 00:02.0 F4.B=$state # passwordless sudo
    echo $state > /home/androith/.scripts/brightness/state
fi

brightness-default.sh

#!/bin/bash

# Set brightness to default value
state=AF
sudo setpci -s 00:02.0 F4.B=$state # passwordless sudo
echo $state > /home/androith/.scripts/brightness/state

Offline

Board footer

Powered by FluxBB