#!/bin/sh

# command line script to show battery state on AC100 / linux
# CC0/Public Domain by Hanno Boeck, http://hboeck.de/

# old kernels had this
#device="/sys/devices/platform/nvec.2/nvec-power.1/power_supply/battery/"
device="/sys/class/power_supply/battery"

now=`cat $device/charge_now`
full=`cat $device/charge_full`
status=`echo "($now*100)/$full"|bc`

if [ "$1" = "-v" ]; then
	echo -n "Manufacturer:		"
	cat $device/manufacturer
	echo -n "Model:			"
	cat $device/model_name
	echo -n "Technology:		"
	cat $device/technology
	echo -n "Design capacity:	"
	cat $device/charge_full_design
	echo -n "Last full capacity:	"
	cat $device/charge_full
	echo -n "Status:			"
fi

echo -n "$status % "

cat $device/status
