Recent

Author Topic: Access BatteryData via SMBus  (Read 4945 times)

metis

  • Sr. Member
  • ****
  • Posts: 300
Access BatteryData via SMBus
« on: October 20, 2016, 04:44:04 pm »
Hi to all !

I have a laptop, where the battery is not charging any more.  :(

Obviously there's nothing wrong physically with that battery, only BatteryData seem to be messed up
by an erroneous Win7-Version, as described here:
"Akku-Tod durch Windows 7 ???"
http://thinkpad-forum.de/threads/83254-Akku-Tod-durch-Windows-7?highlight=Akku-Tod
"T400 Akku selber reparieren"
https://thinkpad-forum.de/threads/185183-T400-Akku-selber-reparieren
(Sorry, but that's all in German.)  ::)

Now, I'm looking for a solution to read out all BatteryData and correct invalid Entries,
with the battery plugged in, that is
without the need to buy lots of equipment or disassemble the battery, as shown here:
http://be2works.com/

This solution should be able to reset flags, like the 'Permanent Failure Flag', too.

-> Does anybody know, how to do it under Windows (32bit) and/or in the BIOS  ?

BTW:
Getting the batterie's 'ChargingState' and 'Lifetime left' in Windows is already shown here:
http://forum.lazarus.freepascal.org/index.php/topic,16734.msg91289.html#msg91289
-> What else can be read out with the Window-API's 'GetSystemPowerStatus()' ?

Thanks !
Life could be so easy, if there weren't those f*** Details.
My FFmpeg4Lazarus = FFPlay4Laz + FFGrab4Laz + FFInfo4Laz

RAW

  • Hero Member
  • *****
  • Posts: 868
Re: Access BatteryData via SMBus
« Reply #1 on: October 22, 2016, 04:45:36 am »
There is a free version of "BATTERY BAR"... it's a nice program and shows a lot of information... maybe interesting for some extra information from another program...

Maybe you can expand this:
Code: Pascal  [Select][+][-]
  1. Procedure TForm1.GetBatteryInfo;
  2.   Var
  3.    SystemPowerStatus: TSystemPowerStatus;
  4.  Begin
  5.   GetSystemPowerStatus(SystemPowerStatus);
  6.    With SystemPowerStatus
  7.    Do
  8.     Begin
  9.      Case ACLineStatus
  10.      Of
  11.       0:   Label1.Caption:= 'BATTERY';
  12.       1:   Label1.Caption:= 'AC';
  13.       Else Label1.Caption:= 'UNKNOWN';
  14.      End;
  15.  
  16.      Case BatteryFlag
  17.      Of
  18.         1 : Label2.Caption:= 'HIGH';
  19.         2 : Label2.Caption:= 'LOW';
  20.         4 : Label2.Caption:= 'CRITICAL';
  21.         8 : Label2.Caption:= 'LOADING';
  22.       128 : Label2.Caption:= 'NO BATTERY';
  23.       255 : Label2.Caption:= 'UNKNOWN';
  24.      End;
  25.  
  26.      If BatteryLifePercent <> 255
  27.      Then Label3.Caption:= 'PERCENT: '+IntToStr(BatteryLifePercent)
  28.      Else Label3.Caption:= 'PERCENT: UNKNOWN';
  29.     End;
  30.  End;        
  31.  
Windows 7 Pro (x64 Sp1) & Windows XP Pro (x86 Sp3).

metis

  • Sr. Member
  • ****
  • Posts: 300
Re: Access BatteryData via SMBus
« Reply #2 on: October 27, 2016, 03:50:17 pm »
@SoE
I'll try that out - Thanks !  :)
Life could be so easy, if there weren't those f*** Details.
My FFmpeg4Lazarus = FFPlay4Laz + FFGrab4Laz + FFInfo4Laz

 

TinyPortal © 2005-2018