I'm using MobileDevice.framework
in an OS X
application and I've been able to get how charged the battery of an iOS
device connected over USB
is using the AMDeviceCopyValue(device, domain, key)
function with the arguments "com.apple.mobile.battery"
for the domain
and "BatteryCurrentCapacity"
for the key
.
I want to also get the number of Charge Cycles on the battery. I believe it's possible because iBackupBot is able to fetch that data. Does anyone know how it does this? I downloaded the free copy of the program and tested it on an iPhone 3GS
, iPhone 4S
, and an iPhone 5
. It was able to grab the data for all three devices.
I have run iBackupBot through LLDB and logged its every usage of AMDeviceCopyValue()
. In doing so, I determined that it isn't getting the Charge Cycles count from that.
You can grab CycleCount
and a bunch of other information using an ioreg
(IORegistry) dump of the device. For example, see here for an IORegistry dump of the iPhone 5S. Note this section:
+-o AppleD2045PMUPowerSource <class AppleD2045PMUPowerSource, busy 0, retain count 10>
| | | | | {
| | | | | "battery-data" = {
.....
"CycleCount" = 1
| | | | | "ChargerConfiguration" = 960
| | | | | "DesignCapacity" = 1550
| | | | | "BatteryData" = {"BatterySerialNumber"="C0133237ALXFHCWBP","ChemID"=4484,"Flags"=256,"QmaxCell0"=1619,"Voltage"=4051,"CycleCount"=1,"StateOfCharge"=72,"DesignCapacity"=1550,"FullAvailableCapacity"=1573,"MaxCapacity"=1517,"MfgData"=<4330313333323337414c58464843574250000000000000010000010000000100>,"ManufactureDate"="1332"}
| | | | | "AtCriticalLevel" = No
The private IOKit.framework
on iOS has an API for accessing all of this information (you can look at the dump to figure out the property names, etc. in order to be able to access it programatically). Erica Sadun has some open source code that uses private IOKit functions to access some device hardware information (without a jailbreak, IIRC) so maybe that will be helpful.
As for grabbing this info from a Mac, no idea. If you have an on device app that can pull the information from the IORegistry and send it to the Mac over USB that would work. If you wanted to do it without having any additional software installed on the device, you would have to figure out a way to remotely get an ioreg
dump.
Hope this gets you somewhere!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With