Skip to content

Commit

Permalink
remove proprietary libsysinfo stuff
Browse files Browse the repository at this point in the history
Change-Id: Iad21e043c67722244e069d09c08d63db779b5c60
Reviewed-by: Lorn Potter <lorn.potter@jollamobile.com>
  • Loading branch information
Lorn Potter authored and The Qt Project committed May 9, 2013
1 parent e70d494 commit fb72a05
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 62 deletions.
53 changes: 1 addition & 52 deletions src/systeminfo/linux/qdeviceinfo_linux.cpp
Expand Up @@ -71,9 +71,6 @@ QDeviceInfoPrivate::QDeviceInfoPrivate(QDeviceInfo *parent)
#if !defined(QT_NO_OFONO)
, ofonoWrapper(0)
#endif // QT_NO_OFONO
#if !defined(QT_NO_LIBSYSINFO)
, sc(0)
#endif // QT_NO_LIBSYSINFO
{
}

Expand Down Expand Up @@ -236,11 +233,7 @@ int QDeviceInfoPrivate::imeiCount()

QString QDeviceInfoPrivate::imei(int interface)
{
#if !defined(QT_NO_LIBSYSINFO)
if (imeiBuffer.size() == 0)
imeiBuffer << getSysInfoValue("/certs/npc/esn/gsm");

#elif !defined(QT_NO_OFONO)
#if !defined(QT_NO_OFONO)
if (QOfonoWrapper::isOfonoAvailable()) {
if (!ofonoWrapper)
ofonoWrapper = new QOfonoWrapper(this);
Expand All @@ -262,13 +255,9 @@ QString QDeviceInfoPrivate::imei(int interface)
QString QDeviceInfoPrivate::manufacturer()
{
if (manufacturerBuffer.isEmpty()) {
#if !defined(QT_NO_LIBSYSINFO)
manufacturerBuffer = getSysInfoValue("/component/manufacturer");
#else
QFile file(QStringLiteral("/sys/devices/virtual/dmi/id/sys_vendor"));
if (file.open(QIODevice::ReadOnly))
manufacturerBuffer = QString::fromLocal8Bit(file.readAll().simplified().data());
#endif
}

return manufacturerBuffer;
Expand All @@ -287,10 +276,6 @@ QString QDeviceInfoPrivate::model()

QString QDeviceInfoPrivate::productName()
{
#if !defined(QT_NO_LIBSYSINFO)
if (productNameBuffer.isEmpty())
productNameBuffer = getSysInfoValue("/component/product");
#else
if (productNameBuffer.isEmpty()) {
QProcess lsbRelease;
lsbRelease.start(QStringLiteral("/usr/bin/lsb_release"),
Expand All @@ -300,7 +285,6 @@ QString QDeviceInfoPrivate::productName()
productNameBuffer = buffer.section(QChar::fromLatin1('\t'), 1, 1).simplified();
}
}
#endif

return productNameBuffer;
}
Expand Down Expand Up @@ -466,39 +450,4 @@ QDeviceInfo::ThermalState QDeviceInfoPrivate::getThermalState()
return state;
}

#if !defined(QT_NO_LIBSYSINFO)
QString QDeviceInfoPrivate::getSysInfoValue(const char *component)
{
QString value;
bool componentExist = false;
if (sysinfo_init(&sc) == 0) {
char **keys = 0;
if (sysinfo_get_keys(sc, &keys) == 0) {
size_t i;
for (i = 0; keys[i]; ++i) {
if (strcmp(keys[i], component) == 0) {
componentExist = true;
break;
}
}
for (int i = 0; keys[i]; ++i) free(keys[i]);
free(keys);
}
if (componentExist) {
uint8_t *data = 0;
unsigned long size = 0;
if (sysinfo_get_value(sc, component, &data, &size) == 0) {
for (unsigned long k = 0; k < size; ++k) {
char c = data[k];
if (c >= 32 && c <= 126)
value.append(c);
}
free(data);
}
}
}
sysinfo_finish(sc);
return value;
}
#endif
QT_END_NAMESPACE
11 changes: 1 addition & 10 deletions src/systeminfo/linux/qdeviceinfo_linux_p.h
Expand Up @@ -57,10 +57,6 @@

#include <QStringList>

#if !defined(QT_NO_LIBSYSINFO)
#include <sysinfo.h>
#endif

QT_BEGIN_NAMESPACE

class QTimer;
Expand Down Expand Up @@ -104,9 +100,6 @@ private Q_SLOTS:
Q_DECLARE_PUBLIC(QDeviceInfo)
#endif

#if !defined(QT_NO_LIBSYSINFO)
QString getSysInfoValue(const char *component);
#endif
bool watchThermalState;
QDeviceInfo::ThermalState currentThermalState;
QString manufacturerBuffer;
Expand All @@ -122,9 +115,7 @@ private Q_SLOTS:
#if !defined(QT_NO_OFONO)
QOfonoWrapper *ofonoWrapper;
#endif // QT_NO_OFONO
#if !defined(QT_NO_LIBSYSINFO)
struct system_config *sc;
#endif

};

QT_END_NAMESPACE
Expand Down

0 comments on commit fb72a05

Please sign in to comment.