Incorrect battery time. $ sysctl -a |grep -i battery hw.acpi.battery.life: 98 hw.acpi.battery.time: 116 hw.acpi.battery.state: 1 hw.acpi.battery.units: 1 HERE I PULLED THE PLUG (AC OFF-LINE) hw.acpi.battery.life: 98 hw.acpi.battery.time: 111 hw.acpi.battery.state: 1 hw.acpi.battery.units: 1 hw.acpi.battery.info_expire: 5 hw.acpi.battery.life: 95 hw.acpi.battery.time: 102 hw.acpi.battery.state: 1 hw.acpi.battery.units: 1 hw.acpi.battery.info_expire: 5 hw.acpi.battery.life: 93 hw.acpi.battery.time: 101 hw.acpi.battery.state: 1 hw.acpi.battery.units: 1 hw.acpi.battery.info_expire: 5 HERE I PLUGGED IN THE PLUG (AC ON-LINE) hw.acpi.battery.life: 96 hw.acpi.battery.time: -1 hw.acpi.battery.state: 2 hw.acpi.battery.units: 1 hw.acpi.battery.info_expire: 5 hw.acpi.battery.life: 98 hw.acpi.battery.time: -1 hw.acpi.battery.state: 2 hw.acpi.battery.units: 1 hw.acpi.battery.info_expire: 5 hw.acpi.battery.life: 100 hw.acpi.battery.time: -1 hw.acpi.battery.state: 2 hw.acpi.battery.units: 1 hw.acpi.battery.info_expire: 5 and it stays that way. $ sysctl -a |grep -i acpi device acpi kern.timecounter.choice: TSC(-1000) ACPI-fast(900) HPET(950) i8254(0) dummy(-1000000) kern.timecounter.tc.ACPI-fast.mask: 16777215 kern.timecounter.tc.ACPI-fast.counter: 1883938 kern.timecounter.tc.ACPI-fast.frequency: 3579545 kern.timecounter.tc.ACPI-fast.quality: 900 debug.acpi.suspend_bounce: 0 debug.acpi.interpreter_slack: 1 debug.acpi.enable_debug_objects: 0 debug.acpi.acpi_ca_version: 20110527 debug.acpi.cpu_unordered: 0 debug.acpi.ec.timeout: 750 debug.acpi.ec.polled: 0 debug.acpi.ec.burst: 0 debug.acpi.batt.batt_sleep_ms: 0 debug.acpi.resume_beep: 0 hw.acpi.supported_sleep_state: S3 S4 S5 hw.acpi.power_button_state: S5 hw.acpi.sleep_button_state: S3 hw.acpi.lid_switch_state: NONE hw.acpi.standby_state: NONE hw.acpi.suspend_state: S3 hw.acpi.sleep_delay: 1 hw.acpi.s4bios: 0 hw.acpi.verbose: 0 hw.acpi.disable_on_reboot: 0 hw.acpi.handle_reboot: 0 hw.acpi.reset_video: 0 hw.acpi.cpu.cx_lowest: C1 hw.acpi.thermal.min_runtime: 0 hw.acpi.thermal.polling_rate: 10 hw.acpi.thermal.user_override: 0 hw.acpi.thermal.tz0.temperature: 47.0C hw.acpi.thermal.tz0.active: -1 hw.acpi.thermal.tz0.passive_cooling: 0 hw.acpi.thermal.tz0.thermal_flags: 0 hw.acpi.thermal.tz0._PSV: -1 hw.acpi.thermal.tz0._HOT: -1 hw.acpi.thermal.tz0._CRT: 127.0C hw.acpi.thermal.tz0._ACx: -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 hw.acpi.thermal.tz0._TC1: -1 hw.acpi.thermal.tz0._TC2: -1 hw.acpi.thermal.tz0._TSP: -1 hw.acpi.thermal.tz1.temperature: 43.0C hw.acpi.thermal.tz1.active: -1 hw.acpi.thermal.tz1.passive_cooling: 1 hw.acpi.thermal.tz1.thermal_flags: 0 hw.acpi.thermal.tz1._PSV: 95.5C hw.acpi.thermal.tz1._HOT: -1 hw.acpi.thermal.tz1._CRT: 100.0C hw.acpi.thermal.tz1._ACx: -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 hw.acpi.thermal.tz1._TC1: 5 hw.acpi.thermal.tz1._TC2: 4 hw.acpi.thermal.tz1._TSP: 600 hw.acpi.battery.life: 100 hw.acpi.battery.time: -1 hw.acpi.battery.state: 2 hw.acpi.battery.units: 1 hw.acpi.battery.info_expire: 5 hw.acpi.acline: 1 machdep.acpi_timer_freq: 3579545 machdep.idle: acpi machdep.idle_available: spin, mwait, hlt, acpi machdep.acpi_root: 1010336 dev.acpi.0.%desc: LENOVO TP-7P dev.acpi.0.%driver: acpi dev.acpi.0.%parent: nexus0 dev.acpi_ec.0.%desc: Embedded Controller: GPE 0x12, ECDT dev.acpi_ec.0.%driver: acpi_ec dev.acpi_ec.0.%location: handle=\_SB_.PCI0.LPC_.EC__ dev.acpi_ec.0.%pnpinfo: _HID=PNP0C09 _UID=0 dev.acpi_ec.0.%parent: acpi0 dev.acpi_sysresource.0.%desc: System Resource dev.acpi_sysresource.0.%driver: acpi_sysresource dev.acpi_sysresource.0.%location: handle=\_SB_.MEM_ dev.acpi_sysresource.0.%pnpinfo: _HID=PNP0C01 _UID=0 dev.acpi_sysresource.0.%parent: acpi0 dev.acpi_sysresource.1.%desc: System Resource dev.acpi_sysresource.1.%driver: acpi_sysresource dev.acpi_sysresource.1.%location: handle=\_SB_.PCI0.LPC_.SIO_ dev.acpi_sysresource.1.%pnpinfo: _HID=PNP0C02 _UID=0 dev.acpi_sysresource.1.%parent: acpi0 dev.cpu.0.%desc: ACPI CPU dev.cpu.0.%parent: acpi0 dev.cpu.1.%desc: ACPI CPU dev.cpu.1.%parent: acpi0 dev.attimer.0.%parent: acpi0 dev.hpet.0.%parent: acpi0 dev.atrtc.0.%parent: acpi0 dev.acpi_timer.0.%desc: 24-bit timer at 3.579545MHz dev.acpi_timer.0.%driver: acpi_timer dev.acpi_timer.0.%location: unknown dev.acpi_timer.0.%pnpinfo: unknown dev.acpi_timer.0.%parent: acpi0 dev.pci_link.0.%desc: ACPI PCI Link LNKA dev.pci_link.0.%parent: acpi0 dev.pci_link.1.%desc: ACPI PCI Link LNKB dev.pci_link.1.%parent: acpi0 dev.pci_link.2.%desc: ACPI PCI Link LNKC dev.pci_link.2.%parent: acpi0 dev.pci_link.3.%desc: ACPI PCI Link LNKD dev.pci_link.3.%parent: acpi0 dev.pci_link.4.%desc: ACPI PCI Link LNKE dev.pci_link.4.%parent: acpi0 dev.pci_link.5.%desc: ACPI PCI Link LNKF dev.pci_link.5.%parent: acpi0 dev.pci_link.6.%desc: ACPI PCI Link LNKG dev.pci_link.6.%parent: acpi0 dev.pci_link.7.%desc: ACPI PCI Link LNKH dev.pci_link.7.%parent: acpi0 dev.acpi_lid.0.%desc: Control Method Lid Switch dev.acpi_lid.0.%driver: acpi_lid dev.acpi_lid.0.%location: handle=\_SB_.LID_ dev.acpi_lid.0.%pnpinfo: _HID=PNP0C0D _UID=0 dev.acpi_lid.0.%parent: acpi0 dev.acpi_lid.0.wake: 1 dev.acpi_button.0.%desc: Sleep Button dev.acpi_button.0.%driver: acpi_button dev.acpi_button.0.%location: handle=\_SB_.SLPB dev.acpi_button.0.%pnpinfo: _HID=PNP0C0E _UID=0 dev.acpi_button.0.%parent: acpi0 dev.acpi_button.0.wake: 1 dev.pcib.0.%desc: ACPI Host-PCI bridge dev.pcib.0.%parent: acpi0 dev.pcib.1.%desc: ACPI PCI-PCI bridge dev.pcib.2.%desc: ACPI PCI-PCI bridge dev.pcib.3.%desc: ACPI PCI-PCI bridge dev.pcib.4.%desc: ACPI PCI-PCI bridge dev.pci.0.%desc: ACPI PCI bus dev.pci.2.%desc: ACPI PCI bus dev.pci.3.%desc: ACPI PCI bus dev.pci.4.%desc: ACPI PCI bus dev.pci.21.%desc: ACPI PCI bus dev.acpi_tz.0.%desc: Thermal Zone dev.acpi_tz.0.%driver: acpi_tz dev.acpi_tz.0.%location: handle=\_TZ_.THM0 dev.acpi_tz.0.%pnpinfo: _HID=none _UID=0 dev.acpi_tz.0.%parent: acpi0 dev.acpi_tz.1.%desc: Thermal Zone dev.acpi_tz.1.%driver: acpi_tz dev.acpi_tz.1.%location: handle=\_TZ_.THM1 dev.acpi_tz.1.%pnpinfo: _HID=none _UID=0 dev.acpi_tz.1.%parent: acpi0 dev.atpic.0.%parent: acpi0 dev.atdma.0.%parent: acpi0 dev.npxisa.0.%parent: acpi0 dev.atkbdc.0.%parent: acpi0 dev.psmcpnp.0.%parent: acpi0 dev.battery.0.%desc: ACPI Control Method Battery dev.battery.0.%parent: acpi0 dev.acpi_acad.0.%desc: AC Adapter dev.acpi_acad.0.%driver: acpi_acad dev.acpi_acad.0.%location: handle=\_SB_.PCI0.LPC_.EC__.AC__ dev.acpi_acad.0.%pnpinfo: _HID=ACPI0003 _UID=0 dev.acpi_acad.0.%parent: acpi0 dev.acpi_perf.0.%driver: acpi_perf dev.acpi_perf.0.%parent: cpu0 dev.acpi_perf.1.%driver: acpi_perf dev.acpi_perf.1.%parent: cpu1 $ $ dmesg |grep -i acpi Features=0xbfebfbff<FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CLFLUSH,DTS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE> ACPI APIC Table: <LENOVO TP-7P > ACPI Warning: 32/64X length mismatch in Gpe1Block: 0/32 (20110527/tbfadt-556) ACPI Warning: Optional field Gpe1Block has zero address or length: 0x000000000000102C/0x0 (20110527/tbfadt-586) acpi0: <LENOVO TP-7P> on motherboard acpi_ec0: <Embedded Controller: GPE 0x12, ECDT> port 0x62,0x66 on acpi0 acpi0: Power Button (fixed) acpi0: reservation of 0, a0000 (3) failed acpi0: reservation of 100000, 7ff00000 (3) failed cpu0: <ACPI CPU> on acpi0 cpu1: <ACPI CPU> on acpi0 attimer0: <AT timer> port 0x40-0x43 irq 0 on acpi0 hpet0: <High Precision Event Timer> iomem 0xfed00000-0xfed003ff on acpi0 atrtc0: <AT realtime clock> port 0x70-0x71 irq 8 on acpi0 Timecounter "ACPI-fast" frequency 3579545 Hz quality 900 acpi_timer0: <24-bit timer at 3.579545MHz> port 0x1008-0x100b on acpi0 acpi_lid0: <Control Method Lid Switch> on acpi0 acpi_button0: <Sleep Button> on acpi0 pcib0: <ACPI Host-PCI bridge> port 0xcf8-0xcff on acpi0 pci0: <ACPI PCI bus> on pcib0 pcib1: <ACPI PCI-PCI bridge> irq 20 at device 28.0 on pci0 pci2: <ACPI PCI bus> on pcib1 pcib2: <ACPI PCI-PCI bridge> irq 21 at device 28.1 on pci0 pci3: <ACPI PCI bus> on pcib2 pcib3: <ACPI PCI-PCI bridge> irq 22 at device 28.2 on pci0 pci4: <ACPI PCI bus> on pcib3 pcib4: <ACPI PCI-PCI bridge> at device 30.0 on pci0 pci21: <ACPI PCI bus> on pcib4 acpi_tz0: <Thermal Zone> on acpi0 acpi_tz1: <Thermal Zone> on acpi0 atkbdc0: <Keyboard controller (i8042)> port 0x60,0x64 irq 1 on acpi0 battery0: <ACPI Control Method Battery> on acpi0 acpi_acad0: <AC Adapter> on acpi0 $ How-To-Repeat: as above
$ sysctl -d hw.acpi.battery.time hw.acpi.battery.time: remaining time in minutes Why is it impossible or improper to compute and show battery's remaining time ? Because the machine is on on-line power supply ? The battery's state, that is, its remaining time, is still valid and of interest to user at any machine state (load, etc), regardless of power supply being on-line or off-line. I want to know WHAT IF, at any time (without or with consideration of current machine state (load, etc) in the computation of battery remaining time), I disconnected the on-line power supply, could I expect to happen to my machine with regard to expected length-of-time availability of battery power supply. If you think that the battery's "percent capacity remaining" is enough, then you are mistaken. hw.acpi.battery.life: percent capacity remaining The battery's "percent capacity remaining" is misleading because its max level is degrading over time (the 100% of a new battery is not the same 100% after a year or so of random discharging and charging). They just do not tell me how much estimated run time I would have as I explained above. This is what Linux shows about my battery state: $ cat /proc/acpi/battery/BAT0/info present: yes design capacity: 56160 mWh last full capacity: 38720 mWh battery technology: rechargeable design voltage: 10800 mV design capacity warning: 1936 mWh design capacity low: 200 mWh capacity granularity 1: 1 mWh capacity granularity 2: 1 mWh model number: COMPATIBLE serial number: 2413 battery type: LION OEM info: BATSZ $ cat /proc/acpi/battery/BAT0/state present: yes capacity state: ok charging state: charged present rate: 0 mW remaining capacity: 38720 mWh present voltage: 12405 mV These are the original and degraded capacity values of 100% I am talking about: ... design capacity: 56160 mWh last full capacity: 38720 mWh ... remaining capacity: 38720 mWh ... So, please compute this hw.acpi.battery.time: remaining time in minutes and make it available at any time, and at any state of the machine. There is a good use for this data.
Responsible Changed From-To: freebsd-bugs->freebsd-acpi Over to maintainer(s).
Im most systems, ACPI does not return the battery lifetime when on AC power. The actual remaining time is calculated by the EC BIOS and is calculated mostly be taking the discharge rate in mW and the current capacity in mWh. As far as I know, no OS attempts to calculate the time. It is simply read from the the EC via ACPI. When plugged in to AC, the discharge rate is 0, making the calculation undefined (division by zero). Even the remaining battery time reported by ACPI is, at best, a very rough guess as discharge rate can vary dramatically depending on system load. On FreeBSD you can see detailed information on batteries with the acpiconf(8) command. "acpiconf -i N" where 'N' is the battery number; 0 if only one battery is present. My system on battery: esign capacity: 50540 mWh Last full capacity: 46660 mWh Technology: secondary (rechargeable) Design voltage: 10800 mV Capacity (warn): 2333 mWh Capacity (low): 200 mWh Low/warn granularity: 1 mWh Warn/full granularity: 1 mWh Model number: 42T4795 Serial number: 2654 Type: LION OEM info: SONY State: discharging Remaining capacity: 96% Remaining time: 2:12 Present rate: 20460 mW Present voltage: 11652 mV And after plugging in to AC: Design capacity: 50540 mWh Last full capacity: 46660 mWh Technology: secondary (rechargeable) Design voltage: 10800 mV Capacity (warn): 2333 mWh Capacity (low): 200 mWh Low/warn granularity: 1 mWh Warn/full granularity: 1 mWh Model number: 42T4795 Serial number: 2654 Type: LION OEM info: SONY State: high Remaining capacity: 96% Remaining time: unknown Present rate: 0 mW Present voltage: 11648 mV Looking at the raw sysctl when on battery shows hw.acpi.battery.time: -1. This is normal. I don't see that ACPI -- R. Kevin Oberman, Network Engineer, Retired E-mail: rkoberman@gmail.com