Hi,
  On POWER_SUPPLY_CHANGED uevent, battery capacity is updated.
Lets say I plugged in AC charger @ time 't'.
Now an uvevnt occurs and battery capacity is updated in android.

In time t+20, battery has charged and the capacity must have increased to
some higher level.
I can notice this by reading sysfs. But the same in not updated in android.

Not @ time t+30, I unplug the AC charger, again an uvevnt is observed and
capacity is updated in android.

Hope I am clear.

Thanks and Regards,
Arun R Murthy
---------------------

On Tue, Apr 13, 2010 at 1:14 PM, ZhangJieJing <kzj...@gmail.com> wrote:

> Hi,
>
> what I know is battery capacity update is triggered by
> POWER_SUPPLY_UEVENT,
> 1, please ensure this UEVENT is sent,
>   you can change init.rc 's loglevel to 9 to get the uevent dump.
> 2, what this command output:
> # ls /sys/class/power_supply
>
> I think the plug/unplug make the battery capacity update is because it will
> send a POWER_SUPPLY_CHANGED uevnet, and on discharging, you don't let your
> driver send the uevent in a time(eg. 60s).
>
> if it's true, you should add a timer or delayed_work in your battery driver
> to do this job.
>
> ---
> Best regards,
> Zhang Jiejing
>
>
> 2010/4/13 Arun Raghavendra Murthy <rmurthy.a...@gmail.com>
>
> Hi,
>>   The battery capacity is getting updated while plug/unplug of charger.
>> But not getting updated while discharging.
>>
>> The BatteryService class is very much able to read the battery capacity,
>> ac - online, usb - online, etc.
>>
>> The problem that I am facing is the battery capacity is getting updated
>> only on plug/unplug of charger.
>> In the mean time its not updated. But if I read the capacity through the
>> sysfs I see the updated capacity.
>>
>> What I guess is in android only there should be some application that
>> should read the battery capacity
>> from sysfs at time intervals "t" and update the same.
>>
>> Please let me know on this.
>>
>> Thanks and Regards,
>> Arun R Murthy
>> --------------------
>>
>> Thanks and Regards,
>> Arun R Murthy
>> --------------------
>>
>> On Tue, Apr 13, 2010 at 7:53 AM, ZhangJieJing <kzj...@gmail.com> wrote:
>>
>>> CC the list.
>>>
>>>  Hi,
>>>
>>> the BatteryService is working like this:
>>>
>>> cd /sys/class/power_supply
>>>
>>> for each dir:
>>> if have a file named type:
>>>   if type == Battery
>>>      read capicty ...etc
>>>   if type == AC
>>>      read online
>>>   if type == USB
>>>     read online
>>>
>>> If you mean it not updated on unplug & plug charger, you should first
>>> check the type of your power_supply driver.
>>>
>>> ---
>>>  Best regards,
>>> Zhang Jiejing
>>>
>>>
>>> 2010/4/12 Arun Raghavendra Murthy <rmurthy.a...@gmail.com>
>>>
>>>> Hi,
>>>>   In that case it is working for me.
>>>> On the event of power supply changed the battery capacity is getting
>>>> updated.
>>>> On plugging the AC charger capacity gets updated and on removal of AC
>>>> charger capacity gets updated. But in the mean time i.t between charging
>>>> plug and unplug it is not getting updated though i see a change in the
>>>> sysfs.
>>>>
>>>> Thanks and Regards,
>>>> Arun R Murthy
>>>> ---------------------
>>>>
>>>>   On Mon, Apr 12, 2010 at 7:55 AM, ZhangJieJing <kzj...@gmail.com>wrote:
>>>>
>>>>> Hi,
>>>>>
>>>>> you don't need send separatedly battery capacity, android framework
>>>>> only monitor POWER_SUPPLY_CHANGED uevent, if it received the uevent, it 
>>>>> will
>>>>> read the sys fs under /sys/class/power_supply/* files to get the voltage,
>>>>> current, capacity, etc,
>>>>> you may need see
>>>>> file frameworks/base/services/jni/com_android_server_BatteryService.cpp to
>>>>> see the detail.
>>>>>
>>>>> ---
>>>>> Best regards,
>>>>> Zhang Jiejing
>>>>>
>>>>>
>>>>> 2010/4/12 Arun Raghavendra Murthy <rmurthy.a...@gmail.com>
>>>>>
>>>>> Hi,
>>>>>>    The power_supply_changed() will handle if there is any change in
>>>>>> power supply i.e plug/unplug of AC/USB.
>>>>>> I have a work which keeps monitoring my battery parameters i.e battery
>>>>>> voltage, current, capacity.
>>>>>>
>>>>>> Also I notice that all POWER_SUPPLY_PROP_* are registered as uevents
>>>>>> in the power supply core driver.
>>>>>> So is it necessary for me to send an uevent separately for battery
>>>>>> capacity.?
>>>>>>
>>>>>>
>>>>>> Thanks and Regards,
>>>>>> Arun R Murthy
>>>>>> --------------------
>>>>>>
>>>>>>   On Thu, Apr 8, 2010 at 8:36 PM, ZhangJieJing <kzj...@gmail.com>wrote:
>>>>>>
>>>>>>> Hi,
>>>>>>>
>>>>>>> you need check your battery driver, the update of battery capacity is
>>>>>>> drive by uevent send by driver(via power_supply_changed() func), your 
>>>>>>> driver
>>>>>>> may need have a delayed work or timer function to send this event every
>>>>>>> timeout, such as 1 minute.
>>>>>>>
>>>>>>> you can reference file:  drivers/power/tosa_battery.c about this.
>>>>>>> ---
>>>>>>> Best regards,
>>>>>>> Zhang Jiejing
>>>>>>>
>>>>>>>
>>>>>>> 2010/4/5 Arun R Murthy <rmurthy.a...@gmail.com>
>>>>>>>
>>>>>>>>  Hi All,
>>>>>>>>   I am using andoird eclair and not able to see the battery capacity
>>>>>>>> getting updated while charging/discharging.
>>>>>>>> Wherein when I try to cat the battery capacity from the sysfs I am
>>>>>>>> able to see the change.
>>>>>>>> The only event that updates the battery capacity, voltage, etc in
>>>>>>>> the
>>>>>>>> application is the plug/unplug of the
>>>>>>>> AC/USB charger.
>>>>>>>> Please let me know on this.
>>>>>>>>
>>>>>>>> Thanks and Regards,
>>>>>>>> Arun R Murthy
>>>>>>>> -------------------
>>>>>>>>
>>>>>>>> --
>>>>>>>> unsubscribe: 
>>>>>>>> android-porting+unsubscr...@googlegroups.com<android-porting%2bunsubscr...@googlegroups.com>
>>>>>>>> website: http://groups.google.com/group/android-porting
>>>>>>>>
>>>>>>>> To unsubscribe, reply using "remove me" as the subject.
>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>
>>>>>>
>>>>>> --
>>>>>> Arun R Murthy
>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>
>>>>
>>>> --
>>>> Arun R Murthy
>>>>
>>>>
>>>>
>>
>>
>

-- 
unsubscribe: android-porting+unsubscr...@googlegroups.com
website: http://groups.google.com/group/android-porting

Reply via email to