# ACPI for Laptops (battery status...)

## gelbasack

Anyone got ACPI working on a laptop so the battery status is shown in the taskbar?

I compiled everything concerning ACPI in the kernel. Well, i got an interface /proc/acpi/* where I see stuff like temperature. But the folders battery and acadaptor are empty  :Sad: 

KDE says I got a partial ACPI installation. But got no idea what else I should compile in the kernel. There's nothing left I think. Didn't find anything else concerning ACPI than in Advanced Power Management section.

Also installed adpid and run it in default runlevel but didn't change anything.

----------

## Akhouk

 *gelbasack wrote:*   

> Anyone got ACPI working on a laptop so the battery status is shown in the taskbar?
> 
> I compiled everything concerning ACPI in the kernel. Well, i got an interface /proc/acpi/* where I see stuff like temperature. But the folders battery and acadaptor are empty 
> 
> 

 

Mine works fine on my Sony Vaio. It was quite simple, compiled the acpi modules and loaded them and the information appears. I don't use kde but my gnome task bar shows the battery usage reading the info from /proc/acpi.

You might want to check your laptop make on some of the acpi sites to see if is known to work. I know that some laptops have broken acpi. It really depends on the make/model of the laptop.

----------

## shakayoda

A bit late, but I'm pretty sure you configured your kernel with ac_adapter as module. You need to modprobe ac in order to have battery state.

----------

## nzyme

here it says something like "file in use" when doeing cat /proc/acpi/batterystatus (somethin like that).

----------

## shakayoda

Okay. Let's start with the beginning then. Which kernel are you using? Can you send your config (the part about performance would do it). Which modules did you load? (check with lsmod).

----------

## moonlight

modprobe ac

modprobe battery

this should do the trick.

Cheers MoonlightLast edited by moonlight on Thu Nov 11, 2004 9:05 am; edited 1 time in total

----------

## ryceck

Got an armada e500

Just enabled ACPI, everything in kernel (not fond of modules for things that are used constantly) and it works like a charm. Klaptop shows everything perfectly and my Gkrellm works too...

Here is my kernel config regarding ACPI:

```

cloud ~ $ zcat /proc/config.gz |grep ACPI

# Power management options (ACPI, APM)

# ACPI (Advanced Configuration and Power Interface) Support

CONFIG_ACPI=y

CONFIG_ACPI_BOOT=y

CONFIG_ACPI_INTERPRETER=y

CONFIG_ACPI_SLEEP=y

CONFIG_ACPI_SLEEP_PROC_FS=y

CONFIG_ACPI_AC=y

CONFIG_ACPI_BATTERY=y

CONFIG_ACPI_BUTTON=y

CONFIG_ACPI_FAN=y

CONFIG_ACPI_PROCESSOR=y

CONFIG_ACPI_THERMAL=y

# CONFIG_ACPI_ASUS is not set

# CONFIG_ACPI_TOSHIBA is not set

CONFIG_ACPI_BLACKLIST_YEAR=0

# CONFIG_ACPI_DEBUG is not set

CONFIG_ACPI_BUS=y

CONFIG_ACPI_EC=y

CONFIG_ACPI_POWER=y

CONFIG_ACPI_PCI=y

CONFIG_ACPI_SYSTEM=y

CONFIG_ACPI_INITRD=y

```

That should do the trick I guess.

----------

## jonasmattsson

I've got a related problem. this is how my battery state has ben the last 30 minutes now.

```
 laptux jonas # cat /proc/acpi/battery/BAT1/state

present:                 yes

capacity state:          ok

charging state:          discharging

present rate:            1504 mA

remaining capacity:      1792 mAh

present voltage:         14656 mV
```

doesnt seem to update, i have compiled my acpi support as in-kernel.

it does however update on reboot (had 100% for half an hour at first)

i wonder how much time i've got now...  :Shocked: 

----------

## Longfield

 *jonasmattsson wrote:*   

> I've got a related problem. this is how my battery state has ben the last 30 minutes now.
> 
> ```
>  laptux jonas # cat /proc/acpi/battery/BAT1/state
> 
> ...

 

exactly the same here ... the thing is that at boot, the kernel says the battery is absent !  :Shocked: 

and I think I used to have /proc/acpi/battery/BAT0/* instead of BAT1 ...

----------

## Longfield

noone has an idea about the "fixed" battery info with acpi support in kernel and not in modules ?

may that be in relationship with hotplug <-> coldplug changes ? may it better work if i compile acpi support as module ?

----------

## quiver

Bump!

This is my exact problem too, I'm running 2.6.10 with acpid compiled and run at boot time, and unplugging and replugging in the AC adapter does cause an update and XFCE's panel battery status indicator updates fine.  But any other time, checking the panel's indicator reports the same charge % and time (obviously it can't calculate the time correctly yet) as it did when last I looked...  It's not the XFCE panel plugin because running 

```
cat /proc/acpi/battery/BAT1/state
```

 also never reports any differently, unless I force an update by unplugging/plugging in the AC adapter.

I have hunted high and low and would love a solution to this frustrating problem!

----------

## Earthwings

Please use a recent kernel 2.6.10 to be sure the problem is not already fixed. Can you post the output of dmesg | grep -i acpi (clean boot, not swsusp)? There's something similar in http://bugzilla.kernel.org/show_bug.cgi?id=3974 where it works on a 2.4.x kernel. If you've got one around, please test with that, too.

----------

## quiver

As requested (pulled from a non swsusp 2.6.10 r2 kernel, I'm afraid I don't have a 2.4 kernel handy);

```
laptop ~ # dmesg | grep -i acpi

 BIOS-e820: 000000000bff0000 - 000000000bfffc00 (ACPI data)

 BIOS-e820: 000000000bfffc00 - 000000000c000000 (ACPI NVS)

ACPI: RSDP (v000 PTLTD                                 ) @ 0x000f6b60

ACPI: RSDT (v001 PTLTD    RSDT   0x00000000  LTP 0x00000000) @ 0x0bffd1f0

ACPI: FADT (v001 IBM    TP240    0x00000002 PTL  0x000f4240) @ 0x0bfffb65

ACPI: BOOT (v001 PTLTD  $SBFTBL$ 0x00000000  LTP 0x00000001) @ 0x0bfffbd9

ACPI: DSDT (v001    PTL    BX-TJ 0x00000000 MSFT 0x0100000b) @ 0x00000000

ACPI: setting ELCR to 0200 (from 0a20)

ACPI: Subsystem revision 20041105

ACPI: Interpreter enabled

ACPI: Using PIC for interrupt routing

ACPI: PCI Root Bridge [PCI0] (00:00)

ACPI: PCI Interrupt Routing Table [\_SB_.PCI0._PRT]

ACPI: PCI Interrupt Link [LNKA] (IRQs 3 4 5 6 7 9 10 11 14 15) *0, disabled.

ACPI: PCI Interrupt Link [LNKB] (IRQs 3 4 5 6 7 9 10 *11 14 15)

ACPI: PCI Interrupt Link [LNKC] (IRQs 3 4 *5 6 7 9 10 11 14 15)

ACPI: PCI Interrupt Link [LNKD] (IRQs 3 4 5 6 7 9 10 *11 14)

ACPI: Embedded Controller [EC0] (gpe 9)

ACPI: Power Resource [PFAN] (off)

pnp: PnP ACPI init

pnp: PnPACPI: METHOD_NAME__CRS failure for IBM0071

pnp: PnP ACPI: found 11 devices

PCI: Using ACPI for IRQ routing

ACPI: AC Adapter [ACAD] (off-line)

ACPI: Battery Slot [BAT1] (battery present)

ACPI: Power Button (FF) [PWRF]

ACPI: Sleep Button (CM) [SBTN]

ACPI: Lid Switch [LID]

ACPI: Fan [FAN] (off)

ACPI: Processor [CPU0] (supports C1 C2)

ACPI: Processor [CPU0] (supports 8 throttling states)

ACPI: Thermal Zone [THRM] (57 C)

ibm_acpi: ec object not found

ACPI: PCI Interrupt Link [LNKB] enabled at IRQ 11

ACPI: PCI interrupt 0000:00:0a.0[A] -> GSI 11 (level, low) -> IRQ 11

ACPI: PCI Interrupt Link [LNKD] enabled at IRQ 11

ACPI: PCI interrupt 0000:00:07.2[D] -> GSI 11 (level, low) -> IRQ 11

ACPI wakeup devices:

ACPI: (supports S0 S1 S3 S4 S4bios S5)

ACPI: PCI interrupt 0000:01:00.0[A] -> GSI 11 (level, low) -> IRQ 11

ACPI: PCI Interrupt Link [LNKC] enabled at IRQ 5

ACPI: PCI interrupt 0000:00:0b.0[A] -> GSI 5 (level, low) -> IRQ 5
```

----------

## Earthwings

What happens if you unload and reload the battery module? Is it updated afterwards?

----------

## liber!

Sometimes your dsdt table is not right (certainly if it's compiled with Microsoft MSFT aml compiler). In this thread you learn to check and correct the dsdt: HOWTO: Fix Common ACPI Problems (DSDT, ECDT, etc.)

I see from the dmesg that you use a MSFT compiled dsdt...

```
ACPI: DSDT (v001    PTL    BX-TJ 0x00000000 MSFT 0x0100000b) @ 0x00000000 
```

Hope this can solve it....

Greets,

 Nathan

----------

## hiroki

just a short question(in general).

does a DSDT change when RAM is upgraded? I had a fully working laptop (with 512 MB DDR), i downloaded an already fixed DSDT and it simply worked. in particular: the system showed the correct battery status.

But then (some months ago) I upgraded to 768 MB DDR RAM. But then the DSDT [used as kernel option: initrd DSDT] doesn't work anymore. there are lots of ACPI errors etc. and the battery isn't recognized anymore.

fixing the DSDT by myself seems impossible to me, because there are error messages i have no idea how to fix them. those errors are not mentioned in the "official" HOWTO either.

what can be done? isit normal, that the DSDT changes when upgrading RAM?

thx,

grtz,

hiroki

----------

## quiver

Ok, here's where I'm at...

I did go through the howto you posted Nathan (thanks!), and found no errors and five warnings when I recompiled the DSDT (plus 186 optimizations!).  I fixed one of the warnings as per the howto's linked warnings reference, though I still get four.  I'm not sure how dire these are (being warnings rather than errors), so you tell me... 

```
laptop compiler # ./iasl -tc dsdt.dsl

Intel ACPI Component Architecture

ASL Optimizing Compiler / AML Disassembler version 20041203 [Jan 19 2005]

Copyright (C) 2000 - 2004 Intel Corporation

Supports ACPI Specification Revision 2.0c

dsdt.dsl  1270:                     Release (PSMX)

Warning  2079 -        Statement is unreachable ^

dsdt.dsl  1290:                     Release (PSMX)

Warning  2079 -        Statement is unreachable ^

dsdt.dsl  1309:                     Release (PSMX)

Warning  2079 -        Statement is unreachable ^

dsdt.dsl  1319:                     Release (PSMX)

Warning  2079 -        Statement is unreachable ^

ASL Input:  dsdt.dsl - 2308 lines, 74531 bytes, 1241 keywords

AML Output: DSDT.aml - 10096 bytes 333 named objects 908 executable opcodes

Compilation complete. 0 Errors, 4 Warnings, 0 Remarks, 0 Optimizations

```

I have of course since recompiled the kernel using the post 2.6.9 external DSDT intergration method, though no change in my issue.  So, my updated dmesg output follows (this is a swsusp 2.6.10 kernel): 

```
laptop compiler # dmesg | grep -i acpi

 BIOS-e820: 000000000bff0000 - 000000000bfffc00 (ACPI data)

 BIOS-e820: 000000000bfffc00 - 000000000c000000 (ACPI NVS)

ACPI: RSDP (v000 PTLTD                                 ) @ 0x000f6b60

ACPI: RSDT (v001 PTLTD    RSDT   0x00000000  LTP 0x00000000) @ 0x0bffd1f0

ACPI: FADT (v001 IBM    TP240    0x00000002 PTL  0x000f4240) @ 0x0bfffb65

ACPI: BOOT (v001 PTLTD  $SBFTBL$ 0x00000000  LTP 0x00000001) @ 0x0bfffbd9

ACPI: DSDT (v001    PTL    BX-TJ 0x00000000 MSFT 0x0100000b) @ 0x00000000

    ACPI-0294: *** Info: Table [DSDT] replaced by host OS

ACPI: setting ELCR to 0200 (from 0a20)

ACPI: Subsystem revision 20041105

ACPI: Interpreter enabled

ACPI: Using PIC for interrupt routing

ACPI: PCI Root Bridge [PCI0] (00:00)

ACPI: PCI Interrupt Routing Table [\_SB_.PCI0._PRT]

ACPI: PCI Interrupt Link [LNKA] (IRQs 3 4 5 6 7 9 10 11 14 15) *0, disabled.

ACPI: PCI Interrupt Link [LNKB] (IRQs 3 4 5 6 7 9 10 *11 14 15)

ACPI: PCI Interrupt Link [LNKC] (IRQs 3 4 *5 6 7 9 10 11 14 15)

ACPI: PCI Interrupt Link [LNKD] (IRQs 3 4 5 6 7 9 10 *11 14)

ACPI: Embedded Controller [EC0] (gpe 9)

ACPI: Power Resource [PFAN] (off)

pnp: PnP ACPI init

pnp: PnPACPI: METHOD_NAME__CRS failure for IBM0071

pnp: PnP ACPI: found 11 devices

PCI: Using ACPI for IRQ routing

ACPI: AC Adapter [ACAD] (off-line)

ACPI: Battery Slot [BAT1] (battery present)

ACPI: Power Button (FF) [PWRF]

ACPI: Sleep Button (CM) [SBTN]

ACPI: Lid Switch [LID]

ACPI: Fan [FAN] (off)

ACPI: Processor [CPU0] (supports C1 C2)

ACPI: Processor [CPU0] (supports 8 throttling states)

ACPI: Thermal Zone [THRM] (58 C)

ibm_acpi: ec object not found

ACPI: PCI Interrupt Link [LNKB] enabled at IRQ 11

ACPI: PCI interrupt 0000:00:0a.0[A] -> GSI 11 (level, low) -> IRQ 11

ACPI: PCI Interrupt Link [LNKD] enabled at IRQ 11

ACPI: PCI interrupt 0000:00:07.2[D] -> GSI 11 (level, low) -> IRQ 11

ACPI wakeup devices:

ACPI: (supports S0 S1 S3 S4 S4bios S5)

ACPI: PCI interrupt 0000:01:00.0[A] -> GSI 11 (level, low) -> IRQ 11

ACPI: PCI Interrupt Link [LNKC] enabled at IRQ 5

ACPI: PCI interrupt 0000:00:0b.0[A] -> GSI 5 (level, low) -> IRQ 5

```

Any more ideas?  I didn't find any occurances of the expression; 'windows' in my dsdt.dsl, though I didn't search for 'If (LEqual (SizeOf (_OS), 0x14))' yet, so I'll be trying that next (re windows only DSDT functionality).  'Tis interesting to note that MSFT line still there in the dmesg output...  I had thought recompiling DSDT might have fudged that...  I think the compile must have been successful too because going through the DSDT recompiling process after pulling the dsdt.dat again from /proc/acpi/dsdt it showed only the four warnings and not the fifth...

----------

## quiver

Nope, my dsdt.dsl file definitely has no OS specific features.  I'm stumped!

----------

## quiver

Unloading and reloading the battery module (had to modularize it in the kernel first) doesn't render any change in acpi's battery state unfortunately.

Any more ideas?

----------

## rukinhas

hi ppl.

the problem is descibed in the title. it only shows the values that were real when the laptop starts, 

it's never updated.

i have acpid instaled and i compiled the kernel with all acpi options marked as compiled in kernel (not modules)

does anyone have any idea what's happening

----------

## Earthwings

Merged on post.

----------

## quiver

Anyone found a solution for this pain-in-the-rear-end problem yet?  I'd be a lot more inspired to actually use my laptop for it's intended purpose, to operate in a location where power isn't available, if only I could tell how much power it actually has leftover!

Some manner of solution or next-step would be great.

Thanks  :Smile: 

----------

## tbart

Same with me. No solutions. But maybe some sort of trackdown...

Batterydisplay worked flawlessly with some kernel <2.6.10 and devfs, no hotplug, no coldplug

i then updated to 2.6.10 and now I'm on some 2.6.11, using udev, hotplug, coldplug.

battery doesn't update anymore since that change.

i guess we can say for sure that DSDT tables are not the problem (I didn't change anything but the above mentioned)

interestingly enough, changing display brightness (this is OS independent... hardware keys - still i guess they're using ACPI for it) sometimes produce an update in my batterystatus...

maybe this information helps some guru?

should i try to read out what ACPIevents those keys produce so we can somehow find out what update or sth they send..?

please instruct me, i'm willing to help (as mentioned: a laptop w/o working battery-display somehow doesn't make me happy..)

th

----------

## quiver

Bump!

Eight months since my last post on here and still no info... :S

Anybody?

----------

## Colonel Sanders

 *Quote:*   

> Anyone got ACPI working on a laptop so the battery status is shown in the taskbar?
> 
> I compiled everything concerning ACPI in the kernel. Well, i got an interface /proc/acpi/* where I see stuff like temperature. But the folders battery and acadaptor are empty 
> 
> KDE says I got a partial ACPI installation. But got no idea what else I should compile in the kernel. There's nothing left I think. Didn't find anything else concerning ACPI than in Advanced Power Management section.
> ...

 

Ditto on this entire problem as hazy as it may seem (apologies). I'm most curious why my /proc/config.gz differs from /usr/src/linux/.config...Should they differ?  i looked around for a definitive answer and nothing fruitful was churned up.  I've configured the kernel properly (as specified in the Gentoo handbook) and rebooted..yet I'm not getting stuff to register properlyl.  My only "success" occurred when I compiled the kernel with modules for battery and the like, but that wasn't the desired mode to achieve the result.  ACPI loads with the kernel, but no dice on battery & other entities successfully initiating /proc subfolder data.

/proc/config.gz

```
j-walk@T1000 /proc $ zcat config.gz | grep ACPI

# Power management options (ACPI, APM)

# ACPI (Advanced Configuration and Power Interface) Support

CONFIG_ACPI=y

CONFIG_ACPI_BOOT=y

CONFIG_ACPI_INTERPRETER=y

# CONFIG_ACPI_SLEEP is not set

CONFIG_ACPI_AC=m

CONFIG_ACPI_BATTERY=m

CONFIG_ACPI_BUTTON=m

CONFIG_ACPI_VIDEO=m

CONFIG_ACPI_FAN=m

CONFIG_ACPI_PROCESSOR=m

CONFIG_ACPI_THERMAL=m

CONFIG_ACPI_ASUS=m

CONFIG_ACPI_IBM=m

CONFIG_ACPI_TOSHIBA=m

CONFIG_ACPI_BLACKLIST_YEAR=0

# CONFIG_ACPI_DEBUG is not set

CONFIG_ACPI_BUS=y

CONFIG_ACPI_EC=y

CONFIG_ACPI_POWER=y

CONFIG_ACPI_PCI=y

CONFIG_ACPI_SYSTEM=y

CONFIG_ACPI_CONTAINER=m

CONFIG_X86_ACPI_CPUFREQ=m

CONFIG_X86_POWERNOW_K7_ACPI=y

CONFIG_X86_POWERNOW_K8_ACPI=y

# CONFIG_X86_SPEEDSTEP_CENTRINO_ACPI is not set

# CONFIG_X86_ACPI_CPUFREQ_PROC_INTF is not set

CONFIG_PNPACPI=y

CONFIG_SERIAL_8250_ACPI=y

```

/usr/src/linux/.config

```
/proc $ cat /usr/src/linux/.config | grep ACPI

# Power management options (ACPI, APM)

# ACPI (Advanced Configuration and Power Interface) Support

CONFIG_ACPI=y

CONFIG_ACPI_BOOT=y

CONFIG_ACPI_INTERPRETER=y

CONFIG_ACPI_SLEEP=y

CONFIG_ACPI_SLEEP_PROC_FS=y

CONFIG_ACPI_AC=y

CONFIG_ACPI_BATTERY=y

CONFIG_ACPI_BUTTON=y

CONFIG_ACPI_VIDEO=y

CONFIG_ACPI_FAN=y

CONFIG_ACPI_PROCESSOR=y

CONFIG_ACPI_THERMAL=y

# CONFIG_ACPI_ASUS is not set

# CONFIG_ACPI_IBM is not set

# CONFIG_ACPI_TOSHIBA is not set

CONFIG_ACPI_BLACKLIST_YEAR=0

# CONFIG_ACPI_DEBUG is not set

CONFIG_ACPI_BUS=y

CONFIG_ACPI_EC=y

CONFIG_ACPI_POWER=y

CONFIG_ACPI_PCI=y

CONFIG_ACPI_SYSTEM=y

CONFIG_ACPI_CONTAINER=m

CONFIG_X86_ACPI_CPUFREQ=m

CONFIG_X86_POWERNOW_K7_ACPI=y

CONFIG_X86_POWERNOW_K8_ACPI=y

CONFIG_X86_SPEEDSTEP_CENTRINO_ACPI=y

# CONFIG_X86_ACPI_CPUFREQ_PROC_INTF is not set

CONFIG_PNPACPI=y

CONFIG_SERIAL_8250_ACPI=y

```

Additional information:

I'm running 2.6.11-gentoo-r3 on an IBM T42.

----------

## tbart

Found it!!

Man, that _just_ took me what, one year or so...

This seems like the cure-all for battery update problems, LCD brightness weirdnesses (once manually switched off, it switches of with some keypresses during typing etc.etc.)

Do this:

add 

```
ec_burst=1
```

to your kernel cmdline and... tata! everything's working like it should!

I'll just have to see how I can get suspend working, this also makes me go nuts for years..

hope I could help all of you and hundreds more...

cya,

tbart

edit: oh i forgot: please add solved to the topic (if this did the trick)

----------

## Ornette

Figure I'd just post in this thread,

On a Thinkpad T42p, 2.6.12 kernel, I boot with the dvd-rw in the ultrabay, then I hotwap it with the battery. The ultrabay battery is being discharged and charged just fine, except there is no /proc/acpi/battery/BAT1 entry, so the OS can't display correct battery stats (charge%, time left, etc). If I boot with battery in ultrabay, BAT1 is there any everything is reported fine, but I can't swap in the dvd-rw device.

Is there anyway to get the kernel to recognize (when I boot with dvd-rw) the newly swapped in battery? Do I need to compile the battery as a module and do a rmmod/modprobe when I stick the battery into the ultrabay?

----------

