[ltp] Re: Help needed: battery date encoding for tp_smapi
Shem Multinymous
linux-thinkpad@linux-thinkpad.org
Sat, 1 Apr 2006 16:25:30 +0300
Ah, got it. It's a bit-packed word:
day | (month<<5) | ((year-1980)<<9)
where day and month are 1-based.
The next tp_smapi release will have
/sys/devices/platform/smapi/BAT0/manufacture_date
and
/sys/devices/platform/smapi/BAT0/first_use_date
.
Shem
On 4/1/06, Shem Multinymous <multinymous@gmail.com> wrote:
> The ThinkPad batterry (on recent models, at least) reports the
> manufature date and the first use date. This is visible in Battery
> Maximizer under Windows, and I'm trying to add support for this to the
> tp_smapi driver (http://thinkwiki.org/wiki/tp_smapi).
>
> The information is included in the raw data presented by tp_smapi in
> /sys/devices/platform/smapi/BAT0/dump, and I believe I identified the
> fields, but I can't figure out their exact meaning.
>
> I need help from people who can check those dates in Windows, and then
> tell me what the corresponding raw data is by running the following
> command in Linux:
>
> perl -ne '@a=3Dsplit; printf("Manufacture: %d\n",
> hex($a[8])+hex($a[9])*256) if ++$i=3D=3D3;
> printf("First use: %d\n", hex($a[2])+hex($a[3])*256) if $i=3D=3D8' <
> /sys/devices/platform/smapi/BAT0/dump
>
> (All on one line. Load the tp_smapi driver first.)
>
> Here's the data I have so far.
>
> Battery 1:
> Manufacture: 13052 (Battery Maximizer says 2005-7-28)
> First use: 13103 (Battery Maximizer says 2005-09)
>
> Battery 2:
> Manufacture: 13072 (Battery Maximizer says 2005-8-16)
> First use: 13103 (Battery Maximizer says 2005-09)
>
> It looks like the raw data is almost, but not quite, the number of
> days since 1 Jan 1970. Looking at the manufacture dates, in the first
> battery it's off by +61 days, and in the second it's off by +62 days.
> Any idea what encoding they could be using?
>
> Shem
>