Oops, UID isn't an integer...

This commit is contained in:
Nicolas Mailloux 2021-05-26 08:33:40 -04:00
parent 8b72d91875
commit 958dde6491
3 changed files with 10 additions and 15 deletions

View file

@ -29,7 +29,6 @@ namespace global {
namespace mainwindow { namespace mainwindow {
namespace tabSwitcher { namespace tabSwitcher {
inline bool repaint; inline bool repaint;
inline bool appsWidgetCreated; inline bool appsWidgetCreated;
inline bool appsWidgetSelected; inline bool appsWidgetSelected;
inline bool settingsChooserWidgetCreated; 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 // https://stackoverflow.com/questions/6080853/c-multiple-definition-error-for-global-functions-in-the-header-file/20679534#20679534
namespace { namespace {
QString checkconfig_str_val; QString checkconfig_str_val;
QString deviceUID;
QString batt_level; QString batt_level;
int batt_level_int; int batt_level_int;
bool checked_box = false; bool checked_box = false;
@ -246,7 +246,7 @@ namespace {
proc->start(prog, args); proc->start(prog, args);
} }
} }
int getUID() { void getUID() {
QString prog ("dd"); QString prog ("dd");
QStringList args; QStringList args;
args << "if=/dev/mmcblk0" << "bs=512" << "skip=1" << "count=1" << "status=none"; args << "if=/dev/mmcblk0" << "bs=512" << "skip=1" << "count=1" << "status=none";
@ -254,11 +254,8 @@ namespace {
proc->start(prog, args); proc->start(prog, args);
proc->waitForFinished(); proc->waitForFinished();
QString procOutput = proc->readAllStandardOutput(); deviceUID = proc->readAllStandardOutput();
procOutput = procOutput.left(256); deviceUID = deviceUID.left(256);
int deviceUID = procOutput.toInt();
return deviceUID;
} }
} }
#endif // FUNCTIONS_H #endif // FUNCTIONS_H

View file

@ -766,10 +766,9 @@ void reader::on_aboutBtn_clicked()
string_checkconfig_ro("/external_root/opt/isa/version"); string_checkconfig_ro("/external_root/opt/isa/version");
aboutmsg.append("\n\nInkBox "); aboutmsg.append("\n\nInkBox ");
aboutmsg.append(checkconfig_str_val); aboutmsg.append(checkconfig_str_val);
int device_uid = getUID(); getUID();
QString device_uid_qstr = QString::number(device_uid); aboutmsg.append("\nDevice UID:\n");
aboutmsg.append("\n"); aboutmsg.append(deviceUID);
aboutmsg.append(device_uid_qstr);
QMessageBox::information(this, tr("Information"), aboutmsg); QMessageBox::information(this, tr("Information"), aboutmsg);
} }
else { else {

View file

@ -266,10 +266,9 @@ void settings::on_aboutBtn_clicked()
string_checkconfig_ro("/external_root/opt/isa/version"); string_checkconfig_ro("/external_root/opt/isa/version");
aboutmsg.append("\n\nInkBox "); aboutmsg.append("\n\nInkBox ");
aboutmsg.append(checkconfig_str_val); aboutmsg.append(checkconfig_str_val);
int device_uid = getUID(); getUID();
QString device_uid_qstr = QString::number(device_uid); aboutmsg.append("\nDevice UID:\n");
aboutmsg.append("\n"); aboutmsg.append(deviceUID);
aboutmsg.append(device_uid_qstr);
QMessageBox::information(this, tr("Information"), aboutmsg); QMessageBox::information(this, tr("Information"), aboutmsg);
} }
else { else {