Xfce Forum

Sub domains
 

You are not logged in.

#1 2020-03-29 11:41:37

u666sa
Member
Registered: 2019-11-13
Posts: 43

Sensors plugin does not show battery voltage

In Ubuntu 18.04 LTS sensors plugin does not show battery voltage, however, in Fedora 31 there is battery voltage information.  I got suggestions about lm-sensors, and I did that, but on both Ubuntu and Fedora all ln-sensors does is show CPU temps. 

If I do this

upower -i /org/freedesktop/UPower/devices/battery_BAT0
  native-path:          BAT0
  vendor:               SONY
  model:                Li_Ion_4000mA
  serial:               0000
  power supply:         yes
  updated:              Вс 29 мар 2020 14:34:11 (100 seconds ago)
  has history:          yes
  has statistics:       yes
  battery
    present:             yes
    rechargeable:        yes
    state:               charging
    warning-level:       none
    energy:              28,188 Wh
    energy-empty:        0 Wh
    energy-full:         29,9808 Wh
    energy-full-design:  47,52 Wh
    energy-rate:         18,2844 W
    voltage:             12,03 V
    time to full:        5,9 minutes
    percentage:          94%
    capacity:            63,0909%
    technology:          lithium-ion
    icon-name:          'battery-full-charging-symbolic'
  History (charge):
    1585481649    94,000    charging
  History (rate):
    1585481651    18,284    charging
    1585481649    24,052    charging


Proper information is shown, however, in sensors plugin under acpi there is no option for voltage available, in Ubuntu.  In Fredora there is section for voltage.

What gives?

[url=https://imgur.com/jKWyQMm.png]
  jKWyQMm.png
[/url]

Offline

#2 2020-03-29 15:21:02

ToZ
Administrator
From: Canada
Registered: 2011-06-02
Posts: 10,950

Re: Sensors plugin does not show battery voltage

I can see it in Arch as well:
sensors.png

I looked through the Ubuntu 18.04 build log and it seems to build with all features except nvidia support enabled:

===============================================================
Build Configuration
===============================================================

The following sensor interfaces will be built into the plugin:
*  hddtemp: /usr/sbin/hddtemp (Make sure it is user-executable with UID bit set 
                      and user member of the respective group)
*  libsensors
*  /proc/acpi
*  /sys/class/power_supply

Support for libnotify will be built in.

Support for libnotify >= 0.7 will be built in.

Full debug is disabled

Do you have a "BAT0-0" sensors type?


Please remember to mark your thread [SOLVED] to make it easier for others to find
--- How To Ask For Help | FAQ | Developer Wiki  |  Community | Contribute ---

Offline

#3 2020-03-29 17:44:55

u666sa
Member
Registered: 2019-11-13
Posts: 43

Re: Sensors plugin does not show battery voltage

I don't have BAT0-0 sensor type.  But to be fair, I don't have that sensor type in Fedora 31 install either (I got another HDD so I can swap), but Fedora at least shows voltage, and Ubuntu does not. 

What can be done?

Offline

#4 2020-03-29 18:21:39

ToZ
Administrator
From: Canada
Registered: 2011-06-02
Posts: 10,950

Re: Sensors plugin does not show battery voltage

You might try creating a bug report to see what the developer says. Since it works in Arch (for me anyways) perhaps creating a launchpad bug report for Ubuntu may be the best.


Please remember to mark your thread [SOLVED] to make it easier for others to find
--- How To Ask For Help | FAQ | Developer Wiki  |  Community | Contribute ---

Offline

#5 2020-03-29 19:38:32

u666sa
Member
Registered: 2019-11-13
Posts: 43

Re: Sensors plugin does not show battery voltage

I kind of solved it here.  I downloaded latest version from git and compiled it.  Now I do have the voltage from ACPI sensor type, still no BAT0.  Perhaps there are some options in ./configure that I have to enable to get BAT0??

I do remember that in Fedora 31 when everything was installed and updated, it also showed amps.  Anyway to get amps in there as well?

Offline

#6 2020-03-29 20:07:49

ToZ
Administrator
From: Canada
Registered: 2011-06-02
Posts: 10,950

Re: Sensors plugin does not show battery voltage

u666sa wrote:

I kind of solved it here.  I downloaded latest version from git and compiled it.  Now I do have the voltage from ACPI sensor type, still no BAT0.

Is the value correct? Does it match up with the result from upower?

Perhaps there are some options in ./configure that I have to enable to get BAT0??

Can you post the output from your ./configure or ./autogen.sh command - especially the part at the end that displays the build configuration? They are enabled automatically if the supporting libraries exist.


Please remember to mark your thread [SOLVED] to make it easier for others to find
--- How To Ask For Help | FAQ | Developer Wiki  |  Community | Contribute ---

Offline

#7 2020-03-29 22:00:35

u666sa
Member
Registered: 2019-11-13
Posts: 43

Re: Sensors plugin does not show battery voltage

I tried playing with --enable-sysfsacpi and --enable-procacpi, nada.  Disabling both removes ACPI function from sensors plugin.  Funny thing is that typing sensors actually displays battery information and current.  That is from sysfsacpi since in procacpi there is no BAT0.  It used to only display coretemp, but now BAT0.  Now I wonder why there is no BAT0 in sensors plugin.

> sensors
coretemp-isa-0000
Adapter: ISA adapter
Core 0:       +53.0°C  (high = +80.0°C, crit = +90.0°C)
Core 2:       +51.0°C  (high = +80.0°C, crit = +90.0°C)

BAT0-acpi-0
Adapter: ACPI interface
in0:          12.13 V 
curr1:         0.00 A





./configure --prefix=/usr --enable-libsensors=yes --enable-hddtemp=yes --enable-netcat=yes --enable-pathchecks=yes --enable-sysfsacpi=yes --enable-xnvctrl=yes --enable-notification=yes
checking build system type... x86_64-pc-linux-gnu
checking host system type... x86_64-pc-linux-gnu
checking target system type... x86_64-pc-linux-gnu
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking whether to enable maintainer-specific portions of Makefiles... no
checking for style of include used by make... GNU
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking whether gcc understands -c and -o together... yes
checking dependency style of gcc... gcc3
checking how to run the C preprocessor... gcc -E
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking minix/config.h usability... no
checking minix/config.h presence... no
checking for minix/config.h... no
checking whether it is safe to define __EXTENSIONS__... yes
checking for library containing strerror... none required
checking for gcc... (cached) gcc
checking whether we are using the GNU C compiler... (cached) yes
checking whether gcc accepts -g... (cached) yes
checking for gcc option to accept ISO C89... (cached) none needed
checking whether gcc understands -c and -o together... (cached) yes
checking dependency style of gcc... (cached) gcc3
checking for a sed that does not truncate output... /bin/sed
checking for fgrep... /bin/grep -F
checking how to print strings... printf
checking for ld used by gcc... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... yes
checking for BSD- or MS-compatible name lister (nm)... /usr/bin/nm -B
checking the name lister (/usr/bin/nm -B) interface... BSD nm
checking whether ln -s works... yes
checking the maximum length of command line arguments... 1572864
checking how to convert x86_64-pc-linux-gnu file names to x86_64-pc-linux-gnu format... func_convert_file_noop
checking how to convert x86_64-pc-linux-gnu file names to toolchain format... func_convert_file_noop
checking for /usr/bin/ld option to reload object files... -r
checking for objdump... objdump
checking how to recognize dependent libraries... pass_all
checking for dlltool... no
checking how to associate runtime and link libraries... printf %s\n
checking for ar... ar
checking for archiver @FILE support... @
checking for strip... strip
checking for ranlib... ranlib
checking command to parse /usr/bin/nm -B output from gcc object... ok
checking for sysroot... no
checking for a working dd... /bin/dd
checking how to truncate binary pipes... /bin/dd bs=4096 count=1
checking for mt... mt
checking if mt is a manifest tool... no
checking for dlfcn.h... yes
checking for objdir... .libs
checking if gcc supports -fno-rtti -fno-exceptions... no
checking for gcc option to produce PIC... -fPIC -DPIC
checking if gcc PIC flag -fPIC -DPIC works... yes
checking if gcc static flag -static works... yes
checking if gcc supports -c -o file.o... yes
checking if gcc supports -c -o file.o... (cached) yes
checking whether the gcc linker (/usr/bin/ld -m elf_x86_64) supports shared libraries... yes
checking whether -lc should be explicitly linked in... no
checking dynamic linker characteristics... GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... no
checking whether NLS is requested... yes
checking for intltool >= 0.35.0... 0.51.0 found
checking for intltool-update... /usr/bin/intltool-update
checking for intltool-merge... /usr/bin/intltool-merge
checking for intltool-extract... /usr/bin/intltool-extract
checking for xgettext... /usr/bin/xgettext
checking for msgmerge... /usr/bin/msgmerge
checking for msgfmt... /usr/bin/msgfmt
checking for gmsgfmt... /usr/bin/msgfmt
checking for perl... /usr/bin/perl
checking for perl >= 5.8.1... 5.26.1
checking for XML::Parser... ok
checking for ANSI C header files... (cached) yes
checking for hddtemp path... /usr/sbin/hddtemp
checking for netcat path... /bin/netcat
checking for hddtemp being queryable via netcat... 
checking for /proc/acpi/info... no
checking for gethostname... yes
checking for memset... yes
checking for socket... yes
checking for strstr... yes
checking for malloc... yes
checking for bzero... yes
checking arpa/inet.h usability... yes
checking arpa/inet.h presence... yes
checking for arpa/inet.h... yes
checking netinet/in.h usability... yes
checking netinet/in.h presence... yes
checking for netinet/in.h... yes
checking for stdlib.h... (cached) yes
checking for string.h... (cached) yes
checking sys/ioctl.h usability... yes
checking sys/ioctl.h presence... yes
checking for sys/ioctl.h... yes
checking sys/param.h usability... yes
checking sys/param.h presence... yes
checking for sys/param.h... yes
checking sys/socket.h usability... yes
checking sys/socket.h presence... yes
checking for sys/socket.h... yes
checking sys/time.h usability... yes
checking sys/time.h presence... yes
checking for sys/time.h... yes
checking for unistd.h... (cached) yes
checking sys/sockio.h usability... no
checking sys/sockio.h presence... no
checking for sys/sockio.h... no
checking for sys/wait.h that is POSIX.1 compatible... yes
checking whether gcc needs -traditional... no
checking for size_t... yes
checking for kstat_open in -lkstat... no
checking for kstat_open in -lnsl... no
checking for ceilf in -lm... yes
checking for pkg-config... /usr/bin/pkg-config
checking pkg-config is at least version 0.9.0... yes
checking for gtk+-3.0 >= 3.20.0... 3.22.30
checking GTK_CFLAGS... -pthread -I/usr/include/gtk-3.0 -I/usr/include/at-spi2-atk/2.0 -I/usr/include/at-spi-2.0 -I/usr/include/dbus-1.0 -I/usr/lib/x86_64-linux-gnu/dbus-1.0/include -I/usr/include/gtk-3.0 -I/usr/include/gio-unix-2.0/ -I/usr/include/cairo -I/usr/include/pango-1.0 -I/usr/include/harfbuzz -I/usr/include/pango-1.0 -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/libpng16 -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include
checking GTK_LIBS... -lgtk-3 -lgdk-3 -lpangocairo-1.0 -lpango-1.0 -latk-1.0 -lcairo-gobject -lcairo -lgdk_pixbuf-2.0 -lgio-2.0 -lgobject-2.0 -lglib-2.0
checking for pkg-config... (cached) /usr/bin/pkg-config
checking pkg-config is at least version 0.9.0... yes
checking for glib-2.0 >= 2.6.0... 2.56.4
checking GLIB_CFLAGS... -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include
checking GLIB_LIBS... -lglib-2.0
checking for pkg-config... (cached) /usr/bin/pkg-config
checking pkg-config is at least version 0.9.0... yes
checking for libnotify >= 0.4... 0.7.7
checking LIBNOTIFY4_CFLAGS... -pthread -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/libpng16 -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include
checking LIBNOTIFY4_LIBS... -lnotify -lgdk_pixbuf-2.0 -lgio-2.0 -lgobject-2.0 -lglib-2.0
checking for pkg-config... (cached) /usr/bin/pkg-config
checking pkg-config is at least version 0.9.0... yes
checking for libnotify >= 0.7... 0.7.7
checking LIBNOTIFY7_CFLAGS... -pthread -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/libpng16 -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include
checking LIBNOTIFY7_LIBS... -lnotify -lgdk_pixbuf-2.0 -lgio-2.0 -lgobject-2.0 -lglib-2.0
checking for pkg-config... (cached) /usr/bin/pkg-config
checking pkg-config is at least version 0.9.0... yes
checking for libxfce4ui-2 >= 4.12.0... 4.14.1
checking LIBXFCE4UI_CFLAGS... -pthread -I/usr/include/xfce4/libxfce4ui-2 -I/usr/include/gtk-3.0 -I/usr/include/at-spi2-atk/2.0 -I/usr/include/at-spi-2.0 -I/usr/include/dbus-1.0 -I/usr/lib/x86_64-linux-gnu/dbus-1.0/include -I/usr/include/gtk-3.0 -I/usr/include/gio-unix-2.0/ -I/usr/include/cairo -I/usr/include/pango-1.0 -I/usr/include/harfbuzz -I/usr/include/pango-1.0 -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/libpng16 -I/usr/include/xfce4 -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include
checking LIBXFCE4UI_LIBS... -lxfce4ui-2 -lgtk-3 -lgdk-3 -lpangocairo-1.0 -lpango-1.0 -latk-1.0 -lcairo-gobject -lcairo -lgdk_pixbuf-2.0 -lgio-2.0 -lgobject-2.0 -lxfce4util -lglib-2.0
checking for pkg-config... (cached) /usr/bin/pkg-config
checking pkg-config is at least version 0.9.0... yes
checking for libxfce4panel-2.0 >= 4.12.0... 4.14.3
checking LIBXFCE4PANEL_CFLAGS... -pthread -I/usr/include/xfce4/libxfce4panel-2.0 -I/usr/include/gtk-3.0 -I/usr/include/at-spi2-atk/2.0 -I/usr/include/at-spi-2.0 -I/usr/include/dbus-1.0 -I/usr/lib/x86_64-linux-gnu/dbus-1.0/include -I/usr/include/gtk-3.0 -I/usr/include/gio-unix-2.0/ -I/usr/include/cairo -I/usr/include/pango-1.0 -I/usr/include/harfbuzz -I/usr/include/pango-1.0 -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/libpng16 -I/usr/include/xfce4 -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include
checking LIBXFCE4PANEL_LIBS... -lxfce4panel-2.0 -lgtk-3 -lgdk-3 -lpangocairo-1.0 -lpango-1.0 -latk-1.0 -lcairo-gobject -lcairo -lgdk_pixbuf-2.0 -lgio-2.0 -lgobject-2.0 -Wl,--export-dynamic -lgmodule-2.0 -pthread -lxfce4util -lglib-2.0
checking locale.h usability... yes
checking locale.h presence... yes
checking for locale.h... yes
checking for LC_MESSAGES... yes
checking for CFPreferencesCopyAppValue... no
checking for CFLocaleCopyCurrent... no
checking libintl.h usability... yes
checking libintl.h presence... yes
checking for libintl.h... yes
checking for ngettext in libc... yes
checking for dgettext in libc... yes
checking for bind_textdomain_codeset... yes
checking for msgfmt... (cached) /usr/bin/msgfmt
checking for dcgettext... yes
checking if msgfmt accepts -c... yes
checking for gmsgfmt... (cached) /usr/bin/msgfmt
checking for xgettext... (cached) /usr/bin/xgettext
checking for catalogs to be installed...  ar ast be bg ca cs da de el en_AU en_GB es eu fi fr gl he hr hu hy_AM id ie is it ja ko lt lv ms nb nl oc pl pt_BR pt ru sk sl sq sr sv th tr ug uk ur_PK ur vi zh_CN zh_TW
checking for bind_textdomain_codeset... (cached) yes
checking for locales directory... ${datarootdir}/locale
checking for additional xgettext flags... --keyword=Q_ --from-code=UTF-8
checking whether to build with debugging support... minimum
checking PLATFORM_LDFLAGS... 
checking that generated files are newer than configure... done
configure: creating ./config.status
config.status: creating Makefile
config.status: creating xfce4-sensors-plugin.spec
config.status: creating src/xfce4-sensors.1
config.status: creating include/Makefile
config.status: creating lib/Makefile
config.status: creating lib/libxfce4sensors-1.0.pc
config.status: creating panel-plugin/Makefile
config.status: creating src/Makefile
config.status: creating icons/Makefile
config.status: creating po/Makefile.in
config.status: creating config.h
config.status: executing depfiles commands
config.status: executing libtool commands
config.status: executing default-1 commands
config.status: executing po/stamp-it commands

===============================================================
Build Configuration
===============================================================

The following sensor interfaces will be built into the plugin:
*  hddtemp: /usr/sbin/hddtemp (Make sure it is user-executable with UID bit set 
                      and user member of the respective group)
*  libsensors
*  /proc/acpi
*  /sys/class/power_supply
*  NVIDIA X CTRL

Support for libnotify will be built in.

Support for libnotify >= 0.7 will be built in.

Full debug is disabled

Offline

#8 2020-03-29 22:32:51

ToZ
Administrator
From: Canada
Registered: 2011-06-02
Posts: 10,950

Re: Sensors plugin does not show battery voltage

Try building with "--enable-debug" and "--disable-xnvctrl" (it errors out if this component is built). Then run "xfce4-sensors" in a terminal and post back the DBG statements. There might be something in there. I can see:

DBG[acpi.c:262] get_battery_zone_value(): str_filename=/sys/class//power_supply/BAT0/energy_now

DBG[acpi.c:617] get_voltage_zone_value(): str_filename=/sys/class//power_supply/BAT0/voltage_now

... in mine.


Please remember to mark your thread [SOLVED] to make it easier for others to find
--- How To Ask For Help | FAQ | Developer Wiki  |  Community | Contribute ---

Offline

#9 2020-03-30 05:59:56

u666sa
Member
Registered: 2019-11-13
Posts: 43

Re: Sensors plugin does not show battery voltage

 ~/Desktop/xfce4-sensors-plugin   master  xfce4-sensors
Gtk-Message: 08:54:40.234: Failed to load module "appmenu-gtk-module"
DBG[hddtemp.c:560] get_hddtemp_value(): Exit code 0 on /dev/sdb with stdout of 0
.

DBG[hddtemp.c:623] get_hddtemp_value(): got the only useful return value of 0 and value of 0
.

DBG[hddtemp.c:560] get_hddtemp_value(): Exit code 0 on /dev/sda with stdout of 35
.

DBG[hddtemp.c:623] get_hddtemp_value(): got the only useful return value of 0 and value of 35
.

DBG[hddtemp.c:425] initialize_hddtemp(): numfeatures=2

DBG[acpi.c:330] read_battery_zone(): str_filename=/sys/class//power_supply/BAT0/model_name

DBG[acpi.c:347] read_battery_zone(): Name=Li_Ion_4000mA 

DBG[acpi.c:384] read_battery_zone(): Min-Value=0,000000

DBG[acpi.c:463] get_battery_max_value(): str_pathtofile=/sys/class//power_supply/BAT0/energy_full

DBG[acpi.c:617] get_voltage_zone_value(): str_filename=/sys/class//power_supply/BAT0/voltage_now

Gtk-Message: 08:54:41.201: GtkDialog mapped without a transient parent. This is discouraged.
DBG[hddtemp.c:560] get_hddtemp_value(): Exit code 0 on /dev/sdb with stdout of 0
.

DBG[hddtemp.c:623] get_hddtemp_value(): got the only useful return value of 0 and value of 0
.

DBG[hddtemp.c:560] get_hddtemp_value(): Exit code 0 on /dev/sda with stdout of 35
.

DBG[hddtemp.c:623] get_hddtemp_value(): got the only useful return value of 0 and value of 35
.

DBG[acpi.c:262] get_battery_zone_value(): str_filename=/sys/class//power_supply/BAT0/energy_now

DBG[acpi.c:617] get_voltage_zone_value(): str_filename=/sys/class//power_supply/BAT0/voltage_now

DBG[sensors-interface.c:184] add_type_box(): index: 0, chip: 0xb9e0a0

DBG[hddtemp.c:560] get_hddtemp_value(): Exit code 0 on /dev/sdb with stdout of 0
.

DBG[hddtemp.c:623] get_hddtemp_value(): got the only useful return value of 0 and value of 0
.

DBG[hddtemp.c:560] get_hddtemp_value(): Exit code 0 on /dev/sda with stdout of 35
.

DBG[hddtemp.c:623] get_hddtemp_value(): got the only useful return value of 0 and value of 35
.

DBG[acpi.c:262] get_battery_zone_value(): str_filename=/sys/class//power_supply/BAT0/energy_now

DBG[acpi.c:617] get_voltage_zone_value(): str_filename=/sys/class//power_supply/BAT0/voltage_now

DBG[hddtemp.c:560] get_hddtemp_value(): Exit code 0 on /dev/sdb with stdout of 0
.

DBG[hddtemp.c:623] get_hddtemp_value(): got the only useful return value of 0 and value of 0
.

DBG[hddtemp.c:560] get_hddtemp_value(): Exit code 0 on /dev/sda with stdout of 35
.

DBG[hddtemp.c:623] get_hddtemp_value(): got the only useful return value of 0 and value of 35
.

DBG[acpi.c:262] get_battery_zone_value(): str_filename=/sys/class//power_supply/BAT0/energy_now

DBG[acpi.c:617] get_voltage_zone_value(): str_filename=/sys/class//power_supply/BAT0/voltage_now

DBG[actions.c:143] refresh_tacho_view(): using max cols/rows: 5/4.
DBG[callbacks.c:201] list_cell_toggle_(): toggle item is 1.
DBG[hddtemp.c:560] get_hddtemp_value(): Exit code 0 on /dev/sdb with stdout of 0
.

DBG[hddtemp.c:623] get_hddtemp_value(): got the only useful return value of 0 and value of 0
.

DBG[hddtemp.c:560] get_hddtemp_value(): Exit code 0 on /dev/sda with stdout of 35
.

DBG[hddtemp.c:623] get_hddtemp_value(): got the only useful return value of 0 and value of 35
.

DBG[acpi.c:262] get_battery_zone_value(): str_filename=/sys/class//power_supply/BAT0/energy_now

DBG[acpi.c:617] get_voltage_zone_value(): str_filename=/sys/class//power_supply/BAT0/voltage_now

DBG[hddtemp.c:560] get_hddtemp_value(): Exit code 0 on /dev/sdb with stdout of 0
.

DBG[hddtemp.c:623] get_hddtemp_value(): got the only useful return value of 0 and value of 0
.

DBG[hddtemp.c:560] get_hddtemp_value(): Exit code 0 on /dev/sda with stdout of 35
.

DBG[hddtemp.c:623] get_hddtemp_value(): got the only useful return value of 0 and value of 35
.

DBG[acpi.c:262] get_battery_zone_value(): str_filename=/sys/class//power_supply/BAT0/energy_now

DBG[acpi.c:617] get_voltage_zone_value(): str_filename=/sys/class//power_supply/BAT0/voltage_now

DBG[actions.c:143] refresh_tacho_view(): using max cols/rows: 5/4.
DBG[actions.c:166] refresh_tacho_view(): Newly adding selected widget from container.
DBG[tacho.c:179] gtk_sensorstacho_get_request_mode(): Getting preferred mode: 1.

DBG[tacho.c:179] gtk_sensorstacho_get_request_mode(): Getting preferred mode: 1.

DBG[tacho.c:214] gtk_sensorstacho_get_preferred_height(): Returning widget preferred height: 48, 48.

DBG[tacho.c:228] gtk_sensorstacho_get_preferred_width_for_height(): Returning preferred natural width 48 for height 48.

DBG[tacho.c:179] gtk_sensorstacho_get_request_mode(): Getting preferred mode: 1.

DBG[tacho.c:214] gtk_sensorstacho_get_preferred_height(): Returning widget preferred height: 48, 48.

DBG[tacho.c:228] gtk_sensorstacho_get_preferred_width_for_height(): Returning preferred natural width 48 for height 48.

DBG[hddtemp.c:560] get_hddtemp_value(): Exit code 0 on /dev/sdb with stdout of 0
.

DBG[hddtemp.c:623] get_hddtemp_value(): got the only useful return value of 0 and value of 0
.

DBG[hddtemp.c:560] get_hddtemp_value(): Exit code 0 on /dev/sda with stdout of 35
.

DBG[hddtemp.c:623] get_hddtemp_value(): got the only useful return value of 0 and value of 35
.

DBG[acpi.c:262] get_battery_zone_value(): str_filename=/sys/class//power_supply/BAT0/energy_now

DBG[acpi.c:617] get_voltage_zone_value(): str_filename=/sys/class//power_supply/BAT0/voltage_now

DBG[hddtemp.c:560] get_hddtemp_value(): Exit code 0 on /dev/sdb with stdout of 0
.

DBG[hddtemp.c:623] get_hddtemp_value(): got the only useful return value of 0 and value of 0
.

DBG[hddtemp.c:560] get_hddtemp_value(): Exit code 0 on /dev/sda with stdout of 35
.

DBG[hddtemp.c:623] get_hddtemp_value(): got the only useful return value of 0 and value of 35
.

DBG[acpi.c:262] get_battery_zone_value(): str_filename=/sys/class//power_supply/BAT0/energy_now

DBG[acpi.c:617] get_voltage_zone_value(): str_filename=/sys/class//power_supply/BAT0/voltage_now

DBG[actions.c:143] refresh_tacho_view(): using max cols/rows: 5/4.
DBG[callbacks.c:201] list_cell_toggle_(): toggle item is 1.
DBG[hddtemp.c:560] get_hddtemp_value(): Exit code 0 on /dev/sdb with stdout of 0
.

DBG[hddtemp.c:623] get_hddtemp_value(): got the only useful return value of 0 and value of 0
.

DBG[hddtemp.c:560] get_hddtemp_value(): Exit code 0 on /dev/sda with stdout of 35
.

DBG[hddtemp.c:623] get_hddtemp_value(): got the only useful return value of 0 and value of 35
.

DBG[acpi.c:262] get_battery_zone_value(): str_filename=/sys/class//power_supply/BAT0/energy_now

DBG[acpi.c:617] get_voltage_zone_value(): str_filename=/sys/class//power_supply/BAT0/voltage_now

DBG[hddtemp.c:560] get_hddtemp_value(): Exit code 0 on /dev/sdb with stdout of 0
.

DBG[hddtemp.c:623] get_hddtemp_value(): got the only useful return value of 0 and value of 0
.

DBG[hddtemp.c:560] get_hddtemp_value(): Exit code 0 on /dev/sda with stdout of 35
.

DBG[hddtemp.c:623] get_hddtemp_value(): got the only useful return value of 0 and value of 35
.

DBG[acpi.c:262] get_battery_zone_value(): str_filename=/sys/class//power_supply/BAT0/energy_now

DBG[acpi.c:617] get_voltage_zone_value(): str_filename=/sys/class//power_supply/BAT0/voltage_now

DBG[actions.c:143] refresh_tacho_view(): using max cols/rows: 5/4.
DBG[actions.c:166] refresh_tacho_view(): Newly adding selected widget from container.
DBG[tacho.c:179] gtk_sensorstacho_get_request_mode(): Getting preferred mode: 1.

DBG[tacho.c:214] gtk_sensorstacho_get_preferred_height(): Returning widget preferred height: 48, 48.

DBG[tacho.c:228] gtk_sensorstacho_get_preferred_width_for_height(): Returning preferred natural width 48 for height 48.

DBG[tacho.c:179] gtk_sensorstacho_get_request_mode(): Getting preferred mode: 1.

DBG[tacho.c:214] gtk_sensorstacho_get_preferred_height(): Returning widget preferred height: 48, 48.

DBG[tacho.c:228] gtk_sensorstacho_get_preferred_width_for_height(): Returning preferred natural width 48 for height 48.

DBG[hdd


  Zzz4bQH.png




I did update/compile from source lm-sensors and after I did that it started showing battery info when running sensors.  Now I see that perhaps the problem is acpi.c...  Problem is whenever I search for acpi on google I'm getting information that it is build in into Linux kernel.  Is that so?  Can't I get a dev version from github and compile it?

If not, perhaps I could configure kernel somehow? 

If not, perhaps modify sensors plugin to read certain values?

Last edited by u666sa (2020-03-30 06:36:04)

Offline

#10 2020-03-30 13:56:31

ToZ
Administrator
From: Canada
Registered: 2011-06-02
Posts: 10,950

Re: Sensors plugin does not show battery voltage

DBG[acpi.c:463] get_battery_max_value(): str_pathtofile=/sys/class//power_supply/BAT0/energy_full

DBG[acpi.c:617] get_voltage_zone_value(): str_filename=/sys/class//power_supply/BAT0/voltage_now

Lets look at the code. When checking for energy_full, in acpi.c it does this:

#ifdef HAVE_SYSFS_ACPI
    str_filename = g_strdup_printf ("%s/%s/%s/%s", SYS_PATH, SYS_DIR_POWER, str_zone, SYS_FILE_ENERGY);
#else
    str_filename = g_strdup_printf ("%s/%s/%s/%s", ACPI_PATH, ACPI_DIR_BATTERY,
                                str_zone, ACPI_FILE_BATTERY_STATE);
#endif
    DBG("str_filename=%s\n", str_filename);

SYS_PATH and ACPI_PATH are defined in acpi.h:

#define ACPI_PATH               "/proc/acpi"
#define ACPI_DIR_THERMAL        "thermal_zone"
#define ACPI_DIR_BATTERY        "battery"
#define ACPI_DIR_FAN            "fan"
#define ACPI_FILE_THERMAL       "temperature"
#define ACPI_FILE_BATTERY_STATE "state"
#define ACPI_FILE_BATTERY_INFO  "info"
#define ACPI_FILE_FAN           "state"
#define ACPI_INFO               "info"

#define SYS_PATH "/sys/class/"
#define SYS_POWER_MODEL_NAME "model_name"
#define SYS_DIR_THERMAL "thermal"
#define SYS_FILE_THERMAL "temp"
#define SYS_DIR_POWER "power_supply"
#define SYS_FILE_ENERGY "energy_now"
#define SYS_FILE_ENERGY_MIN "alarm"
#define SYS_FILE_ENERGY_MAX "energy_full"
#define SYS_FILE_POWER "power_now"
#define SYS_FILE_VOLTAGE "voltage_now"
#define SYS_FILE_VOLTAGE_MIN "voltage_min_design"

In your images above, /sys/class/power_supply doesn't have an energy_now file. So is the debug output wrong? Do you have one in /proc/acpi?


Please remember to mark your thread [SOLVED] to make it easier for others to find
--- How To Ask For Help | FAQ | Developer Wiki  |  Community | Contribute ---

Offline

#11 2020-04-01 18:39:57

u666sa
Member
Registered: 2019-11-13
Posts: 43

Re: Sensors plugin does not show battery voltage

Okie doc, I did it, not a right way, but it works. 
lHFjEny.png

Firstly, I switched to my Fedora install on a trash HDD, and it did not show current right after install, I had to sudo dnf update and reboot, only then it showed current.

I dag into source and there is no class name CURRENT in acpi.c, so I assume current suppose to be taken from lmsensors.  And I do have my sensors command show BAT0 voltage and current, but xfce4-sensors is not picking it up for some reason.  Could be anything really, I have no clue.

I modified acpi.c and acpi.h and also language file ru.po (I have Russian locale) and sensors-interface-common.c.

In acpi.h SYS_FILE_ENERGY and SYS_FILE_POWER

#define SYS_PATH "/sys/class/"
#define SYS_POWER_MODEL_NAME "model_name"
#define SYS_DIR_THERMAL "thermal"
#define SYS_FILE_THERMAL "temp"
#define SYS_DIR_POWER "power_supply"
#define SYS_FILE_ENERGY "current_now" 
//"energy_now"
#define SYS_FILE_ENERGY_MIN "alarm"
#define SYS_FILE_ENERGY_MAX "energy_full"
#define SYS_FILE_POWER "current_now"
//"power_now"
#define SYS_FILE_VOLTAGE "voltage_now"
#define SYS_FILE_VOLTAGE_MIN "voltage_min_design"

in acpi.c line 671, that's just a label.  And changing last line in this snippet from POWER to CURRENT only shows proper labels but calculations are wrong.

                                                             ptr_dirent->d_name, _("Current"));
                    ptr_chipfeature->formatted_value = NULL;
                    ptr_chipfeature->raw_value = get_power_zone_value(ptr_dirent->d_name);
                    ptr_chipfeature->valid = TRUE;
                    ptr_chipfeature->min_value = 0.0;
                    ptr_chipfeature->max_value = 60.0; // a T440s charges with roughly 25 Watts
                    ptr_chipfeature->class = POWER;

In sensors-interface-common.c line 169

        case POWER:
               *dptr_str_formattedvalue = g_strdup_printf(_("%+.3f A"), val_sensorfeature);
               break;

And finally in my ru.po localization file line 338

#: ../lib/sensors-interface-common.c:170
#, c-format
msgid "%.3f W"
msgstr "%+.3f A"

It works, it's not a proper way to do it, but I like that it works, so who cares.


[url=https://imgur.com/n4KKicS.png]
  n4KKicS.png
[/url]

Last edited by u666sa (2020-04-01 18:43:21)

Offline

#12 2020-04-01 21:33:25

ToZ
Administrator
From: Canada
Registered: 2011-06-02
Posts: 10,950

Re: Sensors plugin does not show battery voltage

Maybe create a bug report and post your changes so that it can be made to the official code as well.


Please remember to mark your thread [SOLVED] to make it easier for others to find
--- How To Ask For Help | FAQ | Developer Wiki  |  Community | Contribute ---

Offline

Board footer

Powered by FluxBB