Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
More locations for serial number.
[about] More locations for serial number. Contributes to JB#41408

Signed-off-by: Marko Saukko <marko.saukko@jolla.com>
  • Loading branch information
saukko committed Mar 22, 2018
1 parent cc76ce0 commit 60d02f5
Showing 1 changed file with 16 additions and 11 deletions.
27 changes: 16 additions & 11 deletions src/aboutsettings.cpp
Expand Up @@ -164,18 +164,23 @@ QString AboutSettings::imei() const

QString AboutSettings::serial() const
{
// XXX: For now, this is specific to the Jolla Tablet; eventually we should
// use QDeviceInfo's uniqueDeviceID(), but that does not always return the
// serial number, so this is our best bet for the short term (this will not
// show any serial number on the Phone, there we have the IMEI instead).

QFile serial_txt("/config/serial/serial.txt");
if (serial_txt.exists()) {
serial_txt.open(QIODevice::ReadOnly);
return QString::fromUtf8(serial_txt.readAll()).trimmed();
} else {
return "";
// TODO: eventually we should use QDeviceInfo's uniqueDeviceID()

QStringList serialFiles;

serialFiles
// This file is specific to the Jolla Tablet;
<< "/config/serial/serial.txt"
// Some devices have serialno in this path.
<< "/sys/firmware/devicetree/base/firmware/android/serialno";

for (const QString &serialFile : serialFiles) {
QFile serialTxt(serialFile);
if (serialTxt.exists() && serialTxt.open(QIODevice::ReadOnly))
return QString::fromUtf8(serialTxt.readAll()).trimmed();
}

return QString();
}

QString AboutSettings::operatingSystemName() const
Expand Down

0 comments on commit 60d02f5

Please sign in to comment.