# Gather battery information

## Role82

Hello,

I've bought a new Laptop last weekend. (Medion Akoya E2228T)

After a few small problemes I encountered, I got Gentoo installed with nearly everything running.

But the battery information could not be gathered. The xfce-battery-plugin always shows 50% and connected to AC.

```
acpi -iV

Battery 0: Discharging, 0%, rate information unavailable

Adapter 0: on-line

Thermal 0: ok, 0.0 degrees C

Thermal 0: trip point 0 switches to mode critical at temperature 100.0 degrees C

Cooling 0: Processor 0 of 10

Cooling 1: Processor 0 of 10

Cooling 2: intel_powerclamp no state information available

Cooling 3: iwlwifi no state information available

Cooling 4: Processor 0 of 10

Cooling 5: Processor 0 of 10

Cooling 6: test_battery no state information available

```

Anyone has a hint, how to debug this or get a working battery status?

Thanks,

Roman

----------

## turtles

Perhaps post the output of 

```
grep BATTERY /usr/src/linux/.config
```

----------

## Role82

Here it is:

```
$ grep BATTERY /usr/src/linux/.config

CONFIG_ACPI_BATTERY=y

CONFIG_BATTERY_ACT8945A=y

CONFIG_BATTERY_DS2780=y

CONFIG_BATTERY_DS2781=y

CONFIG_BATTERY_DS2782=y

CONFIG_BATTERY_SBS=y

CONFIG_BATTERY_BQ27XXX=y

CONFIG_BATTERY_BQ27XXX_I2C=y

CONFIG_BATTERY_MAX17040=y

CONFIG_BATTERY_MAX17042=y

CONFIG_BATTERY_GAUGE_LTC2941=y

CONFIG_BATTERY_GOLDFISH=y

CONFIG_HID_BATTERY_STRENGTH=y
```

----------

## turtles

Do you have anything under 

```
/sys/class/power_supply/BAT0/
```

 ?

For example on my system if I look at the file charge_now in /sys/class/power_supply/BAT0/ with cat

```
cat /sys/class/power_supply/BAT0/charge_now
```

I can see a number.

----------

## Role82

I have only test devices there:

```
$ ls -l /sys/class/power_supply/

insgesamt 0

lrwxrwxrwx 1 root root 0 31. Okt 11:32 test_ac -> ../../devices/virtual/power_supply/test_ac

lrwxrwxrwx 1 root root 0 31. Okt 11:32 test_battery -> ../../devices/virtual/power_supply/test_battery

lrwxrwxrwx 1 root root 0 31. Okt 18:06 test_usb -> ../../devices/virtual/power_supply/test_usb

```

----------

## turtles

Hmm thats strange, definitely seems like a kernel issue then.

----------

## Role82

I just bootet to the Gentoo LiveDVD. Even there ist /sys/class/power_supply/ empty.

----------

## charles17

 *Role82 wrote:*   

> I just bootet to the Gentoo LiveDVD. ...

 Have you tried with the latest SystemRescueCd?

And what about dmesg | grep -i battery,  are you getting any output?Last edited by charles17 on Wed Nov 01, 2017 9:19 am; edited 1 time in total

----------

## Role82

The SystemRescueCD doesn‘t boot, because in that Notebook no Legacyboot is available and it seems, that the RescueCD doesn't support 64-Bit UEFI boot.

----------

## Role82

Yes, I get. Here it is:

```
$ dmesg | grep -i battery

[    0.585178] ACPI: Battery: found native INT33F4 PMIC, not loading

[    0.634454] __power_supply_register: Expected proper parent device for 'test_battery'

[    0.634537] power_supply test_battery: uevent

[    0.634541] power_supply test_battery: POWER_SUPPLY_NAME=test_battery

[    0.645710] power_supply test_battery: power_supply_changed

[    0.645843] power_supply test_battery: power_supply_changed_work

[    0.645863] power_supply test_battery: uevent

[    0.645871] power_supply test_battery: POWER_SUPPLY_NAME=test_battery

[    0.645887] power_supply test_battery: prop STATUS=Discharging

[    0.645900] power_supply test_battery: prop CHARGE_TYPE=Fast

[    0.645912] power_supply test_battery: prop HEALTH=Good

[    0.645924] power_supply test_battery: prop PRESENT=1

[    0.645936] power_supply test_battery: prop TECHNOLOGY=Li-ion

[    0.645950] power_supply test_battery: prop CHARGE_FULL_DESIGN=100

[    0.645962] power_supply test_battery: prop CHARGE_FULL=100

[    0.645974] power_supply test_battery: prop CHARGE_NOW=50

[    0.645986] power_supply test_battery: prop CAPACITY=50

[    0.645998] power_supply test_battery: prop CAPACITY_LEVEL=Normal

[    0.646010] power_supply test_battery: prop TIME_TO_EMPTY_AVG=3600

[    0.646022] power_supply test_battery: prop TIME_TO_FULL_NOW=3600

[    0.646034] power_supply test_battery: prop MODEL_NAME=Test battery

[    0.646046] power_supply test_battery: prop MANUFACTURER=Linux

[    0.646058] power_supply test_battery: prop SERIAL_NUMBER=4.12.12-gentoo

[    0.646070] power_supply test_battery: prop TEMP=26

[    0.646082] power_supply test_battery: prop VOLTAGE_NOW=3300

[    6.952352] power_supply test_battery: uevent

[    6.952355] power_supply test_battery: POWER_SUPPLY_NAME=test_battery

[    6.952361] power_supply test_battery: prop STATUS=Discharging

[    6.952365] power_supply test_battery: prop CHARGE_TYPE=Fast

[    6.952368] power_supply test_battery: prop HEALTH=Good

[    6.952372] power_supply test_battery: prop PRESENT=1

[    6.952375] power_supply test_battery: prop TECHNOLOGY=Li-ion

[    6.952379] power_supply test_battery: prop CHARGE_FULL_DESIGN=100

[    6.952383] power_supply test_battery: prop CHARGE_FULL=100

[    6.952386] power_supply test_battery: prop CHARGE_NOW=50

[    6.952390] power_supply test_battery: prop CAPACITY=50

[    6.952394] power_supply test_battery: prop CAPACITY_LEVEL=Normal

[    6.952397] power_supply test_battery: prop TIME_TO_EMPTY_AVG=3600

[    6.952401] power_supply test_battery: prop TIME_TO_FULL_NOW=3600

[    6.952404] power_supply test_battery: prop MODEL_NAME=Test battery

[    6.952408] power_supply test_battery: prop MANUFACTURER=Linux

[    6.952412] power_supply test_battery: prop SERIAL_NUMBER=4.12.12-gentoo

[    6.952415] power_supply test_battery: prop TEMP=26

[    6.952419] power_supply test_battery: prop VOLTAGE_NOW=3300

[    7.128044] power_supply test_battery: uevent

[    7.128048] power_supply test_battery: POWER_SUPPLY_NAME=test_battery

[    7.128055] power_supply test_battery: prop STATUS=Discharging

[    7.128059] power_supply test_battery: prop CHARGE_TYPE=Fast

[    7.128062] power_supply test_battery: prop HEALTH=Good

[    7.128067] power_supply test_battery: prop PRESENT=1

[    7.128070] power_supply test_battery: prop TECHNOLOGY=Li-ion

[    7.128075] power_supply test_battery: prop CHARGE_FULL_DESIGN=100

[    7.128079] power_supply test_battery: prop CHARGE_FULL=100

[    7.128083] power_supply test_battery: prop CHARGE_NOW=50

[    7.128087] power_supply test_battery: prop CAPACITY=50

[    7.128091] power_supply test_battery: prop CAPACITY_LEVEL=Normal

[    7.128094] power_supply test_battery: prop TIME_TO_EMPTY_AVG=3600

[    7.128098] power_supply test_battery: prop TIME_TO_FULL_NOW=3600

[    7.128101] power_supply test_battery: prop MODEL_NAME=Test battery

[    7.128105] power_supply test_battery: prop MANUFACTURER=Linux

[    7.128108] power_supply test_battery: prop SERIAL_NUMBER=4.12.12-gentoo

[    7.128112] power_supply test_battery: prop TEMP=26

[    7.128116] power_supply test_battery: prop VOLTAGE_NOW=3300

[    7.128337] power_supply test_battery: uevent

[    7.128341] power_supply test_battery: POWER_SUPPLY_NAME=test_battery

[    7.128351] power_supply test_battery: prop STATUS=Discharging

[    7.128355] power_supply test_battery: prop CHARGE_TYPE=Fast

[    7.128358] power_supply test_battery: prop HEALTH=Good

[    7.128363] power_supply test_battery: prop PRESENT=1

[    7.128367] power_supply test_battery: prop TECHNOLOGY=Li-ion

[    7.128371] power_supply test_battery: prop CHARGE_FULL_DESIGN=100

[    7.128375] power_supply test_battery: prop CHARGE_FULL=100

[    7.128379] power_supply test_battery: prop CHARGE_NOW=50

[    7.128383] power_supply test_battery: prop CAPACITY=50

[    7.128387] power_supply test_battery: prop CAPACITY_LEVEL=Normal

[    7.128391] power_supply test_battery: prop TIME_TO_EMPTY_AVG=3600

[    7.128395] power_supply test_battery: prop TIME_TO_FULL_NOW=3600

[    7.128398] power_supply test_battery: prop MODEL_NAME=Test battery

[    7.128402] power_supply test_battery: prop MANUFACTURER=Linux

[    7.128406] power_supply test_battery: prop SERIAL_NUMBER=4.12.12-gentoo

[    7.128410] power_supply test_battery: prop TEMP=26

[    7.128414] power_supply test_battery: prop VOLTAGE_NOW=3300

[    7.130629] power_supply test_battery: uevent

[    7.130632] power_supply test_battery: POWER_SUPPLY_NAME=test_battery

[    7.130639] power_supply test_battery: prop STATUS=Discharging

[    7.130642] power_supply test_battery: prop CHARGE_TYPE=Fast

[    7.130646] power_supply test_battery: prop HEALTH=Good

[    7.130650] power_supply test_battery: prop PRESENT=1

[    7.130653] power_supply test_battery: prop TECHNOLOGY=Li-ion

[    7.130657] power_supply test_battery: prop CHARGE_FULL_DESIGN=100

[    7.130661] power_supply test_battery: prop CHARGE_FULL=100

[    7.130664] power_supply test_battery: prop CHARGE_NOW=50

[    7.130668] power_supply test_battery: prop CAPACITY=50

[    7.130672] power_supply test_battery: prop CAPACITY_LEVEL=Normal

[    7.130676] power_supply test_battery: prop TIME_TO_EMPTY_AVG=3600

[    7.130679] power_supply test_battery: prop TIME_TO_FULL_NOW=3600

[    7.130683] power_supply test_battery: prop MODEL_NAME=Test battery

[    7.130686] power_supply test_battery: prop MANUFACTURER=Linux

[    7.130690] power_supply test_battery: prop SERIAL_NUMBER=4.12.12-gentoo

[    7.130694] power_supply test_battery: prop TEMP=26

[    7.130697] power_supply test_battery: prop VOLTAGE_NOW=3300
```

----------

## charles17

 *Role82 wrote:*   

> ... that the RescueCD doesn't support 64-Bit UEFI boot.

 But here it does.

----------

## Role82

I gave it a second try. This time I got the RescueCD booting/working.

It just shows an ADP0 in /sys/class/power_supply/, but the online state doesn't change when I (dis-)connect the external power supply.

----------

## albright

it's a pain but you might learn something by booting a recent

ubuntu and see how it handles the battery (probably pretty

well I'd bet)

----------

## Role82

I already booted ubuntu 16.04. But I also got no information. I now download 17.10 to give it an additional try.

----------

## Role82

In fact, it works in ubuntu 17.10.   :Rolling Eyes: 

Here is the output:

```
root@ubuntu:/home/ubuntu# ls -l /sys/class/power_supply/

total 0

lrwxrwxrwx 1 root root 0 Nov  1  2017 axp288_charger -> ../../devices/pci0000:00/808622C1:06/i2c-6/i2c-INT33F4:00/axp288_charger/power_supply/axp288_charger

lrwxrwxrwx 1 root root 0 Nov  1  2017 axp288_fuel_gauge -> ../../devices/pci0000:00/808622C1:06/i2c-6/i2c-INT33F4:00/axp288_fuel_gauge/power_supply/axp288_fuel_gauge

```

Do anyone know, how I can setup this in gentoo?

----------

## charles17

https://lwn.net/Articles/613380/

 * https://cateee.net/lkddb/web-lkddb/MFD_AXP20X.html wrote:*   

> If you say Y here you get support for the X-Powers AXP202, AXP209 and AXP288  ...

 

----------

## Role82

I can see the issue.

Can you please give me a hint, how to install the patch?

----------

## charles17

```
Symbol: MFD_AXP20X [=n]Type  : tristate

     Defined at drivers/mfd/Kconfig:125  

     Depends on: HAS_IOMEM [=y]  

     Selects: MFD_CORE [=y] && REGMAP_IRQ [=n]  

     Selected by: MFD_AXP20X_I2C [=n] && HAS_IOMEM [=y] && I2C [=y] || MFD_AXP20X_RSB [=n] && HAS_IOMEM [=y] && SUNXI_RSB [=n]
```

So you need to activate MFD_AXP20X_I2C

 CONFIG_MFD_AXP20X_I2C

 CONFIG_HAS_IOMEM

 CONFIG_SUNXI_RSB

----------

