From 958dde6491eb90e06eafd982eced5d92a7b4da12 Mon Sep 17 00:00:00 2001 From: Nicolas Mailloux Date: Wed, 26 May 2021 08:33:40 -0400 Subject: [PATCH] Oops, UID isn't an integer... --- functions.h | 11 ++++------- reader.cpp | 7 +++---- settings.cpp | 7 +++---- 3 files changed, 10 insertions(+), 15 deletions(-) diff --git a/functions.h b/functions.h index ccdc8d3..9f4e5ae 100644 --- a/functions.h +++ b/functions.h @@ -29,7 +29,6 @@ namespace global { namespace mainwindow { namespace tabSwitcher { inline bool repaint; - inline bool appsWidgetCreated; inline bool appsWidgetSelected; inline bool settingsChooserWidgetCreated; @@ -52,6 +51,7 @@ namespace global { // https://stackoverflow.com/questions/6080853/c-multiple-definition-error-for-global-functions-in-the-header-file/20679534#20679534 namespace { QString checkconfig_str_val; + QString deviceUID; QString batt_level; int batt_level_int; bool checked_box = false; @@ -246,7 +246,7 @@ namespace { proc->start(prog, args); } } - int getUID() { + void getUID() { QString prog ("dd"); QStringList args; args << "if=/dev/mmcblk0" << "bs=512" << "skip=1" << "count=1" << "status=none"; @@ -254,11 +254,8 @@ namespace { proc->start(prog, args); proc->waitForFinished(); - QString procOutput = proc->readAllStandardOutput(); - procOutput = procOutput.left(256); - - int deviceUID = procOutput.toInt(); - return deviceUID; + deviceUID = proc->readAllStandardOutput(); + deviceUID = deviceUID.left(256); } } #endif // FUNCTIONS_H diff --git a/reader.cpp b/reader.cpp index 1c8f087..a4c8b94 100644 --- a/reader.cpp +++ b/reader.cpp @@ -766,10 +766,9 @@ void reader::on_aboutBtn_clicked() string_checkconfig_ro("/external_root/opt/isa/version"); aboutmsg.append("\n\nInkBox "); aboutmsg.append(checkconfig_str_val); - int device_uid = getUID(); - QString device_uid_qstr = QString::number(device_uid); - aboutmsg.append("\n"); - aboutmsg.append(device_uid_qstr); + getUID(); + aboutmsg.append("\nDevice UID:\n"); + aboutmsg.append(deviceUID); QMessageBox::information(this, tr("Information"), aboutmsg); } else { diff --git a/settings.cpp b/settings.cpp index 0ca55eb..c6813fc 100644 --- a/settings.cpp +++ b/settings.cpp @@ -266,10 +266,9 @@ void settings::on_aboutBtn_clicked() string_checkconfig_ro("/external_root/opt/isa/version"); aboutmsg.append("\n\nInkBox "); aboutmsg.append(checkconfig_str_val); - int device_uid = getUID(); - QString device_uid_qstr = QString::number(device_uid); - aboutmsg.append("\n"); - aboutmsg.append(device_uid_qstr); + getUID(); + aboutmsg.append("\nDevice UID:\n"); + aboutmsg.append(deviceUID); QMessageBox::information(this, tr("Information"), aboutmsg); } else {