3

How one can fake the battery info in the laptop?

I am working on a tool that must fake the power of the battery in my laptop.

This means that the tool must force the battery or laptop to report low power while its charged well.

Is there any framework or driver that can help me to do this?

Do we have the firmware of the battery to support this functionality?

I really can't find a solution for this problem, any help is so appreciated.

Thanks in advance.

Note: the programming language does not matter.

jimmym715
  • 1,512
  • 1
  • 16
  • 25
Rida
  • 41
  • 1
  • 2
  • what laptop? what OS? Would you have the OS to report the "fake" battery state or just an application? – Caspar Kleijne Mar 13 '11 at 07:12
  • This is manufacturer- and product-specific. There's nothing generic that we can tell you. @Caspar: I believe the *battery* is intended to report a low state, meaning this is at the firmware level, below the OS. – user541686 Mar 13 '11 at 07:12
  • Guys ... I am using Lenovo Labtop C-300 --- windows XP SP3 I heard that there is smth called "ACPI driver" .. does this thing can help me?? – Rida Mar 13 '11 at 07:15
  • @Casper Sorry, my edit seemed to have conflicted with yours, and have erased some of your edits, although it also has some corrections that you missed. I didn't mean to. Please edit again. – sawa Mar 13 '11 at 07:16
  • 1
    @Mehrdad, in the case of faking, I doubt you have to deal with the firmware. It is all about a facade that "**imitates**" the battery info. So the hardest part is to hide/route the **real** battery info. ( I am thinking a MiM solution here) – Caspar Kleijne Mar 13 '11 at 07:17
  • Not that the power system is a system-critical process. When you modify that, you're dealing with windows XP's security system. – Caspar Kleijne Mar 13 '11 at 07:26
  • Finally I've find the solution for Windows here https://stackoverflow.com/questions/50658822/how-to-programmatically-emulate-battery-in-windows-workstation-without-battery-d/50658823#50658823 – Oleg Neumyvakin Nov 15 '19 at 12:45

2 Answers2

2

Build an application that shows a low battery icon in the System Tray.

glowworms
  • 410
  • 4
  • 8
1

You are asking about how to mock/stub something. I would use a mock or stub.

so

  • new MyFirstPowerMonitor(new AcpiBatteryLevelReader()) - main program

  • new MyFirstPowerMonitor(new ProgrammableBatteryLevelReader()) - to use something you can control.

thats it really.

time4tea
  • 2,169
  • 3
  • 16
  • 21