Bug 207223 - acpica/acpi_battery.c: introduce hw.acpi.battery.rate sysctl
Summary: acpica/acpi_battery.c: introduce hw.acpi.battery.rate sysctl
Status: New
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: CURRENT
Hardware: Any Any
: --- Affects Only Me
Assignee: freebsd-acpi (Nobody)
URL:
Keywords: patch
Depends on:
Blocks:
 
Reported: 2016-02-15 18:29 UTC by Johannes Jost Meixner
Modified: 2016-05-20 08:24 UTC (History)
6 users (show)

See Also:


Attachments
add hw.acpi.battery.rate sysctl oid (733 bytes, patch)
2016-02-15 18:29 UTC, Johannes Jost Meixner
no flags Details | Diff
add hw.acpi.battery.rate sysctl oid (741 bytes, patch)
2016-03-10 14:59 UTC, Johannes Jost Meixner
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Johannes Jost Meixner freebsd_committer freebsd_triage 2016-02-15 18:29:25 UTC
Created attachment 167043 [details]
add hw.acpi.battery.rate sysctl oid

Patch attached introduces a sysctl to display the discharging rate of a battery.

It seems to me (but, I'm not particularly sure) that the info populated into &acpi_battery_battinfo.rate is -always- converted to Watts (cf acpi_battery_get_battinfo() lines 202-203.

So we could probably append "mW" to the output, however I'm quite fond of having it be an integer for the purposes of extending i3 to read this new sysctl and output it to my status bar. ;-)
Comment 1 Lars Engels freebsd_committer freebsd_triage 2016-02-15 19:33:28 UTC
Works for me (TP X230):

# sysctl hw.acpi.battery.rate 
hw.acpi.battery.rate: 13834
Comment 2 Sean Bruno freebsd_committer freebsd_triage 2016-03-10 14:51:02 UTC
Please add something to the description to indicate the units of the sysctl (mW?).
Comment 3 Johannes Jost Meixner freebsd_committer freebsd_triage 2016-03-10 14:59:14 UTC
Created attachment 167967 [details]
add hw.acpi.battery.rate sysctl oid
Comment 4 Sean Bruno freebsd_committer freebsd_triage 2016-03-10 15:35:57 UTC
hrm.  Is it mW/second or something?  A rate indicates some factor of time.
Comment 5 Conrad Meyer freebsd_committer freebsd_triage 2016-03-10 16:17:30 UTC
(In reply to Sean Bruno from comment #4)

mW is a rate :).
Comment 6 Ed Maste freebsd_committer freebsd_triage 2016-03-14 15:52:25 UTC
> Please add something to the description to indicate the units of the sysctl (mW?).

Note that acpiconf -i0 reports mW on some systems and mA on others, so I'm not sure that mW is always correct.
Comment 7 Johannes Jost Meixner freebsd_committer freebsd_triage 2016-03-15 10:54:58 UTC
(In reply to Ed Maste from comment #6)

This should be dealt with by the following code in the same file, if I'm not mistaken:


https://svnweb.freebsd.org/base/head/sys/dev/acpica/acpi_battery.c?view=markup#l196
Comment 8 Johannes Jost Meixner freebsd_committer freebsd_triage 2016-03-15 11:08:05 UTC
Hence: Yes, you're right - in the case that battery voltage can't be obtained the item stays in mA.

What's the best way to solve this in the description?