Bug 119431

Summary: Battery Charge Monitor applet not present by default
Product: [Fedora] Fedora Reporter: Michael Opdenacker <michael>
Component: gnome-panelAssignee: Mark McLoughlin <markmc>
Status: CLOSED RAWHIDE QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: rawhide   
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: 2.6.0-5 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2004-04-08 14:36:07 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Michael Opdenacker 2004-03-30 13:53:10 UTC
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.6) Gecko/20040312

Description of problem:
Hello,

I've just installed FC2 Test2 without major issues. Great work!
There are just a few minor ones though...

In particular, the "Battery Charge Monitor" Gnome applet
is not present by default. It's easy to add it by doing
"Add to Panel" -> "Utility" -> "Battery Charge Monitor"
with the right mouse button on the Gnome panel.

In KDE, such an applet is there by default, which should
be the right behaviour when a battery is reported by the
system (i'm using the default settings: apm). No need to
say that most laptop users are used to having this by default
and will consider not having it as a bug.

Could you fix this please? I hope I reported this bug on the
right component name. Don't hesitate to fix it if needed!

Cheers,

Michael.



Version-Release number of selected component (if applicable):
gnome-panel-2.5.92-1

How reproducible:
Didn't try

Steps to Reproduce:
On a laptop, login to a new user account (chosing Gnome)
    

Actual Results:  See that there is no battery monitor applet on the
Gnome panel.

Additional info:

Comment 1 Mark McLoughlin 2004-03-30 14:27:16 UTC
What does `cat /proc/apm` show ?

Comment 2 Michael Opdenacker 2004-03-30 14:47:21 UTC
Hi Mark!

Thanks for helping on this issue!

Here are the contents of /proc/apm:

AC power:
1.16ac 1.2 0x03 0x01 0x03 0x09 97% -1 ?

Battery power:
1.16ac 1.2 0x03 0x00 0x00 0x01 97% -1 ?

Hope it helps.

:-)

Michael.



Comment 3 Mark McLoughlin 2004-04-08 13:05:39 UTC
What's going on here is that you're bios doesn't support reporting the
actual time remaining on the battery and that's what the "-1 ?" bit in
/proc/apm is about.

When the panel is being installed, it currently uses this heuristic to
figure out whether to have the battery applet on the panel:

apm=false
if [ -f /proc/apm ]; then
  mins=`cat /proc/apm|awk '{ print $8 }'`
  if [ "$mins" != "-1" ]; then
    apm=true
  fi
fi

and so, that's why its not on your panel by default. Looking though
arch/i386/kernel/apm.c:apm_get_info() I'm thinking the "Battery flag"
bitfield sounds like the most reliable way to get what we want:

           5) Battery flag
              bit 0: High
              bit 1: Low
              bit 2: Critical
              bit 3: Charging
              bit 7: No system battery
              0xff: Unknown

i.e. if it is 0x80 or 0xff we shouldn't have the applet on the panel
because its a desktop machine that supports APM or something.

So, I'd change it to

apm=false
if [ -f /proc/apm ]; then
  # Battery present if top bits are unset
  flag=`cat /proc/apm|cut -d' ' -f6|sed's/0x\([0-9a-f]\)[0-9a-f]/\1/'`
  if [ "$flag" != "0" ]; then
    apm=true
  fi
fi


Comment 4 Mark McLoughlin 2004-04-08 14:36:07 UTC
Fix is in gnome-panel-2.6.0-5 which will appear in Raw Hide soon.
Re-open the bug if it doesn't work for you.

* Thu Apr  8 2004 Mark McLoughlin <markmc> 2.6.0-5
- Fix problem with apm detection in %post on machines whose
  APM bios doesn't have battery lifetime support


Comment 5 Michael Opdenacker 2004-04-09 09:07:04 UTC
Hi Mark!

Thanks a lot for this!

I will test it as soon as version 2.6.0-5 is available
(so far I still see only 2.6.0-4).

Thanks again!

Cheers,

Michael.

Comment 6 Michael Opdenacker 2004-04-28 15:14:19 UTC
Confirmed that this no longer happens on FC2 T3
Thanks again!

:-)

Michael