[TRACKING] Fn key stops working on PopOS after a while

Thank you both for the quirks series and the ACPI mutex locking, I have combined both in my github fork.

@jubnut I added a Co-developed-by for your e-mail address, your original commit unfortunately did not contain Signed-off-by.

Edit: currently untested, I will hopefully find some time tomorrow.

2 Likes

This is awesome news! Here’s hoping for the best with testing. If I wanted to test this myself, would I be able to?

Yes. Something like:

# setup for building modules (in Debian/Ubuntu land):
sudo apt install build-essential
sudo apt install linux-headers-$(uname -r)
# build and install new modules:
git clone https://github.com/walshb/framework_linux_ec
cd framework_linux_ec/src
make
sudo make insmod

Edit: this only installs the modules in memory, so they will not be running after a reboot. See the README.md for more information.
Edit 2: Builds and installs fine with kernel >= 6.5. I’ve built successfully on a different machine with kernel == 6.2.0. I doubt it will build on kernels before 6.0.

1 Like

Update: I’ve been running ectool in a tight loop to test, and after a few hundred iterations it would read incorrect data from the EC.
I found a place in the upstream Linux kernel that was missing a lock. Fixed, and pushed to github.
Looks a lot better now. Currently at 85K runs of ectool, and no errors.

4 Likes

Appreciate the update.

@jubnut I tested your patch and so far didn’t experience this annoying error again. Thanks for your great work.

1 Like

Another update: I have rebased my changes upon the AMD Framework code from @DHowett , and pushed to the github repo I mentioned above.
So now the modules should work with AMD-powered Framework laptops.

1 Like

I finally got around to looking at this. Installing was very easy and it seems great so far - thank you so much!

On Ubuntu 22.04 my kernel is now 6.5, and I had to also sudo apt-get install gcc-12 so that the modules could be compiled with the same compiler as the Ubuntu kernel. I also have Secure Boot enabled, which prevented the modules from being loaded with insmod. Figuring out how to manually sign them proved harder than expected, so instead I just followed the DKMS installation instructions, which worked a treat! (I’ve submitted a PR for some README tweaks based on my experience.)

It’s (very) early days, but so far no dmesg errors (when previously there would be many). So I’m pretty confident that the Fn key problem won’t reoccur (but will of course post if it does). I’m also hopeful that this may resolve the problem I have where, very very rarely, the system just spontaneously powers down for no apparent reason.

Very cool. Glad it’s working for you. And thanks for the PR: approved and committed.

My Framework is running Void Linux so no secure boot. I did briefly check the module build on an Ubuntu box but didn’t try much else. Very happy that you got the full install working!

Re: the module itself, there is still a bug which I have to fix in the initial module probe. The check for the EC is not protected by the lock. I have written the fix for this but it’s still a bit ugly. I’ll probably push something out to Github in the next couple of weeks.

2 Likes

this solved it for me on Pop!_OS 22.04

Any chance getting this patched upstream so everyone can benefit and not have to compile a special module?

I’m working on it :wink:

https://lore.kernel.org/chrome-platform/20240515055631.5775-1-ben@jubnut.com/

Excellent news, thanks for the huge improvement. My logs look so crisp and clean. =)

Update: my code to fix these EC problems was merged into Linux kernel 6.11, which is now available in Ubuntu 24.10 and Fedora 41.

1 Like