fusioninventory / fusioninventory-agent

FusionInventory Agent
http://fusioninventory.org/
GNU General Public License v2.0
254 stars 126 forks source link

Enhance batteries informations #240

Closed trasher closed 6 years ago

trasher commented 7 years ago

Hello,

On my laptop, dmidecode output fro my battery is lacking many informations:

# dmidecode 3.0
Getting SMBIOS data from sysfs.
SMBIOS 2.6 present.

Handle 0x0014, DMI type 22, 26 bytes
Portable Battery
    Location: 1st Battery
    Manufacturer: TOSHIBA
    Manufacture Date: **/**/****
    Serial Number: 0000000000
    Name:       
    Design Capacity: Unknown
    Design Voltage: Unknown
    SBDS Version: Not Specified
    Maximum Error: Unknown
    SBDS Chemistry: Li-ION
    OEM-specific Information: 0x00000000

Looking a bit deeper, I've found that upower can send aditionnal (and maybe interesting) informations:

You can get a list of available "devices" using --enumerate:

# upower --enumerate                                                 
/org/freedesktop/UPower/devices/line_power_ADP1
/org/freedesktop/UPower/devices/battery_BAT1
/org/freedesktop/UPower/devices/mouse_0003o046Do1017x0006
/org/freedesktop/UPower/devices/DisplayDevice

And then get infos for a specified one:

# upower -i /org/freedesktop/UPower/devices/battery_BAT1
  native-path:          BAT1
  model:                G71C000G7210
  serial:               0
  power supply:         yes
  updated:              mar. 21 févr. 2017 10:20:29 CET (1 seconds ago)
  has history:          yes
  has statistics:       yes
  battery
    present:             yes
    rechargeable:        yes
    state:               fully-charged
    warning-level:       none
    energy:              39,264 Wh
    energy-empty:        0 Wh
    energy-full:         39,264 Wh
    energy-full-design:  51,504 Wh
    energy-rate:         0 W
    voltage:             14,8 V
    percentage:          100%
    capacity:            76,2349%
    technology:          lithium-ion
    icon-name:          'battery-full-charged-symbolic'
ddurieux commented 7 years ago

On FreeBSD, we have acpiconf -i 0 et give:

Design capacity:        7236 mAh
Last full capacity:     6880 mAh
Technology:             secondary (rechargeable)
Design voltage:         7600 mV
Capacity (warn):        723 mAh
Capacity (low):         219 mAh
Low/warn granularity:   72 mAh
Warn/full granularity:  72 mAh
Model number:           DELL 242WD6B
Serial number:          58167
Type:                   LION
OEM info:               LGC-LGC3.65
State:                  high
Remaining capacity:     100%
Remaining time:         unknown
Present rate:           1 mA (8 mW)
Present voltage:        8655 mV
wawax commented 7 years ago

looks really interesting. Let's talk about that with @devtom30 and @g-bougard :)

wawax commented 7 years ago

Might be some cluse for Mac OS X here : http://stackoverflow.com/questions/1432792/how-to-get-the-battery-life-of-mac-os-x-macbooks-programatically

devtom30 commented 7 years ago

The PR #330 contains the job for GNU/Linux upower capable systems.

Hey @ddurieux, can you please provide also dmidecode output for this machine ? Command is: dmidecode 3.0

Thanks

ddurieux commented 7 years ago
# dmidecode 3.1
Scanning /dev/mem for entry point.
SMBIOS 2.8 present.
105 structures occupying 5989 bytes.
Table at 0x000EA8E0.

Handle 0x1600, DMI type 22, 26 bytes
Portable Battery
        Location: Sys. Battery Bay
        Manufacturer: LG
        Manufacture Date: 10/28/2016
        Serial Number: E337
        Name: DELL 242WD6B
        Design Capacity: 54990 mWh
        Design Voltage: 7600 mV
        SBDS Version: 1.0
        Maximum Error: 8%
        SBDS Chemistry: LION
        OEM-specific Information: 0x00000801
g-bougard commented 6 years ago

Fixed since manual merge of #330 and #354