# Battery Status Not Working Without KDE



## shuxuef (Sep 3, 2009)

Hello, there!

I have recently installed FreeBSD 7.2-release on my HP compaq v3913tu laptop, and upgraded it to 7.2-release-p3. The acpi is not working very properly. Besides the problems about suspending and resuming, I couldn't get the battery status via 'sysctl' or 'acpiconf'. But if I start kde4.3.0 or kde4.3.1, then from the battery status widget, I can check the status of the battery.

So I am wondering if they are using different techniques to check the status, and if it's possible to check the status without kde4.3.* running. Thanks!


----------



## Carpetsmoker (Sep 3, 2009)

apm(8)?

Can you post which package this applet belongs to? I can't find it right now (pkg_info -W)


----------



## shuxuef (Sep 3, 2009)

Carpetsmoker said:
			
		

> apm(8)?



Unlikely, because the handbook says:

```
ACPI and APM cannot coexist and should be used
separately. The last one to load will terminate
if the driver notices the other running.
```



			
				Carpetsmoker said:
			
		

> Can you post which package this applet belongs to? I can't find it right now (pkg_info -W)



It's installed by 
kdebase-workspace-4.3.1.

Thanks!


----------



## Carpetsmoker (Sep 3, 2009)

I looked at the source, but I can't find any direct source for the battery status, as usual it's not so easy with KDE.
Possible source seem to be HAL...

If anyone finds out how this works, then I would be quite interested in knowing how.


----------



## shuxuef (Sep 4, 2009)

Carpetsmoker said:
			
		

> I looked at the source, but I can't find any direct source for the battery status, as usual it's not so easy with KDE.
> Possible source seem to be HAL...
> 
> If anyone finds out how this works, then I would be quite interested in knowing how.



Err..... Even the KDE applet is not working today.... Actually I just upgraded KDE to 4.3.1 from 4.3.0 yesterday.....That is so weird.  Maybe something was broken during the process of upgrading....

But I am absolutely sure that in KDE4.3.0 it worked.

(After posting this post, it turned out that the applet would work in KDE4.3.1 after a certain amount of time.)


----------



## shuxuef (Sep 4, 2009)

Carpetsmoker said:
			
		

> I looked at the source, but I can't find any direct source for the battery status, as usual it's not so easy with KDE.
> Possible source seem to be HAL...
> 
> If anyone finds out how this works, then I would be quite interested in knowing how.



How about this:
http://lxr.kde.org/source/KDE/kdebase/workspace/plasma/applets/battery/battery.cpp


----------



## Carpetsmoker (Sep 4, 2009)

That doesn't get the battery status directly, at glance it seems to use a ``source'' or ``dataengine''
(I looked at that file).


----------



## CkoTuHa (Sep 9, 2009)

hi, I've just upgraded to 4.3.1. Gentoo. So, the battery plasmoid doesn't show estimated time when on battery.

Checked out the code from kde svn. And it says in Battery::updateStatus() function :


```
//kDebug() << "time left:" << m_remainingMSecs;
            /*
            if (state == "Discharging" && m_remainingMSecs > 0 && m_showRemainingTime) {

                // FIXME: Somehow, m_extenderApplet is null here, so the label never becomes visible
                if (m_extenderApplet) {
                    m_extenderApplet->showBatteryLabel(true);
                }
                // we don't have too much accuracy so only give hours and minutes
                batteryLabelText.append(i18n("Time remaining: <b>%1</b>
", KGlobal::locale()->prettyFormatDuration(m_remainingMSecs)));
            } else {
            */
                //if (m_extenderApplet) {
                //    m_extenderApplet->showBatteryLabel(false);
                //}
```


which I guess is the reason. I am pretty much relaxed now - I thought it is all because I screwed up my installation.


----------

