Ticket #241 (closed defect: fixed)
A43 gen8 does not charge via USB
|Reported by:||CalcProgrammer1||Owned by:||BuBu|
|Priority:||major||Milestone:||Android 2.3 Bull|
|Component:||Android 2.3||Version:||Android 2.3 - Anoa|
On the A43 (and presumably other gen8's that only support USB charging), the device is never being put into charging mode. The USB cable is detected and the charging system is available, but it must be manually enabled each time to charge.
To put the device into charging mode:
echo 1 > /sys/devices/platform/battery/usb_online
echo 3 > /sys/devices/platform/battery/charge_level
Charge level is 1, 2, or 3 depending on level of current draw, not sure of the exact mA values for each.
The other thing that is probably necessary is to detect the USB status. I've found /sys/class/switch/USB_SWITCH/status which provides one of 3 values:
ATTACHED_VBUS - Shows when USB attached to a power source (mounted/unmounted doesn't seem to matter)
ATTACHED_HOST - Shows when USB OTG host mode is active
DETACHED - Shows when USB cable is disconnected or no USB power available
Note that if you leave the device with usb_online = 1 and charge_level not equal to zero, it will think it is charging even if the cable is unplugged. This can lead to mis-calculation of battery level (as it still shows 100% Charging when it is not) and the power LED keeps flashing even after the battery starts discharging (including when device is in sleep mode). Having charge_level set low may result in the battery being drained even while "charging". I'm not sure how it detects when a USB wall charger is used vs. a PC, but the A43 can fully charge while running off of either one (500mA).