mirror of
https://github.com/smxi/inxi.git
synced 2025-01-19 08:57:57 +00:00
New version, new tarball. This closes issue #118, inxi had failed all along to handle
the conversion from mA hours to Wh, and had a math glitch too for charge (ma). Not sure how this went undetected during testing, oh well. I assume that mA h is not as common internally as Wh or something. Anyway, it should be fixed.
This commit is contained in:
parent
54aecd424c
commit
eec6d6e5a8
31
inxi
31
inxi
|
@ -2,8 +2,8 @@
|
||||||
########################################################################
|
########################################################################
|
||||||
SELF_NAME='inxi'
|
SELF_NAME='inxi'
|
||||||
# don't quote the following, parsers grab these too
|
# don't quote the following, parsers grab these too
|
||||||
SELF_VERSION=2.3.31
|
SELF_VERSION=2.3.32
|
||||||
SELF_DATE=2017-07-30
|
SELF_DATE=2017-08-03
|
||||||
SELF_PATCH=00
|
SELF_PATCH=00
|
||||||
########################################################################
|
########################################################################
|
||||||
#### SPECIAL THANKS
|
#### SPECIAL THANKS
|
||||||
|
@ -4192,6 +4192,7 @@ get_battery_data()
|
||||||
serial=""
|
serial=""
|
||||||
of_orig=""
|
of_orig=""
|
||||||
location=""
|
location=""
|
||||||
|
b_ma="false" # trips ma x voltage
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
gsub(/'"$BAN_LIST_NORMAL"'|,|battery|unknown/, "", $2)
|
gsub(/'"$BAN_LIST_NORMAL"'|,|battery|unknown/, "", $2)
|
||||||
|
@ -4233,14 +4234,21 @@ get_battery_data()
|
||||||
charge_now = $NF / 1000000
|
charge_now = $NF / 1000000
|
||||||
charge_now = sprintf( "%.1f", charge_now )
|
charge_now = sprintf( "%.1f", charge_now )
|
||||||
}
|
}
|
||||||
|
# note: the following 3 were off, 100000 instead of 1000000
|
||||||
|
# why this is, I do not know. I did not document any reason for that
|
||||||
|
# so going on assumption it is a mistake. CHARGE is mAh, which are converted
|
||||||
|
# to Wh by: mAh x voltage. Note: voltage fluctuates so will make results vary slightly.
|
||||||
$1 ~ /^POWER_SUPPLY_CHARGE_FULL_DESIGN$/ {
|
$1 ~ /^POWER_SUPPLY_CHARGE_FULL_DESIGN$/ {
|
||||||
charge_full_design = $NF / 100000
|
charge_full_design = $NF / 1000000
|
||||||
|
b_ma="true"
|
||||||
}
|
}
|
||||||
$1 ~ /^POWER_SUPPLY_CHARGE_FULL$/ {
|
$1 ~ /^POWER_SUPPLY_CHARGE_FULL$/ {
|
||||||
charge_full = $NF / 100000
|
charge_full = $NF / 1000000
|
||||||
|
b_ma="true"
|
||||||
}
|
}
|
||||||
$1 ~ /^POWER_SUPPLY_CHARGE_NOW$/ {
|
$1 ~ /^POWER_SUPPLY_CHARGE_NOW$/ {
|
||||||
charge_now = $NF / 100000
|
charge_now = $NF / 1000000
|
||||||
|
b_ma="true"
|
||||||
}
|
}
|
||||||
$1 ~ /^POWER_SUPPLY_CAPACITY$/ {
|
$1 ~ /^POWER_SUPPLY_CAPACITY$/ {
|
||||||
if ( $NF != "" ){
|
if ( $NF != "" ){
|
||||||
|
@ -4260,6 +4268,19 @@ get_battery_data()
|
||||||
serial=$NF
|
serial=$NF
|
||||||
}
|
}
|
||||||
END {
|
END {
|
||||||
|
# note:voltage_now fluctuates, which will make capacity numbers change a bit
|
||||||
|
# if any of these values failed, the math will be wrong, but no way to fix that
|
||||||
|
if (b_ma == "true" && voltage_now != ""){
|
||||||
|
if (charge_now != ""){
|
||||||
|
charge_now=charge_now*voltage_now
|
||||||
|
}
|
||||||
|
if (charge_full != ""){
|
||||||
|
charge_full=charge_full*voltage_now
|
||||||
|
}
|
||||||
|
if (charge_full_design != ""){
|
||||||
|
charge_full_design=charge_full_design*voltage_now
|
||||||
|
}
|
||||||
|
}
|
||||||
if (charge_now != "" && charge_full != "" ){
|
if (charge_now != "" && charge_full != "" ){
|
||||||
capacity = 100*charge_now/charge_full
|
capacity = 100*charge_now/charge_full
|
||||||
capacity = sprintf( "%.1f%", capacity )
|
capacity = sprintf( "%.1f%", capacity )
|
||||||
|
|
|
@ -1,3 +1,21 @@
|
||||||
|
=====================================================================================
|
||||||
|
Version: 2.3.32
|
||||||
|
Patch Version: 00
|
||||||
|
Script Date: 2017-08-03
|
||||||
|
-----------------------------------
|
||||||
|
Changes:
|
||||||
|
-----------------------------------
|
||||||
|
New version, new tarball. This closes issue #118, inxi had failed all along to handle
|
||||||
|
the conversion from mA hours to Wh, and had a math glitch too for charge (ma).
|
||||||
|
|
||||||
|
Not sure how this went undetected during testing, oh well. I assume that mA h is not
|
||||||
|
as common internally as Wh or something.
|
||||||
|
|
||||||
|
Anyway, it should be fixed.
|
||||||
|
|
||||||
|
-----------------------------------
|
||||||
|
-- Harald Hope - Thu, 03 Aug 2017 21:44:13 -0700
|
||||||
|
|
||||||
=====================================================================================
|
=====================================================================================
|
||||||
Version: 2.3.31
|
Version: 2.3.31
|
||||||
Patch Version: 00
|
Patch Version: 00
|
||||||
|
|
Loading…
Reference in a new issue