aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTobias Geerinckx-Rice <me@tobias.gr>2019-05-10 14:49:58 +0200
committerTobias Geerinckx-Rice <me@tobias.gr>2019-05-20 01:49:34 +0200
commitb313665fa0ca93c84aa80311cb57eca8396731af (patch)
tree12fbee1fb4725843b67ca149a5094a8785783818
parent7bf28446a51efe1e97c02590e98fe7f59559b4da (diff)
downloadguix-b313665fa0ca93c84aa80311cb57eca8396731af.tar.gz
guix-b313665fa0ca93c84aa80311cb57eca8396731af.zip
gnu: Add tpacpi-bat.
* gnu/packages/linux.scm (tpacpi-bat): New public variable.
-rw-r--r--gnu/packages/linux.scm62
1 files changed, 62 insertions, 0 deletions
diff --git a/gnu/packages/linux.scm b/gnu/packages/linux.scm
index aa3b36ce6f..24b4980efd 100644
--- a/gnu/packages/linux.scm
+++ b/gnu/packages/linux.scm
@@ -3770,6 +3770,68 @@ other @code{hwmon} driver that enables temperature reading and fan control
from userspace.")
(license license:gpl3+)))
+(define-public tpacpi-bat
+ (package
+ (name "tpacpi-bat")
+ (version "3.1")
+ (source
+ (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/teleshoes/tpacpi-bat.git")
+ (commit (string-append "v" version))))
+ (file-name (git-file-name name version))
+ (sha256
+ (base32 "0wbaz34z99gqx721alh5vmpxpj2yxg3x9m8jqyivfi1wfpwc2nd5"))))
+ (build-system gnu-build-system)
+ (arguments
+ `(#:tests? #f ; no test target
+ #:phases
+ (modify-phases %standard-phases
+ (add-after 'unpack 'refer-to-inputs
+ (lambda _
+ (substitute* "tpacpi-bat"
+ (("cat ")
+ (format "~a " (which "cat")))
+ ;; tpacpi-bat modprobes the acpi_call kernel module if it's not
+ ;; loaded. That's the administrator's prerogative; disable it.
+ (("system \"(modprobe .*)\"" _ match)
+ (format "die \"Please run ‘~a’ first.\\n\"" match)))
+ #t))
+ (delete 'configure) ; nothing to configure
+ (delete 'build) ; nothing to build
+ (replace 'install
+ (lambda* (#:key outputs #:allow-other-keys)
+ (let* ((out (assoc-ref outputs "out"))
+ (bin (string-append out "/bin"))
+ (doc (string-append out "/share/doc/" ,name "-" ,version)))
+ (install-file "tpacpi-bat" bin)
+
+ ;; There's no man page. Install other forms of documentation.
+ (for-each (lambda (file)
+ (let ((target (string-append doc "/" file)))
+ (mkdir-p (dirname target))
+ (copy-recursively file target)))
+ (list "battery_asl" "examples" "README.md"))
+ #t))))))
+ (inputs
+ `(("perl" ,perl)))
+ (home-page "https://github.com/teleshoes/tpacpi-bat")
+ (synopsis "ThinkPad battery charge controller")
+ (description
+ "Tpacpi-bat is a command-line interface to control battery charging on
+@uref{https://github.com/teleshoes/tpacpi-bat/wiki/Supported-Hardware, Lenovo
+ThinkPad models released after 2011}, starting with the xx20 series. It can
+query and set the thresholds at which one or both batteries will start and stop
+charging, inhibit charging batteries for a set period of time, or force them to
+discharge when they otherwise would not.
+
+This tool merely exposes ACPI calls provided by the @code{acpi_call} Linux
+kernel module provided by the @code{acpi-call-linux-module} package, which must
+be installed and loaded separately. Only the original vendor firmware is
+supported.")
+ (license license:gpl3+)))
+
(define-public ntfs-3g
(package
(name "ntfs-3g")