Skip to content

Commit

Permalink
feat: Add tp_smapi from tlp
Browse files Browse the repository at this point in the history
Older Thinkpads (2011 and older) require this kernel module for battery
charge thresholds and recalibration with tlp. You only need this if the
Recommendations section from running `tlp-stat -b` includes `Install
tp-smapi kernel modules for ThinkPad battery thresholds and
recalibration`.
  • Loading branch information
p4p4j0hn committed Nov 19, 2024
1 parent 0f236b6 commit 32dbe85
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
1 change: 1 addition & 0 deletions Containerfile.common
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ RUN --mount=type=cache,dst=/var/cache/dnf \
/tmp/build-kmod-framework-laptop.sh && \
/tmp/build-kmod-kvmfr.sh && \
/tmp/build-kmod-openrazer.sh && \
/tmp/build-kmod-tp_smapi.sh && \
/tmp/build-kmod-v4l2loopback.sh && \
/tmp/build-kmod-wl.sh && \
/tmp/build-kmod-xpadneo.sh && \
Expand Down
17 changes: 17 additions & 0 deletions build-kmod-tp_smapi.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/sh

set -oeux pipefail

ARCH="$(rpm -E '%_arch')"
KERNEL="$(rpm -q "${KERNEL_NAME}" --queryformat '%{VERSION}-%{RELEASE}.%{ARCH}')"
RELEASE="$(rpm -E '%fedora')"

### Add TLP repo
dnf install -y https://repo.linrunner.de/fedora/tlp/repos/releases/tlp-release.fc$(rpm -E %fedora).noarch.rpm

### BUILD tp_smapi (succeed or fail-fast with debug output)
dnf install -y \
akmod-tp_smapi-*.fc${RELEASE}.${ARCH}

Check warning on line 14 in build-kmod-tp_smapi.sh

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

build-kmod-tp_smapi.sh#L14

Double quote to prevent globbing and word splitting.
akmods --force --kernels "${KERNEL}" --kmod tp_smapi
modinfo /usr/lib/modules/${KERNEL}/extra/tp_smapi/tp_smapi.ko.xz >/dev/null ||

Check warning on line 16 in build-kmod-tp_smapi.sh

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

build-kmod-tp_smapi.sh#L16

Double quote to prevent globbing and word splitting.
(find /var/cache/akmods/tp_smapi/ -name \*.log -print -exec cat {} \; && exit 1)

0 comments on commit 32dbe85

Please sign in to comment.