maniacx / Battery-Health-Charging

GNU General Public License v3.0
157 stars 14 forks source link

For ThinkPads with Power Bridge -- Manage discharge order #74

Closed eriklautenschlaeger closed 5 months ago

eriklautenschlaeger commented 5 months ago

Problem description

Conceived solution

eriklautenschlaeger commented 5 months ago

Working on this over here. I will have this finished up by tomorrow. If you see something dumb or need anything else just shoot a comment. :-)

eriklautenschlaeger commented 5 months ago

I think this can be cut short: After testing I can say that the behavior of "force-discharge" for a given battery where this is applied is that the battery starts discharging with around 11000mW immediately until it reaches 0% -- regardless of the AC status.

Let me know if I should test anything else.

// Edit: If I set force_discharge while AC is plugged in and then unplug AC the status is reset to auto. When I then try to set it again while AC is unplugged it throws the following error:

# echo "force-discharge" | sudo tee /sys/class/power_supply/BAT1/charge_behaviour
force-discharge
tee: /sys/class/power_supply/BAT1/charge_behaviour: Input/output error
maniacx commented 5 months ago

I really apologize, I may have deleted the branch from my private repo as well. And the changed were huge. I dont think I will have to time work on this again.

# echo "force-discharge" | sudo tee /sys/class/power_supply/BAT1/charge_behaviour
force-discharge
tee: /sys/class/power_supply/BAT1/charge_behaviour: Input/output error

also with such errors, i may be harder to get this working.

I really apologize, I should have check first if I deleted it the branch , before asking you to test.

But atleast now you know that can control (although buggy) which battery the laptop should use when unplugged. Make bash script to make it easier to switch between batteries.

Oh I forgot, u have TLP, i think it has simpler command to trigger force discharge

eriklautenschlaeger commented 5 months ago

No worries at all -- my conclusion was that this won't work anyway :-D force_discharge will drain the battery by "simulating" load until it is completely empty and the auto behavior can't be overwritten while AC is unplugged. I took a look at the tp_smapi driver-API's code and concluded that this is a firmware issue.

maniacx commented 5 months ago

the auto behavior can't be overwritten while AC is unplugged.

Oh I somehow missed that in your earlier post. So it cannot be done. I will close the issue.