Gentoo Archives: gentoo-user

From: "J. Roeleveld" <joost@××××××××.org>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] Battery charge status script for term or text console
Date: Thu, 05 Nov 2015 11:54:02
Message-Id: 7D77948C-E56F-4EB8-8603-59E5C98B5330@antarean.org
In Reply to: [gentoo-user] Battery charge status script for term or text console by Walter Dnes
1 On 5 November 2015 00:53:25 CET, Walter Dnes <waltdnes@××××××××.org> wrote:
2 > The attached script requires "make menuconfig" to have
3 >
4 >Power management and ACPI options --->
5 >[*] ACPI (Advanced Configuration and Power Interface) Support --->
6 ><*> Battery
7 >
8 >or CONFIG_ACPI_BATTERY enabled if you do .config manually.
9 >
10 > The script reads /sys/class/power_supply/BAT1/uevent on a laptop and
11 >calculates the percentage of battery charge. Because it only reads
12 >from
13 >/sys, and does not write, it can be run by a regular user. The script
14 >is primitive, and has to be stopped with {CTRL}{C}.
15 >
16 > The script runs in text mode, and can run in xterm or even a pure text
17 >console. I've removed the #!/bin/bash at the top of the attached file
18 >and chmod'ed it non-executable. The mailing list software seems to
19 >reject any such attachments. You can source the file as is, or chmod
20 >it
21 >executable, and insert #!/bin/bash at the top. Note that there is an
22 >ANSI escape sequence in the script, to keep the output in one location.
23 >Regular cut-and-paste can fail if you try to copy from the screen.
24
25 FYI, on my laptop it's BAT0, not BAT1.
26
27 --
28 Joost
29 --
30 Sent from my Android device with K-9 Mail. Please excuse my brevity.