LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware
User Name
Password
Linux - Hardware This forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux?

Notices

Reply
 
Search this Thread
Old 04-01-2007, 03:12 PM   #1
rohandhruva
Member
 
Registered: Dec 2004
Posts: 42

Rep: Reputation: 17
Laptop brightness on acer laptops.


Hi,

Is there any way to control laptop brightness on acer laptops ? The hardware keys work, ofcourse, but is there some software way to do it ? So that gnome-power-manager can reduce brightness when AC adapter is removed, etc. Also, so that I can use the brightness applet introduced in gnome 2.18 to control the brightness

Up until now, Ubuntu, arch and any other distro for that matter, cannot control brightness on my Acer TravelMate 3260. Is there any solution ? Does libsmbios work for acer laptops ?

Rohan.
 
Old 04-02-2007, 09:03 AM   #2
Lenard
Senior Member
 
Registered: Dec 2005
Location: Indiana
Distribution: RHEL/CentOS/SL 5 i386 and x86_64 pata for IDE in use
Posts: 4,790

Rep: Reputation: 56
Some sample files you may find useful to review and edit for your hardware specs, all are from my Acer5100 laptop;

A copy of /etc/acpi/actions/ati-powermode.sh;
Code:
#!/bin/sh

#
# Control script for ACPI lid state and AC adapter state
#
# Copyright (c) 2006, ATI Technologies Inc.  All rights reserved.
#
# Fedora Modifications By Michael Larabel <Michael AT Phoronix.com> on July 5, 2006

getXuser() {
        user=`finger| grep -m1 ":$displaynum " | awk '{print $1}'`
        if [ x"$user" = x"" ]; then
                user=`finger| grep -m1 ":$displaynum" | awk '{print $1}'`
        fi
        if [ x"$user" != x"" ]; then
                userhome=`getent passwd $user | cut -d: -f6`
                export XAUTHORITY=$userhome/.Xauthority
        else
                export XAUTHORITY=""
        fi
}


grep -q closed /proc/acpi/button/lid/*/state
if [ $? = 0 ]; then
 lid_closed=1
 echo "Lid Closed"
else
 lid_closed=0
 echo "Lid Open"
fi

grep -q off-line /proc/acpi/ac_adapter/*/state

if [ $? = 0 ]; then
   echo "On DC"
   on_dc=1
else
   echo "On AC"
   on_dc=0
fi



if [ ${lid_closed} -eq 1 -o ${on_dc} -eq 1 ]; then
    echo "Low power"
    for x in /tmp/.X11-unix/*; do
        displaynum=`echo $x | sed s#/tmp/.X11-unix/X##`
        getXuser;
        if [ x"$XAUTHORITY" != x"" ]; then
            export DISPLAY=":$displaynum"
            su $user -c "/usr/bin/aticonfig --set-powerstate=1 --effective=now"
        fi
    done
else
    echo "High power"
    for x in /tmp/.X11-unix/*; do
        displaynum=`echo $x | sed s#/tmp/.X11-unix/X##`
        getXuser;
        if [ x"$XAUTHORITY" != x"" ]; then
            export DISPLAY=":$displaynum"
            su $user -c "/usr/bin/aticonfig --set-powerstate=3 --effective=now"
        fi
    done
fi
A copy of /etc/acpi/events/ac-aticonfig;
Code:
# /etc/acpi/actions/ati-powermode.sh
# Called when the user connects ac power to us

event=ac_adapter
action=/etc/acpi/actions/ati-powermode.sh
And finally /etc/acpi/events/power.conf;
Code:
# ACPID config to power down machine if powerbutton is pressed, but only if
# no gnome-power-manager is running

event=button/power.*
action=/bin/ps awwux | /bin/grep gnome-power-manager | /bin/grep -qv grep || /sbin/shutdown -h now
Which does seem to suggest that gnome-power-manager may not be the best choice to have installed/enabled.
 
Old 04-02-2007, 09:10 AM   #3
rohandhruva
Member
 
Registered: Dec 2004
Posts: 42

Original Poster
Rep: Reputation: 17
My laptop does not have an ATI card. Your scripts are very useful. Thanks a lot

However, your scripts do not list any command to control screen brightness from software. It is possible, for eg, in HP, Dell, Asus notebooks.
 
Old 04-02-2007, 10:43 AM   #4
Lenard
Senior Member
 
Registered: Dec 2005
Location: Indiana
Distribution: RHEL/CentOS/SL 5 i386 and x86_64 pata for IDE in use
Posts: 4,790

Rep: Reputation: 56
Sorry, I do not know of any software tools to manage the screen brightness/contrast. I find the the 'Fn'+bightness/contrast buttons to be just fine.

Yes, I realize that your laptop does not have an ATi graphics interface, but as you noted the scripts are useful. A little editing and renaming (???) should be all you need.

After a little looking your laptop may not support (a BIOS issue) the acpi AC/Battery, please check around in the /proc/acpi directory structure for support. you should have sub-directories like ac-adapter and battery with files, example;

$ ls /proc/acpi/battery/BAT1
alarm info state

$ ls /proc/acpi/ac_adapter/ACAD
state

Here is another little script you may find useful (again some editing may be needed to match your hardware configuration), I named it chkpower and keep in in my home/bin directory;

Code:
#!/bin/sh
BAT_DIR=/proc/acpi/battery/BAT1
FULL_BAT=`grep 'last full capacity' ${BAT_DIR}/info | awk '{ print $4 }'`
CUR_BAT=`grep 'remaining capacity' ${BAT_DIR}/state | awk '{ print $3 }'`
AVG=`expr $(expr ${CUR_BAT} \* 100) / ${FULL_BAT}`
MyName=`uname -n`

echo
echo The current status report of the power system on $MyName is:

if grep -q 'charged' /proc/acpi/battery/BAT1/state; then
	echo The AC adapter is attached and the battery is fully charged.
	echo 
	else
		if grep -q discharging /proc/acpi/battery/BAT1/state; then
		echo On battery, $AVG % of the full charge is remaining. No AC power adapter attached.
		grep 'remaining capacity' /proc/acpi/battery/BAT1/state
		echo 
		else
		echo The AC power adapter is attached, the battery is at $AVG % of full charge and is charging.
		echo 
		fi
fi
exit 0
Also visit; http://freeunix.dyndns.org:8000/site2/acpitool.shtml

.
 
Old 04-02-2007, 11:07 AM   #5
rohandhruva
Member
 
Registered: Dec 2004
Posts: 42

Original Poster
Rep: Reputation: 17
Yes, Fn key combo is great, but being able to control it from software allows to write hooks like "reduce brightness to 50% when ac adapter is removed" and so on .. Just adds the professional touch, no real value

And, thank you - the chkpower script is great ! I am looking into acpitool now.
 
Old 04-02-2007, 01:32 PM   #6
Lenard
Senior Member
 
Registered: Dec 2005
Location: Indiana
Distribution: RHEL/CentOS/SL 5 i386 and x86_64 pata for IDE in use
Posts: 4,790

Rep: Reputation: 56
You should have enough info now to create your own acpi script to control the brightness, the author at the acpitool site may be helpful with pointers.

I also have one last script for you, this one goes into the /etc/acpi/actions directory and is named battery.sh on my laptop, it shuts down the laptop when the battery level gets critical;

Code:
#!/bin/sh
if grep -q on-line /proc/acpi/ac_adapter/ACAD/state; then
  exit 0
fi

BAT_DIR=/proc/acpi/battery/BAT1
FULL_BAT=`grep 'last full capacity' ${BAT_DIR}/info | awk '{ print $4 }'`
CUR_BAT=`grep 'remaining capacity' ${BAT_DIR}/state | awk '{ print $3 }'`
AVG=`expr $(expr ${CUR_BAT} \* 100) / ${FULL_BAT}`

if [ "$AVG" -le "4" ]; then
  action=/sbin/shutdown -h now
fi
.
 
Old 04-02-2007, 08:14 PM   #7
rohandhruva
Member
 
Registered: Dec 2004
Posts: 42

Original Poster
Rep: Reputation: 17
Thanks a lot once again Lenard, the scripts are great !
 
Old 02-02-2010, 07:10 AM   #8
blahblah
LQ Newbie
 
Registered: Nov 2009
Posts: 6

Rep: Reputation: 0
command utility to reduce brightness

Hi


I wanna write a c program which reduces the monitor brightness(monitor screen has to become dim).
So I want to know is there any command or api to dim the monitor.

Please dont suggest xgamma -gamma "value".
because it does not make the monitor dim. just it reduces RGB values.

And that API or command must work for lcd, CRT, Laptop monitors.

Thanks

Last edited by blahblah; 02-02-2010 at 07:12 AM.
 
  


Reply

Tags
acer, brightness, laptop, screen


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
Help with my screen brightness, Acer aspire 9500 Ubuntu 6.06 wfc2023 Linux - Laptop and Netbook 4 03-19-2007 08:07 PM
hsfmodem for Acer laptops depam Linux - Software 3 05-08-2006 08:48 PM
Laptop Brightness TomalakBORG Suse/Novell 7 04-24-2006 06:09 PM
LCD Brightness on laptop cwwilson721 Slackware 4 03-26-2006 03:49 PM
mandrake 10 (official) and acer laptops mat_uk111 Linux - Newbie 4 11-15-2004 06:41 AM


All times are GMT -5. The time now is 05:54 AM.

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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration