From cce820d0ce99c561b153490d42994229f46f2708 Mon Sep 17 00:00:00 2001 From: Martin Kepplinger Date: Wed, 15 May 2019 11:26:16 +0200 Subject: [PATCH] x230_skulls.sh: print battery hardware health when verbose This may help in refurbishing an x230 laptop. --- x230/x230_skulls.sh | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/x230/x230_skulls.sh b/x230/x230_skulls.sh index 733ffb6..75475ee 100755 --- a/x230/x230_skulls.sh +++ b/x230/x230_skulls.sh @@ -133,6 +133,15 @@ if [[ $BIOS_VENDOR != *"coreboot"* ]] ; then exit 0 fi +if [[ "$verbose" -gt 0 ]] ; then + if [ -d "/sys/class/power_supply/BAT0" ] ; then + bat_last_full=$(cat /sys/class/power_supply/BAT0/charge_full) + bat_design_cap=$(cat /sys/class/power_supply/BAT0/charge_full_design) + bat_health=$(echo "scale=2 ; $bat_last_full/$bat_design_cap" | bc | sed 's/^\./0./') + echo "INFO: Battery hardware health is $bat_health%" + fi +fi + if [ ! "$have_input_image" -gt 0 ] ; then image_available=$(ls -1 | grep x230_coreboot_seabios || true) if [ -z "${image_available}" ] ; then