You are not logged in.

#1 2012-02-07 12:58:22

maw09
Member
Registered: 2012-02-06
Posts: 9

[SOLVED] Battery charge percentage reports as 0% in xmobar

I have an ASUS U36JC laptop running Arch. I'm using xmobar to display information about the battery charge.
The estimated remaining lifetime in hours reports correctly, but the charge percentage always reports at 0%.

The charge level is reported correctly by acpi:

$ acpi
Battery 0: Discharging, 69%, 03:24:48 remaining

Listing /sys/class/power_supply/BAT0 gives:

$ ls /sys/class/power_supply/BAT0
alarm        device       energy_full_design  manufacturer  power      present        status     technology  uevent              voltage_now
cycle_count  energy_full  energy_now          model_name    power_now  serial_number  subsystem  type        voltage_min_design

The contents of uevent are:

$ cat uevent
POWER_SUPPLY_NAME=BAT0
POWER_SUPPLY_STATUS=Discharging
POWER_SUPPLY_PRESENT=1
POWER_SUPPLY_TECHNOLOGY=Li-ion
POWER_SUPPLY_CYCLE_COUNT=0
POWER_SUPPLY_VOLTAGE_MIN_DESIGN=14880000
POWER_SUPPLY_VOLTAGE_NOW=15529000
POWER_SUPPLY_POWER_NOW=16335000
POWER_SUPPLY_ENERGY_FULL_DESIGN=84000000
POWER_SUPPLY_ENERGY_FULL=81750000
POWER_SUPPLY_ENERGY_NOW=54600000
POWER_SUPPLY_MODEL_NAME=U36--56
POWER_SUPPLY_MANUFACTURER=ASUSTek
POWER_SUPPLY_SERIAL_NUMBER= 

And my xmobarrc is:

Config { font = "-misc-fixed-*-*-*-*-10-*-*-*-*-*-*-*"
       , bgColor = "black"
       , fgColor = "grey"
       , position = Top
       , lowerOnStart = True
       , commands = [ Run Network "eth0" ["-L","0","-H","32","-n","green","-h","red"] 10
                    , Run Cpu ["-L","3","-H","50","-n","green","-h","red"] 10
                    , Run CpuFreq ["-t","<cpu0>"] 10
                    , Run Battery ["-t","<left>% / <timeleft>","-L","50","-H","75","-h","green","-n","yell","-l","red"] 10
                    , Run ThermalZone 0 ["-t","<temp> C","-L","40","-H","79","-h","red","-n","yellow","-l","green"] 10
                    , Run Memory ["-t","<usedratio>%"] 10
                    , Run Swap ["-t","<usedratio>%"] 10
                    , Run Date "%a %_d/%m %H:%M" "date" 10
                    , Run StdinReader
                    ]
       , sepChar = "%"
       , alignSep = "}{"
       , template = "%StdinReader% }{ %cpu% / %cpufreq% | M %memory% * S %swap% | %eth0% | %battery% ; %thermal0% | <fc=#ee9a00>%date%</fc>"
       }

Thanks,

Last edited by maw09 (2012-02-08 05:29:47)

Offline

#2 2012-02-07 13:31:19

archreg
Member
Registered: 2011-03-12
Posts: 14

Re: [SOLVED] Battery charge percentage reports as 0% in xmobar

maw09 wrote:

(...)

Listing /sys/class/power_supply/BAT0 gives:

$ ls /sys/class/power_supply/BAT0
alarm        device       energy_full_design  manufacturer  power      present        status     technology  uevent              voltage_now
cycle_count  energy_full  energy_now          model_name    power_now  serial_number  subsystem  type        voltage_min_design

(...)

Try adding -c "energy_full" to the battery plugin args.
You can also add -f "/sys/class/power_supply/AC0/online" if you don't have proper AC status in xmobar.

http://projects.haskell.org/xmobar/#sys … or-plugins

Offline

#3 2012-02-08 05:28:54

maw09
Member
Registered: 2012-02-06
Posts: 9

Re: [SOLVED] Battery charge percentage reports as 0% in xmobar

Thanks for your response. I solved the problem by adding the "-c" switch, and the "--" to separate regular monitor options from Battery's specific ones, as mentioned in the docs you linked.

Offline

Board footer

Powered by FluxBB