# acpitool Battery status not available

## xiaweitang

```
 # acpitool   

  Battery status : <not available>

  AC adapter     : <not available>

  Thermal zone 1 : ok, 50 C

  Thermal zone 2 : ok, 27 C

```

----------

## BradN

Test whether the kernel has acpi battery info:

ls /proc/acpi/battery/

then (using the directory name shown instead of BAT0) see if its state can be read:

cat /proc/acpi/battery/BAT0/state

If there is no battery subdirectory present, then make sure acpi battery support is compiled in your kernel.

----------

## xiaweitang

 *BradN wrote:*   

> Test whether the kernel has acpi battery info:
> 
> ls /proc/acpi/battery/
> 
> then (using the directory name shown instead of BAT0) see if its state can be read:
> ...

 

```

# ls /proc/acpi/battery/ 

ls: cannot access /proc/acpi/battery/: No such file or directory
```

However, I have checked the acpi battery support is indeed compiled into my kernel.

----------

## BradN

strange... is /proc/acpi there at all?  there may be a kernel config option that turns it off, and then i think the data is in /sys somewhere but i've never used that interface.  

if that's not it, your machine may have messed up acpi tables and then you might have to google for a workaround.

----------

## dmpogo

 *BradN wrote:*   

> strange... is /proc/acpi there at all?  there may be a kernel config option that turns it off, and then i think the data is in /sys somewhere but i've never used that interface.  
> 
> if that's not it, your machine may have messed up acpi tables and then you might have to google for a workaround.

 

It is in /sys/class/power_supply/BAT0    etc.

But yes, first thing to check that /proc/acpi exists  (it reguires 'configure legacy proc interface' on in kernel configuration). In general, acpi moves away from using /proc interface, so it is better to find ways to use /sys interface if possible.

----------

## xiaweitang

Yes, /proc/acpi exists and BAT0 is in /sys/class/power_supply/. The question now is how to tell acpitool to use the new /sys interface rather than the old one?

----------

## BradN

Probably if it doesn't already use it, support hasn't been added for it (beyond checking the obvious like --help).  You could try enabling support for the old interface in the kernel config or use another utility to read the battery state, or hack up a patch for acpitool  :Smile: 

----------

## dmpogo

 *BradN wrote:*   

> Probably if it doesn't already use it, support hasn't been added for it (beyond checking the obvious like --help).  You could try enabling support for the old interface in the kernel config or use another utility to read the battery state, or hack up a patch for acpitool 

 

executable for stable acpitool in portage dates from Feb 6, 2007 and  don't  think has chance to know about /sys.

unstable acpitool-0.5.1 is from August, 2009 and may be updated, but I doubt it.

----------

