LPC SPI Firmware and Driver Prototype

OK so I checked the lsmod list, no dice. I found what looks like the driver in a folder called misc, reform2-lpc.ko, but I can’t load it. I get an invalid module error from insmod. Maybe that’s the wrong one?

I tried also with the other method I found, modprobe, but that gives an exec format error.

Oh whoops, I’ll look into it. Thank you for the error report!

I cannot reproduce your problem. The module is not in a folder called misc but here:

 ./lib/modules/5.19.0-reform2-arm64/updates/dkms/reform2_lpc.ko

It is also not named reform2-lpc.ko but reform2_lpc.ko (underscore instead of dash). Maybe you have some leftovers from a manual installation?

Can you try to apt update and apt install reform2-lpc-dkms to get the latest version of the package?

I also just built reform-system-image locally and flashed the result on my SD-Card. The module gets loaded automatically upon boot:

$ lsmod | grep lpc
reform2_lpc      16384  0

I have updated my system and gotten the latest update to the reform-tools, and the lpc module seems to be correctly loaded. However, both Sway and KDE report the battery as 0%. Plugging in the power does not change that.

The oled screen shows the correct values.

❯ dpkg -l | grep reform-tools
ii  reform-tools                                  1.11                               all          MNT Reform System Tools
❯ dpkg -l | grep lpc
ii  reform2-lpc-dkms                              1.11                               all          dkms driver sources for reform2 lpc
❯ lsmod | grep lpc
reform2_lpc            16384  0

I just installed the firmware a minute ago and it’s working for me in Sway. Your log shows that you have the packages and modules, but you did flash the firmware too, right?

I must say i did not update the new firmware, after I did that, i get a proper reading on the battery level in sway.

It seems that the information is now independent from the information from what the OLED is showing. That is still showing ??? because I’ve just reset the LPC but sway is showing a correct number.

I experienced that too, my guess is it’s the same reason the system controller battery percentage (when it does display one) is not identical to the Waybar/KDE/Gnome battery percentage described by nanocodebug earlier in the thread.

Updating the lpc firmware (or resetting the lpc) clears the full/empty battery charge info. It will take a charge cycle for it to be correct again on the lpc display.

Your desktop environment can be applying its own full/empty charge state logic to the battery indicator as well. I don’t think it will be possible to get these to sync perfectly, but they should generally be within a few percent of each other if everything is working properly.

Really weird…I just ran upgrade again and now I have it, loaded automatically. I wonder why I didn’t get the update sooner! So it worked immediately since everything else was in place.

Has anyone else gotten into a state where the battery percentage is no longer being reported? I forget what triggered it for me (I think I did Circle + R to reset the system controller) but now KDE shows a brightness control where the battery taskbar icon used to be and Sway doesn’t show battery percentage. The tooltip on the KDE brightness control says “No Batteries Available.”

Did you have the kernel module installed manually before and then installed the reform2-lpc-dkms package via the new reform-tools package? Recently on IRC there was a similar situation which solved itself magically: 2022-09-29.log

No, but I did notice that the reform2_lpc module no longer gets loaded, even though reform-tools and reform2-lpc-dkms packages are still installed.

Update: reinstalling reform2-lpc-dkms and rebooting got the module loaded again and battery status is being reported as it was before.

1 Like

FYI I just did a full upgrade after a while away from Reform and the battery status was gone again. Ran sudo apt reinstall reform2-lpc-dkms and cleared that right up.

2 Likes

I was running the 20210925 version of the LPC firmware and with the upgrade to the v6.0 kernel, I lost the battery status info in gnome. Reinstalling the reform2-lpc-dkms didn’t help. I flashed the latest version of the LPC firmware just now and that restored the battery status info in gnome. The LPC firmware version is now reported as 20220621.

1 Like

With the protected battery boards and my new trackball 2.0 arriving I finally found the time to flash the LPC firmware required for the battery status display.

I was able to confirm the problem that sometimes after kernel upgrades, the battery status would vanish. This is a problem with the packaging and I posted the fix here:

I configured wayland like this:

    "battery": {
        "bat": "8xlifepo4",
        "format": "BAT {capacity}% <span font='Font Awesome'>{icon}</span>",
        "format-icons": ["", "", "", "", ""],
        "format-charging": "BAT {capacity}% <span font='Font Awesome'>{icon}</span> ",
        "format-full": "BAT 100% ",
        "interval": 30,
        "states": {
            "warning": 10,
            "critical": 5
        },
        "tooltip": false,
        "on-click": "gnome-power-statistics"
    },

This will show a “flash” symbol when power is plugged in and also give a visual indication of the battery charge. If the battery is too low, it will first turn red and then start blinking using this CSS:

#battery.warning:not(.charging) {
    color: #FF0000;
}

#battery.critical:not(.charging) {
    animation: blink_effect 0.5s steps(2) infinite;
}

@keyframes blink_effect {
        50% { color: #FF0000; }
        100% { color: #0000FF; }
}
5 Likes

You icon symbols are unreadable in the forum post, unfortunately.

I use something less fancy and more limited:

 "battery": {
        "bat": "8xlifepo4",
        "format": "BAT {capacity}%",
        "format-charging": "AT {capacity}%",
        "format-full": "BAT FULL",
        "interval": 30,
        "tooltip": false,
        "on-click": "gnome-power-statistics"
    },
1 Like

The icon symbols may not get rendered properly in your browser, but copypasting them results in the correct characters nonetheless.

1 Like