getInfo 2.16.1

This commit is contained in:
kyodev 2017-10-25 10:23:24 +02:00
parent 579ee481a9
commit 69b23dbc6b
2 changed files with 20 additions and 13 deletions

View File

@ -1,6 +1,6 @@
#!/bin/bash
version=2.16.0
version=2.16.1
date="25/10/2017"
projet="simpledeb"
contact="IRC freenode ##sdeb ou https://framagit.org/kyodev/kyopages/issues/"
@ -1082,16 +1082,16 @@ figet_batt(){ #v2 25/10/2017
batt_capa_now="$(gawk -F '=' '/POWER_SUPPLY_CHARGE_NOW=/ {printf "%d", $2/1000}' <<< $uevent)" # mA
batt_conso="$(gawk -F '=' '/POWER_SUPPLY_CURRENT_NOW=/ {printf "%d", $2/1000}' <<< $uevent)" # mA
elif grep -q 'POWER_SUPPLY_ENERGY_' <<< $uevent ; then
# batt_unit="mWh"
# batt_unit="mWh"
# batt_capa_design="$(gawk -F '=' '/POWER_SUPPLY_ENERGY_FULL_DESIGN=/ {printf "%d", $2/1000}' <<< $uevent)" # mW
# batt_capa_full="$(gawk -F '=' '/POWER_SUPPLY_ENERGY_FULL=/ {printf "%d", $2/1000}' <<< $uevent)" # mW
# batt_capa_now="$(gawk -F '=' '/POWER_SUPPLY_ENERGY_NOW=/ {printf "%d", $2/1000}' <<< $uevent)" # mW
# batt_conso="$(gawk -F '=' '/POWER_SUPPLY_POWER_NOW=/ {printf "%d", $2/1000}' <<< $uevent)" # mW
batt_unit="Wh"
batt_capa_design="$(gawk -F '=' '/POWER_SUPPLY_ENERGY_FULL_DESIGN=/ {printf "%.3f", $2/1000000}' <<< $uevent)" # W
batt_capa_full="$(gawk -F '=' '/POWER_SUPPLY_ENERGY_FULL=/ {printf "%.3f", $2/1000000}' <<< $uevent)" # W
batt_capa_now="$(gawk -F '=' '/POWER_SUPPLY_ENERGY_NOW=/ {printf "%.3f", $2/1000000}' <<< $uevent)" # W
batt_conso="$(gawk -F '=' '/POWER_SUPPLY_POWER_NOW=/ {printf "%.3f", $2/1000000}' <<< $uevent)" # W
batt_capa_design="$(gawk -F '=' '/POWER_SUPPLY_ENERGY_FULL_DESIGN=/ {printf "%.2f", $2/1000000}' <<< $uevent)" # W
batt_capa_full="$(gawk -F '=' '/POWER_SUPPLY_ENERGY_FULL=/ {printf "%.2f", $2/1000000}' <<< $uevent)" # W
batt_capa_now="$(gawk -F '=' '/POWER_SUPPLY_ENERGY_NOW=/ {printf "%.2f", $2/1000000}' <<< $uevent)" # W
batt_conso="$(gawk -F '=' '/POWER_SUPPLY_POWER_NOW=/ {printf "%.2f", $2/1000000}' <<< $uevent)" # W
else
batt_capa_design="na"
fi
@ -1116,9 +1116,11 @@ figet_batt(){ #v2 25/10/2017
fi
batt_restant+="$(gawk '$1 != "" {printf "%d h %02d mn \n", $1, $1*60%60}' <<< $tempo) "
# mise en forme pour sortie, séparateur milliers
batt_capa_design="$(printf "%'d" $batt_capa_design)"
batt_capa_full="$(printf "%'d" $batt_capa_full)"
batt_conso="$(printf "%'d" $batt_conso)"
if [ "$batt_unit" == "mAh" ]; then
batt_capa_design="$(printf "%'d" $batt_capa_design)"
batt_capa_full="$(printf "%'d" $batt_capa_full)"
batt_conso="$(printf "%'d" $batt_conso)"
fi
# sortie
batt_detail+="$ibat: $(cat $batRep/$ibat/manufacturer 2>/dev/null) "
batt_detail+="($(cat $batRep/$ibat/model_name 2>/dev/null)) $(cat $batRep/$ibat/technology 2>/dev/null) "
@ -1128,8 +1130,13 @@ figet_batt(){ #v2 25/10/2017
[ "$batt_capa_full" ] && batt_detail+="pleine charge effective: $batt_capa_full$batt_unit, "
batt_detail+="pleine charge théorique: $batt_capa_design$batt_unit => "
if [ "$batt_conso" != "0" ]; then
batt_restant+="(consommation en cours: $(printf "%'d" $batt_conso)$(sed 's/h//' <<< $batt_unit), "
batt_restant+="charge actuelle: $(printf "%'d" $batt_capa_now)$batt_unit)"
if [ "$batt_unit" == "mAh" ]; then
batt_restant+="(consommation en cours: $(printf "%'d" $batt_conso)$(sed 's/h//' <<< $batt_unit), "
batt_restant+="charge actuelle: $(printf "%'d" $batt_capa_now)$batt_unit)"
else
batt_restant+="(consommation en cours: $(printf "%s" $batt_conso)$(sed 's/h//' <<< $batt_unit), "
batt_restant+="charge actuelle: $(printf "%s" $batt_capa_now)$batt_unit)"
fi
fi
[ "$batt_sante" ] && batt_detail+="$batt_sante% (indicateur)"$' \n'
[ "$batt_restant" ] && batt_detail+="$batt_restant"$' \n'
@ -2098,7 +2105,7 @@ for j in $options; do
case $j in
-t | --test )
prg_1 "$*"
fi_disk
fi_batt
prg_3
exit ;; # test seulement
-c* | all )

View File

@ -15,7 +15,7 @@
* f__requis f__wget_test fscript_get_version fscript_update fscript_cronAnacron
* f__cmd_exist f__sudo f__requis
## 2.16.0 25/10/2017
## 2.16.1 25/10/2017
* révision: batterie, unité en W au lieu de mW, mA inchangé
* fix, révision: modification complète des séquences peuplement rapport et modules fi_* autonomes