← Back to team overview

ubuntu-phone team mailing list archive

Re: Battery statistics and flashing bricks

 

El día Friday, January 20, 2017 a las 03:22:46AM -0700, Selene Scriven escribió:

> * Matthias Apitz <guru@xxxxxxxxxxx> wrote:
> > What is the name of this process and does it have some log file 
> > (maybe to avtivate) which would log the actual voltage and the 
> > derived estimated percentage?
> 
> There are entries for it in the kernel, but IIRC I think the UI 
> probably uses upowerd.  From what I recall, its log only has 
> timestamps and percentages, but it has been a while since I 
> checked.

I watched a while the upowerd with strace and it seems it reads the
voltage *and* capacity information from the kernel:

$ egrep 'open\(|read\(11' upowerd.tr | grep -v NOENT | grep -v '= 0' 
open("/sys/devices/platform/battery/power_supply/battery/present", O_RDONLY|O_LARGEFILE) = 11
read(11, "1\n", 4096)                   = 2
open("/sys/devices/platform/battery/power_supply/battery/voltage_max_design", O_RDONLY|O_LARGEFILE) = 11
read(11, "4200000\n", 4096)             = 8
open("/sys/devices/platform/battery/power_supply/battery/technology", O_RDONLY|O_LARGEFILE) = 11
read(11, "Li-ion\n", 4096)              = 7
open("/sys/devices/platform/battery/power_supply/battery/status", O_RDONLY|O_LARGEFILE) = 11
read(11, "Discharging\n", 4096)         = 12
open("/sys/devices/platform/battery/power_supply/battery/voltage_now", O_RDONLY|O_LARGEFILE) = 11
read(11, "3735000\n", 4096)             = 8
^^^^^^^^^^^^^^^^^^^^^^^^^^
open("/sys/devices/platform/battery/power_supply/battery/capacity", O_RDONLY|O_LARGEFILE) = 11
read(11, "41\n", 4096)                  = 3
^^^^^^^^^^^^^^^^^^^^^^^^^^
open("/sys/devices/platform/battery/power_supply/battery/temp", O_RDONLY|O_LARGEFILE) = 11
read(11, "240\n", 4096)                 = 4

having done this, it sends the assembled information to some connected client:

...
sendmsg(4, {msg_name(0)=NULL, msg_iov(2)=[{"l\4\1\1p\2\0\0\6=\0\0\216\0\0\0\1\1o\0/\0\0\0/org/freedesktop/UPower/devices/battery_battery\0\2\1s\0\37\0\0\0org.freedesktop.DBus.Properties\0\3\1s\0\21\0\0\0PropertiesChanged\0\0\0\0\0\0\0\10\1g\0\10sa{sv}as\0\0\0", 160}, {"\35\0\0\0org.freedesktop.UPower.Device\0\0\0D\2\0\0\n\0\0\0Technology\0\1u\0\0\0\1\0\0\0\n\0\0\0EnergyFull\0\1d\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\v\0\0\0PowerSupply\0\1b\0\0\1\0\0\0\n\0\0\0HasHistory\0\1b\0\0\0\1\0\0\0\v\0\0\0TimeToEmpty\0\1x\0\0\0\0\0\0\0\0\0\0\0\0\0\0\5\0\0\0State\0\1u\0\0\0\0\2\0\0\0\0\0\0\0\16\0\0\0IsRechargeable\0\1b\0\0\0\1\0\0\0\0\0\0\0\6\0\0\0Vendor\0\1s\0\0\0\0\0\0\0\0\0\0\0"..., 624}], msg_controllen=0, msg_flags=0}, MSG_NOSIGNAL) = 784


i.e. the (Android-) kernel is providing the wrong capacity info.

	matthias

-- 
Matthias Apitz, ✉ guru@xxxxxxxxxxx, ⌂ http://www.unixarea.de/  ☎ +49-176-38902045
"Wo ist der antiimperialistische Schutzwall, wenn man ihn braucht? US-Panzertransport durch ex-DDR"
"Where is the anti-imperialistic  wall, if it's needed? Transport of US-tanks through the ex-GDR"
https://deutsch.rt.com/kurzclips/45282-us-panzertransporte-durch-ex-ddr/


References