Quantcast

/sys/class/power_supply/battery/charge_now

classic Classic list List threaded Threaded
10 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

/sys/class/power_supply/battery/charge_now

skuphundaku
Hi,

I'm working on an experiment to see what's the power consumption of the various radios in GTA02. When I tried something similar, a little over one year ago, when using an older version of SHR with an older kernel (I think it was 2.6.24), I was able to use /sys/class/power_supply/battery/charge_now and /sys/class/power_supply/battery/charge_full to get the data I was looking for.

Now, when trying to do the same thing again, with the latest SHR-unstable and uImage-2.6.34-r7-oe16-om-gta02.bin, I discovered that /sys/class/power_supply/battery/charge_now is not available anymore. Is this a bug in SHR's 2.6.34-r7 or is this something intentional?

M.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: /sys/class/power_supply/battery/charge_now

Martin Jansa
On Fri, Feb 04, 2011 at 02:54:45PM -0800, skuphundaku wrote:

>
> Hi,
>
> I'm working on an experiment to see what's the power consumption of the
> various radios in GTA02. When I tried something similar, a little over one
> year ago, when using an older version of SHR with an older kernel (I think
> it was 2.6.24), I was able to use /sys/class/power_supply/battery/charge_now
> and /sys/class/power_supply/battery/charge_full to get the data I was
> looking for.
>
> Now, when trying to do the same thing again, with the latest SHR-unstable
> and uImage-2.6.34-r7-oe16-om-gta02.bin, I discovered that
> /sys/class/power_supply/battery/charge_now is not available anymore. Is this
> a bug in SHR's 2.6.34-r7 or is this something intentional?
>
> M.
quick find shows similar nodes in
/sys/devices/platform/s3c2440-i2c/i2c-0/0-0073/hdq/bq27000-battery.0/power_supply/battery/

isn't it what you're looking for?

--
Martin 'JaMa' Jansa     jabber: [hidden email]

_______________________________________________
devel mailing list
[hidden email]
https://lists.openmoko.org/mailman/listinfo/devel

attachment0 (205 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: /sys/class/power_supply/battery/charge_now

Timo Juhani Lindfors
Martin Jansa <[hidden email]> writes:
> quick find shows similar nodes in
> /sys/devices/platform/s3c2440-i2c/i2c-0/0-0073/hdq/bq27000-battery.0/power_supply/battery/

News flash: you don't need to track these changing sysfs paths
yourself :-) There's this great command called "om battery
consumption" that works with 2.6.29, 2.6.34 and 2.6.37 :-)


_______________________________________________
devel mailing list
[hidden email]
https://lists.openmoko.org/mailman/listinfo/devel
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: /sys/class/power_supply/battery/charge_now

skuphundaku
In reply to this post by Martin Jansa
Martin Jansa wrote
quick find shows similar nodes in
/sys/devices/platform/s3c2440-i2c/i2c-0/0-0073/hdq/bq27000-battery.0/power_supply/battery/

isn't it what you're looking for?
I see in /sys/devices/platform/s3c2440-i2c/i2c-0/0-0073/hdq/bq27000-battery.0/power_supply/battery/ the same nodes I see in /sys/class/power_supply/battery/. My problem is that I don't see the charge_now node. I see charge_full, current_now, voltage_now etc., but I don't know of any way I could easily use them to get what I need, which is the data that I was getting from charge_now. current_now could be used and integrated to get the difference in charge, but getting the right sampling period and the integration interval for that is a non-trivial task, leaving alone the fact that I would need to implement a numerical integration algorithm to get the actual data I'm looking for, all of this making it far more complex than just reading a value from a file, the way it was possible some time ago.

M.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: /sys/class/power_supply/battery/charge_now

skuphundaku
In reply to this post by Timo Juhani Lindfors
Timo Juhani Lindfors wrote
News flash: you don't need to track these changing sysfs paths
yourself :-) There's this great command called "om battery
consumption" that works with 2.6.29, 2.6.34 and 2.6.37 :-)
The SHR I'm using doesn't have om at all. Where can I find the source code for it?

M.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: /sys/class/power_supply/battery/charge_now

Martin Jansa
On Sun, Feb 06, 2011 at 02:39:47AM -0800, skuphundaku wrote:

>
>
> Timo Juhani Lindfors wrote:
> >
> > News flash: you don't need to track these changing sysfs paths
> > yourself :-) There's this great command called "om battery
> > consumption" that works with 2.6.29, 2.6.34 and 2.6.37 :-)
> >
>
> The SHR I'm using doesn't have om at all.
opkg install omhacks

> Where can I find the source code for it?

git://git.debian.org/pkg-fso/omhacks.git

--
Martin 'JaMa' Jansa     jabber: [hidden email]

_______________________________________________
devel mailing list
[hidden email]
https://lists.openmoko.org/mailman/listinfo/devel

attachment0 (205 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: /sys/class/power_supply/battery/charge_now

skuphundaku
On 2/6/11, Martin Jansa <[hidden email]> wrote:
> On Sun, Feb 06, 2011 at 02:39:47AM -0800, skuphundaku wrote:
>> The SHR I'm using doesn't have om at all.
>
> opkg install omhacks
>
>> Where can I find the source code for it?
>
> git://git.debian.org/pkg-fso/omhacks.git

Thank you! I took a look at it and through the source code.
Unfortunately for me, it works by doing what I was trying to do
anyway, so the fact that I don't have the charge_now node on my device
is still a problem.

Do you have any idea why charge_now is not there anymore? Could it be
a problem in the kernel source? Or in SHR's build of the kernel? Or,
maybe, even in SHR's image?

M.

_______________________________________________
devel mailing list
[hidden email]
https://lists.openmoko.org/mailman/listinfo/devel
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: /sys/class/power_supply/battery/charge_now

skuphundaku
On Sun, Feb 6, 2011 at 1:10 PM, Matei-Eugen VASILE <[hidden email]> wrote:
On 2/6/11, Martin Jansa <[hidden email]> wrote:
> On Sun, Feb 06, 2011 at 02:39:47AM -0800, skuphundaku wrote:
>> The SHR I'm using doesn't have om at all.
>
> opkg install omhacks
>
>> Where can I find the source code for it?
>
> git://git.debian.org/pkg-fso/omhacks.git

Thank you! I took a look at it and through the source code.
Unfortunately for me, it works by doing what I was trying to do
anyway, so the fact that I don't have the charge_now node on my device
is still a problem.

Do you have any idea why charge_now is not there anymore? Could it be
a problem in the kernel source? Or in SHR's build of the kernel? Or,
maybe, even in SHR's image?

M.

I managed to figure it out. The newer kernels seem to be missing the feature I was looking for. Probably the kernel I was using back then had it (I never checked the code back then). I created a patch for drivers/power/bq27000_battery.c for shr-2.6.34, built a new kernel for my om-gta02 device and tested it. It seems to be working fine.

I attached the patch to this email, in case you find it useful and think others might need it.

M.

_______________________________________________
devel mailing list
[hidden email]
https://lists.openmoko.org/mailman/listinfo/devel

charge_now-in-sysfs-for-bq27000-batteries.patch (2K) Download Attachment
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: /sys/class/power_supply/battery/charge_now

Radek Polak
On Tuesday 08 February 2011 23:25:28 Matei-Eugen VASILE wrote:

> I managed to figure it out. The newer kernels seem to be missing the
> feature I was looking for. Probably the kernel I was using back then had
> it (I never checked the code back then). I created a patch for
> drivers/power/bq27000_battery.c for shr-2.6.34, built a new kernel for my
> om-gta02 device and tested it. It seems to be working fine.
>
> I attached the patch to this email, in case you find it useful and think
> others might need it.

I have commited [1] the patch to qtmoko's kernel repo (if you dont mind). Btw
new 2.6.37 kernels use different battery driver

Regards

Radek

[1]
https://github.com/radekp/linux-2.6/commit/dcb4208235dd2f1cb9807cd4e8d939fdc2c5927e

[2]
http://git.openmoko.org/?p=kernel.git;a=blob;f=drivers/power/bq27x00_battery.c;h=99841f51b471eb095f4bf969118aed77130c4389;hb=refs/heads/om-2.6.37

_______________________________________________
devel mailing list
[hidden email]
https://lists.openmoko.org/mailman/listinfo/devel
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: /sys/class/power_supply/battery/charge_now

skuphundaku
On Thu, Feb 10, 2011 at 8:13 AM, Radek Polak <[hidden email]> wrote:
I have commited [1] the patch to qtmoko's kernel repo (if you dont mind). Btw
new 2.6.37 kernels use different battery driver
 
[1]
https://github.com/radekp/linux-2.6/commit/dcb4208235dd2f1cb9807cd4e8d939fdc2c5927e

[2]
http://git.openmoko.org/?p=kernel.git;a=blob;f=drivers/power/bq27x00_battery.c;h=99841f51b471eb095f4bf969118aed77130c4389;hb=refs/heads/om-2.6.37

Of course I don't mind:).

I'll look into the 2.6.37 battery driver as soon as I can. Now I'm a bit busy using the 2.6.34 fix, but after that, I'll take care of 2.6.37 too.

M.
 

_______________________________________________
devel mailing list
[hidden email]
https://lists.openmoko.org/mailman/listinfo/devel
Loading...