Ejemplo n.º 1
0
PowerSupplyType pmu_get_power_supply() {
	uint8_t val = pmu_get_reg(PMU_POWERSUPPLY_REG);
	
	if (val & PMU_POWERSUPPLY_USB)
		return identify_usb_charger();
	else if (val & PMU_POWERSUPPLY_FIREWIRE)
		return PowerSupplyTypeFirewire;
	else
		return PowerSupplyTypeBattery;
}
Ejemplo n.º 2
0
PowerSupplyType pmu_get_power_supply() {
	if (pmu_get_reg(0x4) & 1<<3) {
		// USB powered
		return identify_usb_charger();
	} else if (pmu_get_reg(0x6) & 1<<3) {
		// Firewire powered
		return PowerSupplyTypeFirewire;
	} else {
		// Battery powered
		return PowerSupplyTypeBattery;
	}
}
Ejemplo n.º 3
0
PowerSupplyType iphone_pmu_get_power_supply(void) {
	int mbcs1 = iphone_pmu_get_reg(PMU_MBCS1);

	if(mbcs1 & PMU_MBCS1_ADAPTPRES)
		return PowerSupplyTypeFirewire;

	if(mbcs1 & PMU_MBCS1_USBOK)
		return identify_usb_charger();
	else
		return PowerSupplyTypeBattery;

}