LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Laptop and Netbook
User Name
Password
Linux - Laptop and Netbook Having a problem installing or configuring Linux on your laptop? Need help running Linux on your netbook? This forum is for you. This forum is for any topics relating to Linux and either traditional laptops or netbooks (such as the Asus EEE PC, Everex CloudBook or MSI Wind).

Notices


Reply
  Search this Thread
Old 10-18-2003, 09:06 PM   #1
sublynx
LQ Newbie
 
Registered: Oct 2003
Posts: 8

Rep: Reputation: 0
battstat a proc hog


when i use the battstat gnome applet, it constantly takes up from 13%-19% of proc usage. as soon as i remove it usage goes straight to 0%. This is a new installation of Slack9.1 and i used the bareacpi.i kernel. when i used just the bare.i and loaded the apm mod manually, i didnt have this problem. is there a fix or should i just change back to the old way of doing it?
 
Old 10-18-2003, 09:33 PM   #2
lupin_the_3rd
Member
 
Registered: Oct 2003
Location: Memphis, TN
Distribution: Slackware current
Posts: 485

Rep: Reputation: 30
what model laptop? My i8500 had to have a patched gnome-applets becaude I was seeing the same problem. No probs now...

here's the patch:

http://ltswww.epfl.ch/~dsanta/resour...pi-events.diff
Get the gnome applets src and patch...
 
Old 10-19-2003, 04:29 AM   #3
sublynx
LQ Newbie
 
Registered: Oct 2003
Posts: 8

Original Poster
Rep: Reputation: 0
its a dell latitude CPx

it seems acpi isnt doing anything for me at all. when i close the top for the laptop, everything still runs unlike apm when i closed it it went into standby. i would think it didnt work if not for the battstat applet. is there a acpi config somewhere i should take a look at?

my power button no longer works either, i have to shutdown via "shutdown -h now" to get it to shut off.

even more.... i check the logs for acpid and this is what i found
/var/log/acpid:
[Sun Oct 19 04:18:46 2003] received event "button/power PBTN 00000080 00000005"
[Sun Oct 19 04:18:46 2003] executing action "/etc/acpi/acpi_handler.sh button/power PBTN 00000080 00000005"
[Sun Oct 19 04:18:46 2003] BEGIN HANDLER MESSAGES
[Sun Oct 19 04:18:46 2003] END HANDLER MESSAGES
[Sun Oct 19 04:18:46 2003] action exited with status 0
[Sun Oct 19 04:18:46 2003] completed event "button/power PBTN 00000080 00000005"

/etc/acpi/acpi_handler.sh contents:
#!/bin/sh
# Default acpi script that takes an entry for all actions

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

im lost......

edit: not any more

i read some of your previous posts about acpi and got all the info i needed from them, except still no standby mode when lid is closed.

Last edited by sublynx; 10-19-2003 at 05:17 AM.
 
Old 10-19-2003, 07:05 AM   #4
lupin_the_3rd
Member
 
Registered: Oct 2003
Location: Memphis, TN
Distribution: Slackware current
Posts: 485

Rep: Reputation: 30
/etc/acpi/actions/lid

#!/bin/sh

# Acts on lid open/close events

# Load config
if [ -f /etc/acpi/actions/functions ]; then
. /etc/acpi/actions/functions
else
exit 1
fi

# Take action
if lid_open ; then
screen_power on
else # lid closed
# we do nothing if we are on AC power, as we probably have an
# external monitor present. Best of course would be to test
# for prescence of external monitor, but don't know how
if ! ac_online; then
screen_power off
fi
fi


/etc/acpi/actions/ac_adapter

!/bin/sh

# Acts on AC power change status

# Load config
if [ -f /etc/acpi/actions/functions ]; then
. /etc/acpi/actions/functions
else
exit 1
fi
if [ -f /etc/acpi/actions/config ]; then
. /etc/acpi/actions/config
fi

# Since APM is not available the APM script cannot handle
# the power changes (the apm command to query power status does not work).
# We emulate behaviour of APM script.

. $APMCONFIG

# Act on power related services, arg must be 'start' or 'stop'
power_services () {
[ -z "$POWER_SERVICES" ] && return
for i in $POWER_SERVICES; do
/sbin/service $i $1
done
}

# Adjusts CPU power setting, arg must be 'high' or 'low'
# Method depends on CPUPOWER variable
cpu_power () {

if [ -f /var/lock/subsys/cpudynd -a "$CPUPOWER" != "cpudyn" ]; then
echo "WARN: cpudyn service apparantly running but using non cpudyn method" 2>&1
fi

case "$CPUPOWER" in
cpudyn)
if [ ! -f /var/lock/subsys/cpudynd ]; then
echo "ERROR: cpudynd service not running" 1>&2
return
fi
if [ "$1" == "high" ]; then
killall -USR1 cpudynd # lock cpudynd at maximum
else
killall -HUP cpudynd # let cpudynd dynamically adjust
fi
;;
cpufreq)
if [ ! -f /proc/cpufreq ]; then
echo "ERROR: cpufreq support not present" 1>&2
return
fi
if [ "$1" == "high" ]; then
echo -n "0%${CPUFREQ_MIN_AC}%${CPUFREQ_MAX_AC}%${CPUFREQ_POL_AC}" > /proc/cpufreq
else
echo -n ""0%${CPUFREQ_MIN_BAT}%${CPUFREQ_MAX_BAT}%${CPUFREQ_POL_BAT}"" > /proc/cpufreq
fi
;;
acpi)
if [ ! -f /proc/acpi/processor/CPU0/performance ]; then
echo "ERROR: ACPI processor support not present" 1>&2
return
fi
if [ "$1" == "high" ]; then
echo -n 0 > /proc/acpi/processor/CPU0/performance
else
n=`sed '/^state count:/{s/[^0-6]*//;p};d' < /proc/acpi/processor/CPU0/performance`
n="$[$n-1]"
echo -n $n > /proc/acpi/processor/CPU0/performance
fi
;;
off)
;;
*)
echo "ERROR: invalid CPUPOWER value" 1>&2
esac
}

# Act on change
if ac_online; then
power_services start
cpu_power high
if [ -x /etc/acpi/actions/laptop-mode ]; then
/etc/acpi/actions/laptop-mode stop
fi
else # AC off-line
power_services stop
cpu_power low
if [ -x /etc/acpi/actions/laptop-mode ]; then
/etc/acpi/actions/laptop-mode start
fi
fi
exit 0


/etc/acpi/actions/functions

#!/bin/sh

#
# Setup
#

# Check prescense of /proc filesystem
if [ ! -d /proc ]; then
echo "ERROR: /proc filesystem not present" 1>&2
exit 1
fi

# Autodetect APM script location
if [ -x /etc/sysconfig/apm-scripts/apmscript ]; then
APMSCRIPT=/etc/sysconfig/apm-scripts/apmscript
elif [ -x /etc/apm/apmd_proxy ]; then
APMSCRIPT=/etc/apm/apmd_proxy
else
APMSCRIPT=:
fi

# Autodetect APM config location
if [ -f /etc/sysconfig/apmd ]; then
APMCONFIG=/etc/sysconfig/apmd
else
APMCONFIG=/dev/null
fi

#
# Functions
#

# Check VMware usage
check_vmware_off () {
# we check vmware usage by checking the module usage count for vmmon
local n
[ -f /proc/modules ] || return 0
n=`sed '/^vmmon/{s/vmmon[^0-9]*[0-9]*[^0-9]*\([0-9]*\).*$/\1/;p};d' < /proc/modules`
if [ -z "$n" -o "$n" == "0" ]; then
return 0
else
return 1
fi
}

# Check if nothing that prevents suspending is running
# currently vmware only
check_suspend_ok () {
if [ ! check_vmware_off ]; then
echo "ERROR: vmware is running cannot suspend" 1>&2
return 1
fi
return 0
}

# Execute specified hdparm options on all present hard disks (not cd-roms)
# Currently only IDE
hdparm_all_hd () {
local d
local t
for d in a b c d e f g h i j k l m n o p q r s t ; do
if [ -e /proc/ide/hd$d ] ; then
t=`cat /proc/ide/hd$d/media`
[ "$t" == "disk" ] && hdparm "$@" /dev/hd$d
fi
done
}

# Execute specified hdparm options on all present drives
# Currently only IDE
hdparm_all_drives () {
local d

for d in a b c d e f g h i j k l m n o p q r s t ; do
[ -e /proc/ide/hd$d ] && hdparm "$@" /dev/hd$d
done
}

# Spins all disks down
spin_disks_down () {
hdparm_all_drives -y
}

# Screen power on all active local X servers, arg 1 must be 'on' or 'off'
screen_power () {
local lock pid user disp xauth
if [ "$1" != "on" -a "$1" != "off" ] ; then
echo "ERROR: invalid arg for screen_blanking()" 1>&2
return 1
fi
# do DPMS call on each locally running X server
for lock in /tmp/.X*-lock ; do
[ -O $lock ] || continue # effective ID is always root here
pid=`cat $lock`
pid=`echo $pid` # remove leading spaces
tr '\0' '\n' < /proc/$pid/cmdline | egrep -q '(^|/)X$' || continue;
user=`tr '\0' '\n' < /proc/$pid/environ | sed '/^USER=/{s/.*=//;p};d'`
disp=`tr '\0' '\n' < /proc/$pid/cmdline | grep '^:[0-9][0-9]*$'`
xauth=`tr '\0' '\n' < /proc/$pid/environ | sed '/^XAUTHORITY=/{s/.*=//;p};d'`
[ -z "$disp" ] && continue
[ -n "$xauth" ] && export XAUTHORITY=$xauth
export DISPLAY=$disp
if [ -n "$user" -a "$user" != "root" ]; then
su -s /bin/sh -m -c "/usr/X11R6/bin/xset dpms force $1" $user
else
/usr/X11R6/bin/xset dpms force $1
fi
done
unset DISPLAY
unset XAUTHORITY
}

# Checks if running on AC power
ac_online () {
if [ ! -f /proc/acpi/ac_adapter/AC/state ]; then
echo "ERROR: ACPI AC status support not present" 1>&2
return 0
fi
if LC_ALL=C grep -q on-line < /proc/acpi/ac_adapter/AC/state; then
return 0
else
return 1
fi
}

# Checks if lid is open
lid_open () {
if [ ! -f /proc/acpi/button/lid/LID/state ]; then
echo "ERROR: ACPI button support not present" 1>&2
return 0
fi
if LC_ALL=C grep -q open < /proc/acpi/button/lid/LID/state; then
return 0
else
return 1
fi
}

/etc/acpi/actions/suspend

#!/bin/sh

# Sleep to ACPI S1 state. Higher states not supported on Linux 2.4.x

# Load config
if [ -f /etc/acpi/actions/functions ]; then
. /etc/acpi/actions/functions
else
exit 1
fi

if [ ! -f /proc/acpi/sleep ]; then
echo "ERROR: ACPI support not present" 1>&2
exit 1
fi

LOCKFILE=/var/lock/subsys/acpi-suspend

if [ -f $LOCKFILE ]; then
pid=`cat $LOCKFILE`
wall "ACPI suspend requested but previous suspend process still going (PID $pid)"
exit 1
fi

# Check that suspend would be OK
check_suspend_ok || exit 1
# Start suspend process
echo $$ > "$LOCKFILE"
screen_power off
# Perform APM configured suspend settings
"$APMSCRIPT" standby user
sync
spin_disks_down
# Suspend
echo -n "1" > /proc/acpi/sleep
# Resume back to normal
"$APMSCRIPT" resume standby
screen_power on
rm -f "$LOCKFILE"

/etc/acpi/events/sleep

# Events for suspend button

event=button/sleep.*
action=/etc/acpi/actions/suspend %e

/etc/acpi/actions/lid

# Events for plug / unplug AC adapter

event=button/lid.*
action=/etc/acpi/actions/lid %e

/etc/acpi/actions/ac_adapter

# Events for plug / unplug AC adapter

event=ac_adapter.*
action=/etc/acpi/actions/ac_adapter %e

Last edited by lupin_the_3rd; 10-19-2003 at 07:09 AM.
 
Old 01-03-2004, 12:25 AM   #5
pibby
Member
 
Registered: Oct 2003
Location: Houston, TX
Distribution: Debian Sid
Posts: 100

Rep: Reputation: 15
I'm about to try this out on an Inspiron 5100, hopefully it will do some good
 
Old 01-03-2004, 12:37 AM   #6
pibby
Member
 
Registered: Oct 2003
Location: Houston, TX
Distribution: Debian Sid
Posts: 100

Rep: Reputation: 15
Unfortunately that didn't help with my problem
I wish this darn backlight would turn off when I close my lid!
 
  


Reply



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
Correlation between /proc/devices and /proc/modules ColinLadyka Linux - General 1 02-13-2006 05:25 PM
battstat driving me mad oookiezooo Linux - Newbie 1 04-15-2005 06:22 AM
gnome battstat only works as root shadowhunter Linux - Laptop and Netbook 0 03-17-2004 11:43 AM
battstat hydro Linux - Laptop and Netbook 3 07-19-2003 07:53 PM
gnome-applets : battstat h/w Linux - Newbie 0 04-06-2003 12:59 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Laptop and Netbook

All times are GMT -5. The time now is 07:57 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