pymobiledevice3 icon indicating copy to clipboard operation
pymobiledevice3 copied to clipboard

Collect iPhone Battery Health from Device

Open Dantee296 opened this issue 2 years ago • 7 comments

Hi , Currently there is a way to collect iphone battery health using ioreg via IOPMPowerSource or AppleSmartBattery AppleRawMaxCapacity NominalChargeCapacity

but its dsnt return value which matches device inside Battery Health "Setting -> Battery -> BatteryHealth -> Maximum Capacity" is there a way to collect that information using pymobildevice ? @doronz88

Dantee296 avatar Sep 01 '22 05:09 Dantee296

I don't think this value is reflected in some "clear API". Instead, I remember reversing arround this value once and figuring out it is calculated using a combination of values: including the capacity, cycle count and a few more. I don't know the exact calculation and it should be possible to figure it out just from the IORegistry values

doronz88 avatar Sep 01 '22 06:09 doronz88

thanks for response @doronz88 can u point out those params / values u used to calculate this value

Dantee296 avatar Sep 01 '22 06:09 Dantee296

I don't remember in which binary it even was in the first place. Just that there was some kind of formula related to these parameters. I recommend looking for where they are referenced and tracing what are they used for.

doronz88 avatar Sep 01 '22 11:09 doronz88

"powerd" must be the binary where this calculation ll be because that's what print data on syslog regarding battery health

Dantee296 avatar Sep 01 '22 11:09 Dantee296

@doronz88 did u get a chance to see BatteryHealth data ?

Dantee296 avatar Sep 09 '22 14:09 Dantee296

I'm not currently researching arround there. As I said before, I think that the proper way to debug this is using the printed syslog lines. I do think rpc-project could possibly help debug this. I'd try changing the different values of the battery (such as the current capacity) and look at what syslog lines are printed afterward as a result. I guess powerlogd will probably monitor this value and update settings accordingly which could explain how the bettery life data is calculated.

doronz88 avatar Sep 11 '22 19:09 doronz88

@doronz88 thanks ll look info this

Dantee296 avatar Sep 12 '22 04:09 Dantee296

Hi @Dantee296, I might try to reverse engineer powerd and respond you later.

vadimszzz avatar Nov 29 '22 18:11 vadimszzz

@vadimszzz were u able to ?

Dantee296 avatar Jun 06 '23 01:06 Dantee296

@Dantee296 What was your solution ?

iwannet avatar Feb 22 '24 20:02 iwannet