I am interested in adding Frameworks laptops ability to control battery charging limit to Gnome extension “Battery Health Charging” which provides a GUI in gnome-shell quick settings menu, that few might be interested.
From information that I have gathered, I found 2 tools to can be used to change charge limit.
ectool - Dhowett found on Github (Damn cannot post more than two links)
Can be set by the command sudo ectool fwchargelimit 80
The first and most popular tool used for changing charching limit.
Also found mentioned ArchLinux website. (cannot post more than two links)
Default installation location when install from archlinux repository /usr/bin/fw-ectool
framework_tool
Officially supported by Frameworks (cannot post more than two links but it is in the repo framework-system)
Can be set by command sudo framework_tool --charge-limit 80
Also found mentioned ArchLinux website (Again cannot post more than two links)
Default installation location when install from archlinux repository /usr/bin/framework_tool
I wasn’t sure which tool to go for as I do not know the benefits/drawback for each tool. (Feedback on this is appreciated) . Since framework_tool is officially supported, I have already build a drafted test version of extension around the framework_tool.
The only prerequisite is that framework_tool will have to be installed/copied at /usr/bin/ as the extension check if the file present. In other words extension will notify that device not supported if failed to find /usr/bin/framework_tool
Since I don’t have framework laptop, I cannot test and dont know if this will work.
Anyone interested in testing and providing feedback let me know. I am open to suggestions.
Just and FYI Currently neither of these work with the amd frameworks; David hasn’t updated his efi tool either to support the amd ec. There is an out of tree patchset which I am just testing, but it was knocked back from inclusion into mainline and needs to be resubmitted with some trivial adjustments.
There is a patchset which I am using without issue, but it needs to get resubmitted for inclusion in mainline.
Likewise the userspace tools will need updating to support the AMD EC.
There is actually a sysfs EC expose knob which makes the EC available from standard kernel fs structures, but it’s disabled in most sane distro kernels.
There is actually a sysfs EC expose knob which makes the EC available from standard kernel fs structures, but it’s disabled in most sane distro kernels.
Interesting, so there are 3 ways to set charging threshold. 2 tools and a kernel module.
Thats great. I think I will wait for the kernel module to be released or merge with mainline then.
Hello @jwp
I am building the extension around the kernel module.
Just wanted to imformation if you have the following sysfs path when using DHowetts kernel module?
ls -l /sys/devices/platform/framework_laptop
The extension supports several laptop of different make module and usually check is the a file exist to determine which laptop it is installed on and loads options/settings accordingly.
If File exist
(/sys/devices/platform/msi-ec/ && /sys/class/power_supply/BAT1/charge_control_end_threshold)
Then load options/settings for MSI laptop
If File exist
(/sys/module/asus_wmi && /sys/class/power_supply/BAT1/charge_control_end_threshold)
Then load options/settings for Asus laptop
Just wanted the information, if there is any file that is unique to Framework laptop
The EC Debug option is Flagged in the upstream as dangerous ; you can build it as a module but you will need to configure it in the kernel config and rebuild.
the cros_ec_lpc patch is harmless but you’ll need to patch the kernel source with the patch for it currently as it’s out of tree for the moment.
Oh. Wait. I forgot to confirm with you which kernel module/patch are you using. Are you test ing the below kernel module?
Or Are your testing only specifically cross_ec_lpcs patch for AMD without the framework-laptop-kmod module?
Cause with framework-laptop-kmod module, i think it should create a sysfs path /sys/devices/platform/framework_laptop
But I may be wrong.
Sorry I was not clear with my question posted earlier.
Please confirm if you testing results are with framework-laptop-kmod module installed.
Also note that with the default KDE/Plasma energy module powerdevil/Energy Centre - granular Keyboard backlight control becomes available. As does reporting the BIOS set correct charge limit for the battery with no additional work required (99% in my case)
Great!!!
Thank you @jwp for the information
So with the kernel module installed and working, I think Gnome 45 keyboard backlight changes should work out of the box.
For charging threhsold, I will add Framework to Battery Health Charging Gnome extension, so setting charging threshold should work if the extension is used.
Oh I just realized, I am still lacking on one information.
This extension has a option to change the behavior of systems charging icon displayed.
On Gnome when Battery level is greater than charging threshold, the Upower report charge-pending or discharging even when laptop is running on charger power. So gnome system battery icon displays as “Discharging (Charger unplugged)” . I have added an option “Change battery indicator icon behavior” So that when charger is plugged in it should display “Charger plugged in Icon”
It does this by reading the charger’s power-supply online status in sysfs. The name can vary depending on laptop. It could be one of the standard path mentioned below and something completely unique