PDA

View Full Version : Bug with systeminfo



bird12358
26th January 2014, 10:28
Hello,

I would like to know the remaining capacity of my computer battery. So I install the Mobility module named systeminfo.
I use it on ubuntu 12.04 (Qt 4.8.4). I compile the example given in the module.
On the battery part, all the informations is at 0 or -1. I thought I had to be as root to get the informations.
Unfortunatly this is not the cause of the problem.

Do I have to install an other module or a package on ubuntu to be able to get informations?

Best regard

nix
26th January 2014, 15:39
I got this problem too on a debian testing.

I made it work by building my own version from the source.

This is how I understand this issue : according to .pro file of systemInfo all platforms except meego do not use upower for battery information but HAL or a proc/acpi deprecated entry...
But my computer doesn't use HAL which has been replaced by upower some time ago and does not have the proc/acpi entry for the battery.

So inside the source I changed the systeminfo.pro from


contains(CONFIG,meego): {
SOURCES += linux/qdevicekitservice_linux.cpp
HEADERS += linux/qdevicekitservice_linux_p.h
} else {
DEFINES += QT_NO_UDISKS QT_NO_UPOWER
!contains(QT_CONFIG,embedded):!contains(QT_CONFIG, qpa): LIBS += -lX11 -lXrandr
}

to


SOURCES += linux/qdevicekitservice_linux.cpp
HEADERS += linux/qdevicekitservice_linux_p.h
!contains(CONFIG,meego): {
#DEFINES += QT_NO_UDISKS QT_NO_UPOWER
!contains(QT_CONFIG,embedded):!contains(QT_CONFIG, qpa): LIBS += -lX11 -lXrandr
}


Rebuild and use it instead of the package lib, it works fine for me.

bird12358
26th January 2014, 17:06
Thank you for the answer.
But in my systeminfo.pro file there is not that sentence:

DEFINES += QT_NO_UDISKS QT_NO_UPOWER

I can put you my systeminfo.pro file :


TEMPLATE = lib
TARGET = QtSystemInfo
QT += network gui

include(../../common.pri)

# Input
PUBLIC_HEADERS += \
qsysteminfo.h \
qsystemgeneralinfo.h \
qsystemdeviceinfo.h \
qsystemdisplayinfo.h \
qsystemnetworkinfo.h \
qsystemscreensaver.h \
qsystemstorageinfo.h \
qsystembatteryinfo.h \
qsystemalignedtimer.h

SOURCES += \
qsystemgeneralinfo.cpp \
qsystemdeviceinfo.cpp \
qsystemdisplayinfo.cpp \
qsystemnetworkinfo.cpp \
qsystemscreensaver.cpp \
qsystemstorageinfo.cpp \
qsystembatteryinfo.cpp \
qsystemalignedtimer.cpp

PRIVATE_HEADERS += qsysteminfocommon_p.h

DEFINES += QT_MAKEDLL QT_BUILD_SYSINFO_LIB

unix:!simulator {
QT += gui
PRIVATE_HEADERS += linux/qsysteminfo_dbus_p.h

contains(build_unit_tests, yes):contains(test_use_sim, yes) {

## for using simulator backend to test frontend signals
## configure with -test-sim -tests

SOURCES += qsysteminfo_simulator.cpp qsysteminfodata_simulator.cpp
HEADERS += qsysteminfo_simulator_p.h qsysteminfodata_simulator_p.h
DEFINES += TESTR QT_SIMULATOR
SOURCES += qsystemalignedtimer_stub.cpp
HEADERS += qsystemalignedtimer_stub_p.h

} else {

linux-*: {
contains(bluez_enabled, yes):DEFINES += BLUEZ_SUPPORTED

SOURCES += linux/qsysteminfo_linux_common.cpp
HEADERS += linux/qsysteminfo_linux_common_p.h

contains(blkid_enabled, yes): {
DEFINES += BLKID_SUPPORTED
LIBS += -lblkid
}

!embedded:!contains(QT_CONFIG,qpa): {
LIBS += -lX11 -lXrandr
}

contains(iphb_enabled, yes): {
SOURCES += qsystemalignedtimer_meego.cpp
HEADERS += qsystemalignedtimer_meego_p.h
PKGCONFIG += libiphb
DEFINES += ALIGNEDTIMER_MEEGO
LIBS += -liphb
} else {
SOURCES += qsystemalignedtimer_stub.cpp
HEADERS += qsystemalignedtimer_stub_p.h
}
}

!maemo5:!maemo6:linux-*: {

SOURCES += linux/qsysteminfo_linux.cpp
HEADERS += linux/qsysteminfo_linux_p.h
contains(QT_CONFIG, dbus): {
QT += dbus
SOURCES += \
linux/qhalservice_linux.cpp \
linux/qsysteminfodbushelper.cpp \
linux/qdevicekitservice_linux.cpp

HEADERS += \
linux/qhalservice_linux_p.h \
linux/qsysteminfodbushelper_p.h \
linux/qdevicekitservice_linux_p.h \
linux/qsysteminfo_dbus_p.h

contains(udev_enabled, yes): {
DEFINES += UDEV_SUPPORTED
LIBS += -ludev
SOURCES += linux/qudevservice_linux.cpp
HEADERS += linux/qudevservice_linux_p.h
}

contains(networkmanager_enabled, yes): {
SOURCES += linux/qnetworkmanagerservice_linux.cpp linux/qnmdbushelper.cpp
HEADERS += linux/qnetworkmanagerservice_linux_p.h linux/qnmdbushelper_p.h
} else {
DEFINES += QT_NO_NETWORKMANAGER
}

contains(CONFIG,meego): {
#for now... udisks
} else {
DEFINES += QT_NO_UDISKS
!embedded:!contains(QT_CONFIG,qpa): LIBS += -lX11 -lXrandr
}

contains(connman_enabled, yes): {
SOURCES+= linux/qconnmanservice_linux.cpp linux/qofonoservice_linux.cpp
HEADERS+= linux/qconnmanservice_linux_p.h linux/qofonoservice_linux_p.h
} else {
DEFINES += QT_NO_CONNMAN
}
} else {
DEFINES += QT_NO_NETWORKMANAGER QT_NO_UDISKS QT_NO_CONNMAN
!embedded:!contains(QT_CONFIG,qpa): LIBS += -lX11 -lXrandr
}
}

maemo5|maemo6: {

#Qt GConf wrapper added here until a proper place is found for it.
CONFIG += link_pkgconfig
SOURCES += qsysteminfo_maemo.cpp linux/gconfitem.cpp
HEADERS += qsysteminfo_maemo_p.h linux/gconfitem_p.h
DEFINES += QT_NO_CONNMAN QT_NO_UDISKS QT_NO_NETWORKMANAGER

contains(bme_enabled, yes): {
LIBS += -lbmeipc
DEFINES += Q_USE_BME
}

contains(QT_CONFIG,dbus): {
QT += dbus
SOURCES += linux/qhalservice_linux.cpp
HEADERS += linux/qhalservice_linux_p.h
}

PKGCONFIG += glib-2.0 gconf-2.0
CONFIG += create_pc create_prl
QMAKE_PKGCONFIG_REQUIRES = glib-2.0 gconf-2.0
pkgconfig.path = $$QT_MOBILITY_LIB/pkgconfig
pkgconfig.files = QtSystemInfo.pc
}


symbian: {
contains(S60_VERSION, 3.1) {
DEFINES += SYMBIAN_3_1
}

contains(S60_VERSION, 5.2) {
DEFINES += SYMBIAN_3_PLATFORM
}

contains(LockandFlipPSkeys_enabled, yes) {
message("LockandFlipPSKeys available")
DEFINES += LOCKANDFLIP_SUPPORTED
SOURCES += lockandflipstatus_s60.cpp
HEADERS += lockandflipstatus_s60.h
}

contains(FmTxClient_enabled, yes) {
message("FmTxClient available")
DEFINES += FMTXCLIENT_SUPPORTED
LIBS += -lhwrmfmtxclient
}

contains(DiskNotifyClient_enabled, yes) {
message("DiskNotiferClient available")
DEFINES += DISKNOTIFY_SUPPORTED
LIBS += -ldisknotifyhandler
SOURCES += storagedisknotifier_s60.cpp
HEADERS += storagedisknotifier_s60.h
}

contains(hb_symbian_enabled, yes) {
## for symbian ^4
CONFIG += qt hb
DEFINES += HB_SUPPORTED
message("s60_HbKeymap enabled")
LIBS += -lhbcore
} else {
LIBS += -lptiengine
}

contains(symbianflextimer_tenabled, yes) { #disabled until test crash is fixed
message("SymbianFlexTimer enabled")
SOURCES += qsystemalignedtimer_symbian.cpp heartbeattimer_s60.cpp
HEADERS += qsystemalignedtimer_symbian_p.h heartbeattimer_s60.h
DEFINES += ALIGNEDTIMER_SYMBIAN
LIBS += -lflextimerclient
} else {
SOURCES += qsystemalignedtimer_stub.cpp
HEADERS += qsystemalignedtimer_stub_p.h
}

INCLUDEPATH += $$APP_LAYER_SYSTEMINCLUDE
DEPENDPATH += symbian

SOURCES += \
qsysteminfo_s60.cpp \
telephonyinfo_s60.cpp \
chargingstatus_s60.cpp \
wlaninfo_s60.cpp \
storagestatus_s60.cpp \
pubandsubkey_s60.cpp \
batterystatus_s60.cpp \
networkinfo_s60.cpp

HEADERS += \
qsysteminfo_s60_p.h \
telephonyinfo_s60.h \
chargingstatus_s60.h \
wlaninfo_s60.h \
storagestatus_s60.h \
pubandsubkey_s60.h \
batterystatus_s60.h \
networkinfo_s60.h

LIBS += \
-lprofileengine \
-letel3rdparty \
-lsysutil \
-lcentralrepository \
-lcenrepnotifhandler \
-lefsrv \
-lfeatdiscovery \
-lhwrmvibraclient \
-lavkon \ #Used by AknLayoutUtils::PenEnabled(). Try to remove this dependency.
-lcone \
-lws32 \
-lcentralrepository \
-lbluetooth \
-lgdi \
-lecom \
-lplatformenv \
-lhwrmlightclient \
-letel

contains(S60_VERSION, 5.1) | contains(S60_VERSION, 5.2) {
LIBS += -lhwrmpowerclient -lusbman
}

contains(symbiancntsim_enabled, yes) {
LIBS += -letelmm
DEFINES += ETELMM_SUPPORTED
message("ETELMM enabled")
}

contains(etelpacketservice_symbian_enabled, yes) {
message("etel packet service enabled")
LIBS += -letelpckt
DEFINES += ETELPACKETSERVICE_SUPPORTED
}

contains(thermalstatus_symbian_enabled, yes) {
DEFINES += THERMALSTATUS_SUPPORTED
SOURCES += thermalstatus_s60.cpp
HEADERS += thermalstatus_s60.h
message("Thermalstatus enabled")
}

TARGET.CAPABILITY = ALL -TCB
# TARGET.CAPABILITY = LocalServices NetworkServices ReadUserData UserEnvironment Location ReadDeviceData TrustedUI

TARGET.EPOCALLOWDLLDATA = 1
TARGET.UID3 = 0x2002ac7d

QtSystemInfoDeployment.sources = QtSystemInfo.dll
QtSystemInfoDeployment.path = /sys/bin
DEPLOYMENT += QtSystemInfoDeployment
}
}
}

HEADERS += $$PUBLIC_HEADERS
CONFIG += middleware
include (../../features/deploy.pri)


I tried different modifications but I still don't have battery informations.:crying:

nix
26th January 2014, 17:23
Yes, your .pro has been fixed. Where did you get it? I download mine from https://qt.gitorious.org/qt-mobility/qt-mobility/source/23a410b9ce252e966ac2775e34f3cb1887d74614:

Did upower work fine on you computer?
Try :
upower -e , it gives me, 2 results : */line_power_AC0 and */battery_BAT0
upower -i with the complete line containing battery from the previous command, this should give you a lot of information about your battery.

If it works fine, I have no idea why systeminfo cannot read them. Maybe you can try the way i do, by compiling the library in debug mode and the example too and go step by step with gdb to find out where an error occurs.

bird12358
26th January 2014, 17:45
Unfortunatly upower -i seems to work fine ...

vendor: SONYCorp
model: AS10D41
serial: 1097
power supply: yes
updated: dim. 26 janv. 2014 18:44:13 CET (18 seconds ago)
has history: yes
has statistics: yes
battery
present: yes
rechargeable: yes
state: charging
energy: 22,3776 Wh
energy-empty: 0 Wh
energy-full: 39,744 Wh
energy-full-design: 47,52 Wh
energy-rate: 32,1192 W
voltage: 11,769 V
time to full: 32,4 minutes
percentage: 56,3043%
capacity: 83,6364%
technology: lithium-ion
History (charge):
1390758253 56,304 charging
1390758223 55,598 charging
1390758193 54,864 charging
1390758163 54,158 charging
History (rate):
1390758253 32,119 charging
1390758193 32,108 charging



So I would like to compile in debug mode, how can I compile the projet and the src in debug mode?

nix
26th January 2014, 17:52
Another idea, are you sure you are really using the right library? Check the library you are using with ldd qsysinfo, it should point to the built lib and not the package one.

For debug mode, I open both .pro file with qtcreator and build in debug. I use LD_LIBRARY_PATH to force the example binary to use the right library.

bird12358
26th January 2014, 18:35
Here is what I get from the ldd command:

linux-gate.so.1 => (0xb7729000)
libQtSystemInfo.so.1 => /home/xavier/QtSDK/QtMobility/install/lib/libQtSystemInfo.so.1 (0xb76c0000)
libQtGui.so.4 => /usr/lib/i386-linux-gnu/libQtGui.so.4 (0xb6bcd000)
libQtNetwork.so.4 => /usr/lib/i386-linux-gnu/libQtNetwork.so.4 (0xb6a7f000)
libQtCore.so.4 => /usr/lib/i386-linux-gnu/libQtCore.so.4 (0xb67a2000)
libstdc++.so.6 => /usr/lib/i386-linux-gnu/libstdc++.so.6 (0xb66bd000)
libm.so.6 => /lib/i386-linux-gnu/libm.so.6 (0xb6691000)
libgcc_s.so.1 => /lib/i386-linux-gnu/libgcc_s.so.1 (0xb6673000)
libc.so.6 => /lib/i386-linux-gnu/libc.so.6 (0xb64c8000)
libX11.so.6 => /usr/lib/i386-linux-gnu/libX11.so.6 (0xb6394000)
libXrandr.so.2 => /usr/lib/i386-linux-gnu/libXrandr.so.2 (0xb638b000)
libQtDBus.so.4 => /usr/lib/i386-linux-gnu/libQtDBus.so.4 (0xb630b000)
libpthread.so.0 => /lib/i386-linux-gnu/libpthread.so.0 (0xb62f0000)
libfontconfig.so.1 => /usr/lib/i386-linux-gnu/libfontconfig.so.1 (0xb62bb000)
libaudio.so.2 => /usr/lib/i386-linux-gnu/libaudio.so.2 (0xb62a2000)
libglib-2.0.so.0 => /lib/i386-linux-gnu/libglib-2.0.so.0 (0xb61a9000)
libpng12.so.0 => /lib/i386-linux-gnu/libpng12.so.0 (0xb617f000)
libz.so.1 => /lib/i386-linux-gnu/libz.so.1 (0xb6169000)
libfreetype.so.6 => /usr/lib/i386-linux-gnu/libfreetype.so.6 (0xb60ce000)
libgobject-2.0.so.0 => /usr/lib/i386-linux-gnu/libgobject-2.0.so.0 (0xb607f000)
libSM.so.6 => /usr/lib/i386-linux-gnu/libSM.so.6 (0xb6076000)
libICE.so.6 => /usr/lib/i386-linux-gnu/libICE.so.6 (0xb605c000)
libXi.so.6 => /usr/lib/i386-linux-gnu/libXi.so.6 (0xb604b000)
libXrender.so.1 => /usr/lib/i386-linux-gnu/libXrender.so.1 (0xb6040000)
libXext.so.6 => /usr/lib/i386-linux-gnu/libXext.so.6 (0xb602e000)
libdl.so.2 => /lib/i386-linux-gnu/libdl.so.2 (0xb6029000)
librt.so.1 => /lib/i386-linux-gnu/librt.so.1 (0xb6020000)
/lib/ld-linux.so.2 (0xb772a000)
libxcb.so.1 => /usr/lib/i386-linux-gnu/libxcb.so.1 (0xb5fff000)
libQtXml.so.4 => /usr/lib/i386-linux-gnu/libQtXml.so.4 (0xb5fbc000)
libdbus-1.so.3 => /lib/i386-linux-gnu/libdbus-1.so.3 (0xb5f73000)
libexpat.so.1 => /lib/i386-linux-gnu/libexpat.so.1 (0xb5f49000)
libXt.so.6 => /usr/lib/i386-linux-gnu/libXt.so.6 (0xb5eed000)
libXau.so.6 => /usr/lib/i386-linux-gnu/libXau.so.6 (0xb5ee9000)
libpcre.so.3 => /lib/i386-linux-gnu/libpcre.so.3 (0xb5eac000)
libffi.so.6 => /usr/lib/i386-linux-gnu/libffi.so.6 (0xb5ea5000)
libuuid.so.1 => /lib/i386-linux-gnu/libuuid.so.1 (0xb5e9f000)
libXdmcp.so.6 => /usr/lib/i386-linux-gnu/libXdmcp.so.6 (0xb5e98000)

What is the difference between the build lib and the package lib? The one is come from QtMobility and the other from my compilation of systeminfo module?

Added after 37 minutes:

I add the ligne in the .pro and I get that:

linux-gate.so.1 => (0xb77b5000)
libQtSystemInfo.so.1 => /home/xavier/QtSDK/QtMobility/lib/libQtSystemInfo.so.1 (0xb774c000)
libQtGui.so.4 => /usr/lib/i386-linux-gnu/libQtGui.so.4 (0xb6c59000)
libQtNetwork.so.4 => /usr/lib/i386-linux-gnu/libQtNetwork.so.4 (0xb6b0b000)
libQtCore.so.4 => /usr/lib/i386-linux-gnu/libQtCore.so.4 (0xb682e000)
libstdc++.so.6 => /usr/lib/i386-linux-gnu/libstdc++.so.6 (0xb6749000)
libm.so.6 => /lib/i386-linux-gnu/libm.so.6 (0xb671d000)
libgcc_s.so.1 => /lib/i386-linux-gnu/libgcc_s.so.1 (0xb66ff000)
libc.so.6 => /lib/i386-linux-gnu/libc.so.6 (0xb6554000)
libX11.so.6 => /usr/lib/i386-linux-gnu/libX11.so.6 (0xb6420000)
libXrandr.so.2 => /usr/lib/i386-linux-gnu/libXrandr.so.2 (0xb6417000)
libQtDBus.so.4 => /usr/lib/i386-linux-gnu/libQtDBus.so.4 (0xb6397000)
libpthread.so.0 => /lib/i386-linux-gnu/libpthread.so.0 (0xb637c000)
libfontconfig.so.1 => /usr/lib/i386-linux-gnu/libfontconfig.so.1 (0xb6347000)
libaudio.so.2 => /usr/lib/i386-linux-gnu/libaudio.so.2 (0xb632e000)
libglib-2.0.so.0 => /lib/i386-linux-gnu/libglib-2.0.so.0 (0xb6235000)
libpng12.so.0 => /lib/i386-linux-gnu/libpng12.so.0 (0xb620b000)
libz.so.1 => /lib/i386-linux-gnu/libz.so.1 (0xb61f5000)
libfreetype.so.6 => /usr/lib/i386-linux-gnu/libfreetype.so.6 (0xb615a000)
libgobject-2.0.so.0 => /usr/lib/i386-linux-gnu/libgobject-2.0.so.0 (0xb610b000)
libSM.so.6 => /usr/lib/i386-linux-gnu/libSM.so.6 (0xb6102000)
libICE.so.6 => /usr/lib/i386-linux-gnu/libICE.so.6 (0xb60e8000)
libXi.so.6 => /usr/lib/i386-linux-gnu/libXi.so.6 (0xb60d7000)
libXrender.so.1 => /usr/lib/i386-linux-gnu/libXrender.so.1 (0xb60cc000)
libXext.so.6 => /usr/lib/i386-linux-gnu/libXext.so.6 (0xb60ba000)
libdl.so.2 => /lib/i386-linux-gnu/libdl.so.2 (0xb60b5000)
librt.so.1 => /lib/i386-linux-gnu/librt.so.1 (0xb60ac000)
/lib/ld-linux.so.2 (0xb77b6000)
libxcb.so.1 => /usr/lib/i386-linux-gnu/libxcb.so.1 (0xb608b000)
libQtXml.so.4 => /usr/lib/i386-linux-gnu/libQtXml.so.4 (0xb6048000)
libdbus-1.so.3 => /lib/i386-linux-gnu/libdbus-1.so.3 (0xb5fff000)
libexpat.so.1 => /lib/i386-linux-gnu/libexpat.so.1 (0xb5fd5000)
libXt.so.6 => /usr/lib/i386-linux-gnu/libXt.so.6 (0xb5f79000)
libXau.so.6 => /usr/lib/i386-linux-gnu/libXau.so.6 (0xb5f75000)
libpcre.so.3 => /lib/i386-linux-gnu/libpcre.so.3 (0xb5f38000)
libffi.so.6 => /usr/lib/i386-linux-gnu/libffi.so.6 (0xb5f31000)
libuuid.so.1 => /lib/i386-linux-gnu/libuuid.so.1 (0xb5f2b000)
libXdmcp.so.6 => /usr/lib/i386-linux-gnu/libXdmcp.so.6 (0xb5f24000)


But I still can't see the battery informations. :(

nix
27th January 2014, 07:22
It's just we use different sources and build option, the one in the .deb package can be different too.
But according to your ldd result yours is fine.
I suggest try with a debugger and see why you are skiping upower info. Does the code managing upower info is reached, does it return an error, etc...

bird12358
27th January 2014, 10:40
When I want to put the qt in debug mode, I have that message:


Ceci ne semble pas être une compilation en mode débogage.
Mettre des points d'arrêt par nom de fichier et numéro de ligne pourrait échouer.
Section .debug_info : Non trouvé.
Section .debug_abbrev : Non trouvé.
Section .debug_line : Non trouvé.
Section .debug_str : Non trouvé.
Section .debug_loc : Non trouvé.
Section .debug_range : Non trouvé.
Section .gdb_index : Non trouvé.
Section .note.gnu.build-id : Trouvé.
Section .gnu.hash : Trouvé.
Section .gnu_debuglink : Non trouvé.


I try to install systeminfo on an other computer but I still have the same problem. Do it come from my computers or from the systeminfo module?