Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 8479 - APM and APIC documentation/How-To
Summary: APM and APIC documentation/How-To
Status: RESOLVED WONTFIX
Alias: None
Product: [OLD] Docs-user
Classification: Unclassified
Component: Desktop Configuration Guide (show other bugs)
Hardware: x86 Linux
: High enhancement (vote)
Assignee: Gentoo KDE team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2002-09-27 13:39 UTC by John (EBo) David
Modified: 2004-10-13 17:46 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description John (EBo) David 2002-09-27 13:39:45 UTC
I've been having problems getting basic power management working on my laptop.  
Turning SMP support off causes a compilation error, and turning it on disables 
some of the APIC features (and various documented sources note problems between 
AP/APIC and SMP enabled kernels).

Can gentoo provide a How-To or FAQ note on how to get APM/APIC working under 
gentoo?

Thanks,

  EBo --
Comment 1 Sven Vermeulen (RETIRED) gentoo-dev 2003-10-09 09:24:57 UTC
You mean APM/ACPI?

Regarding kernel compilation errors, that's a kernelsource bug...
Comment 2 Benny Chuang (RETIRED) gentoo-dev 2003-10-09 19:29:59 UTC
I think John mis-spelled it. gentoo-sources/gs-sources are working fine with
most laptops.
I'm using gs-sources on my vaio (acpi + firewire + usb2)
btw, what source are you using?
Comment 3 John (EBo) David 2003-10-10 06:15:53 UTC
ummm... I wrote a reply and it looks like it did not comit...

Yes, it was a spelling/typing error (I come from the school for the spelling
impaired ;-)

The source I was originally using was pre 2.4.20 kernel.  The new source
mostly works.  The current issues are the KDE interface reports the correct
% battery left but not the remaining time.  Since the low battery and critical
low poweroff is triggered by time left and not % left, it does not work for
me.  It is possible that something is not correctly configured, but the functionality
appears to be a bug.

The little documentation I have seen on this claims it is a KDE bug.  I do
not think it is entire so for the following reason: the "present rate" in
/proc/acpi/battery/BAT0/state always remains as 0 mW.  The one time I tried
to track down the problem failed.  I will try to break out some time and
take another look into this again.
Comment 4 John (EBo) David 2003-10-10 13:15:49 UTC
OK.  I took part of the morning out to deal with the battery monitor
issue...  What I found is that the klaptop deamon has the following
comments in the code:

//	ACPI (unlike nice systems like some APM implementations) doesn't
//	tell us how much battery TIME we have left - here we
//	do a weighted average of the discharge rate (in mW) and
//	figure out how long we have left by dividing it into the 
//	remaining capacity
//
//	because some ACPI implementations return bogus 
//	rates when charging we can't estimate the battery life
//	so we only collect discharge rate data when we're actually
//	discharging

The program goes on to use the rates anyway.  On my laptop (an
HPN5210), the rate is always set to 0 mW regardless of it charging,
discharging, or fully charged.  So when the remaining time is
calculated [ap->battery_time = (rate==0||part==0?0 : 60*part/rate);]
it always evaluates to 0...  While the following hack fixes my problem
with the klaptopdaemon, it is likely that the real source of the
problem is either a bug or configuration problem in ACPI or the
kernel.

I hacked the following into klaptopdaemon (in kdeutils-3.1.4) to
attempt to solve this probloem.  Remember this is only a hack. It
appears to fuction reasonably well at this point.  The following is a
diff of portable.cpp

334,408c334
<
<       // HACK -- The rate of discharge is mucked up so estimate it
<       // using the remaining charge and dt.  Later in the daemon the
<       // rate is averaged so we will ignore the subtlities for
<       // now...
<       if (0 == rate)
<       {
< // FIXME: should go at top on in included .h files.  Placed here for
< // now to keep all hack changes as local as possible...
< #include <time.h>
<
<           static time_t    saved_time=0, cur_time;
<           static int       saved_part=part;
<           static int       ave_rate=1, num_ave=0;
<           static const int MAX_AVE=7;
<           static int       chached_rates[MAX_AVE];
<
<           // the rate is assumed to be per second or some such...
<           // So, we need to know the elapse time to calc the rate...
<           time (&cur_time);
<
<           rate = ((saved_part - part) * 3600)/(cur_time-saved_time);
<
<           // the rate will return a negitive number when charging.
<           // By forcing it positive, we estimate the duration based
<           // on (dis)charge rate.
<           if (0 > rate) rate *= -1;
<
<           if (0 == saved_time)
<           {
<               saved_time = cur_time;
<               saved_part = part;
<           }
<
<           // Turns out that the resolution of the battery monitoring
<           // results in the rate being equal to 0 much of the time.
<           // So I also average the rates here.
<           if (0 < rate)
<           {
<               int i;
<
<               if (MAX_AVE > num_ave) num_ave++;
<
<               // cache the rate and average it.
<               for (i=num_ave-1; 0<=i; i--)
<                   chached_rates[i] = chached_rates[i-1];
<               chached_rates[0] = rate;
<
<               for (i=num_ave-1,ave_rate=0; 0<=i; i--)
<                   ave_rate += chached_rates[i];
<               ave_rate /= num_ave;
<
<
< /* reality check -- for debuging */
< if (0)
<  {
<      FILE *fout = fopen ("/tmp/klaptop_debug", "a+");
<      fprintf (fout, "dt = %d\n",(int)(cur_time-saved_time));
<      fprintf (fout, "dp = %d\n",(saved_part - part));
<      fprintf (fout, "raw_rt  = %d\n",rate);
<      fprintf (fout, "ave_rt  = %d\n",ave_rate);
<      fprintf (fout, "num_ave = %d\n",num_ave);
<      fprintf (fout, "\n");
<      fclose  (fout);
<  }
<
<               // cache the time and the remaining battery life.
<               saved_time = cur_time;
<               saved_part = part;
<           }
<
<           // use the averaged rate
<           rate = ave_rate;
<       }
<
---
Comment 5 Aaron Peterson 2004-03-27 16:16:53 UTC
wow, this is assigned to the kde team?

I'm using an nforce1 motherboard... and I'm using genkernel's power management settings...  and I don't have any power management...   my bios turns off the hard disks when they arn't in use, but my monitor absolutely will not turn off..

when I run apmd
it says I don't have apm support in the kernel WTH???
Comment 6 Caleb Tennis (RETIRED) gentoo-dev 2004-10-13 17:46:06 UTC
closing as is.  if you have further requests, please resubmit a new bug to the docs-team.