charge=$(hal-device | grep is.charging | awk '{printf $3}') x=$(hal-device | grep voltage.current | awk '{printf "%4.0f",$3}') if [ $x -ge 4050 ];then echo $x | awk '{printf "%3.1f", 85 + ($1 - 4050) / 12}{print "%"}' level=0;fi\nif [ $x -ge 3900 -a $x -lt 4050 ];then echo $x | awk '{printf "%3.1f", 70 + ($1 - 3900) / 10}{print "%"}' level=0;fi\nif [ $x -ge 3800 -a $x -lt 3900 ];then echo $x | awk '{printf "%3.1f", 50 + ($1 - 3800) / 5}{print "%"}' level=0;fi\nif [ $x -ge 3660 -a $x -lt 3800 ];then echo $x | awk '{printf "%3.1f", 15 + ($1 - 3660) / 4}{print "%"}' level=1;fi\nif [ $x -ge 3600 -a $x -lt 3660 ];then echo $x | awk '{printf "%3.1f", 5 + ($1 - 3600) / 6}{print "%"}' level=2;fi\nif [ $x -lt 3600 ];then echo $x | awk '{printf "%3.1f", ($1 - 3300) / 60}{print "%"}' level=3;fi if [ $level -gt 1 ]; then dbus-send --system --type=method_call --dest=com.nokia.mce /com/nokia/mce/request com.nokia.mce.request.req_led_pattern_activate string:"PatternError" fi if [ $level -le 1 ]; then dbus-send --system --type=method_call --dest=com.nokia.mce /com/nokia/mce/request com.nokia.mce.request.req_led_pattern_deactivate string:"PatternError" fi if [ $charge == "true" ];then echo "Charging" else echo $x | awk '{printf "%1.3fV", $x / 1000}' fi exit $level