[SOLVED] Changing the maximum battery charge without rebooting

I know that I can reboot and change the battery max charge level in the BIOS menu, but would there be a way to do it (on Linux) without rebooting?

Typical use case would be, I am working on a project with many terminal tabs open, etc (I really do not want to reboot), but then I decide to prepare to work outside for a while in the afternoon, and so I realize that I now want a full charge instead of the normal 60%.

The EC can control this!

2 Likes

@Shiroudan Oh! Thank you!! I found the command line:

sudo ectool chargecurrentlimit 100

or, to revert to the capacity limited to 60%:

sudo ectool chargecurrentlimit 60

By the way, do you know if the Linux system is able to handle the change without restarting any service?

3 Likes

Edit: no, see the next post.

To answer to myself, yes it works without restarting any service!

The only detail to be aware of:

there seems to be a minimum difference between the target charge and the current charge, to trigger charging.

For example, if I am at 21% charge, and if I set the charge limit to 25%, it will still be discharging. But if I set the charge limit to 30%, it will start charging.

2 Likes

@Shiroudan @Fraoch
Actually, I have to contradict what I’ve just written: no it does not work well.

I’ve currently applied the sudo ectool chargecurrentlimit 100, and acpi -b gives me:

Battery 1: Charging, 60%, charging at zero rate - will never fully charge.

Which is just what I would get if I had changed nothing…

EDIT: ok now it is saying:

Battery 1: Charging, 60%, 1385:00:00 until charged

Maybe it just needed time to update itself.
Let’s see in a couple minutes if it progresses above 60% or it it stays stalled.

EDIT: Nope. Again saying:

Battery 1: Charging, 60%, charging at zero rate - will never fully charge.

EDIT: Rebooting and changing it in the BIOS gave me immediately acpi -b:

Battery 1: Charging, 62%, 00:34:26 until charged

So, my understanding is that right now ectool is not helpful to avoid rebooting+BIOS.

The ectool commands are a bit confusing. chargecurrentlimit limits the charging current. So you reduced the current to at most 100 mA but the battery was not charged, because the maximum charge level remained at 60%. To encrease it to 100% the correct command would have been

ectool fwchargelimit 100

3 Likes

@Viandant Ah!! Thank you so much!!
Now my posts seem a bit stupid lol ^^;

Let me try this out today, and I’ll mark it solve as soon as I could check that it works!

@Viandant I got:

$ sudo ectool fwchargelimit 100
Unknown command 'fwchargelimit'

Which version are you using?
I used the EmbeddedController Github repo, in the hx20 branch, latest commit.
Compiled ectool with make utils.
Should I try the hx30 branch instead?

Ohh OK I get it now!

I was mistakenly using GitHub - FrameworkComputer/EmbeddedController: Embedded Controller firmware for the Framework Laptop

whereas I had to use the repo GitHub - DHowett/framework-ec: Embedded Controller firmware for the Framework Laptop !!

And, indeed, the DHowett version does have the fwchargelimit command!

And I tested it and it works!! Let me mark it as solved in the title.

3 Likes

I’m sorry. I should have mentioned which ectool I’m using. I’m glad you found it yourself now.

2 Likes

Hello. Would you know if there is a way of doing the same in Windows? Happy to start a new thread in the correct section if that’s more appropriate. Thanks

2 Likes

Okay but now, following this thread without reading it fully first, I used the ectool chargecurrentlimit and now I don’t know how to reset its default value :frowning: anyone knows about this? because I don’t know if there is a safe default value. I fear setting a very high limit (so, current is not really limited) and damaging the battery for getting too fast charging or something like that…

You can simply set to 9999 and the battery itself will control the safe current
You can ectool battery and the Desired current is the value controlled by the battery

do you know it for sure? how can we know what is the default value or something?

If you aren’t sure,you can shutdown the computer unplugged, wait for 10 seconds, then boot up and then all EC values go back to default

sorry, how do you know EC values reverts to default when you do that?

If you ectool fwchargelimit to change the charge percentage cap, after shutting down the limit is set back to the BIOS value. The same goes for LED lighting, fanduty, etc. ectool is only on userspace

1 Like

hmm that’s good to know, I’ll experiment a bit more and see. Thanks!!