diff --git a/shared/liboxide/devicesettings.cpp b/shared/liboxide/devicesettings.cpp index 47870b75..308ddc77 100644 --- a/shared/liboxide/devicesettings.cpp +++ b/shared/liboxide/devicesettings.cpp @@ -322,4 +322,17 @@ namespace Oxide { } return physicalKeyboards; } + + const QString& DeviceSettings::version(){ + static QString version; + static std::once_flag flag; + std::call_once(flag, [] { + QSettings settings("/usr/share/remarkable/update.conf", QSettings::IniFormat); + version = settings.value("REMARKABLE_RELEASE_VERSION").toString(); + if (version.isEmpty()) { + qWarning() << "Failed to read version from update.conf"; + } + }); + return version; + } } diff --git a/shared/liboxide/devicesettings.h b/shared/liboxide/devicesettings.h index e7ad2e83..b8a35fb4 100644 --- a/shared/liboxide/devicesettings.h +++ b/shared/liboxide/devicesettings.h @@ -144,6 +144,11 @@ namespace Oxide{ * \return All virtual keyboard devices */ QList virtualKeyboards(); + /*! + * \brief Get the version of the OS + * \return Version string + */ + const QString& version(); private: DeviceType _deviceType; diff --git a/shared/liboxide/oxide_sentry.cpp b/shared/liboxide/oxide_sentry.cpp index 5cbf7976..79d0f912 100644 --- a/shared/liboxide/oxide_sentry.cpp +++ b/shared/liboxide/oxide_sentry.cpp @@ -38,7 +38,7 @@ void logMachineIdError(int error, QString name, QString path){ O_WARNING(path + " has the incorrect format"); }else if(error == -EPERM){ O_WARNING(path + " access denied"); - } if(error == -EINVAL){ + }else if(error == -EINVAL){ O_WARNING("Error while reading " + name + ": Buffer invalid"); }else if(error == -ENXIO){ O_WARNING("Error while reading " + name + ": No invocation ID is set"); @@ -168,7 +168,7 @@ namespace Oxide::Sentry{ sentry_value_set_by_key(user, "id", sentry_value_new_string(machineId())); sentry_set_user(user); // Setup context - std::string version = readFile("/etc/version"); + const auto version = deviceSettings.version().toStdString(); sentry_set_tag("os.version", version.c_str()); sentry_set_tag("name", name); sentry_value_t device = sentry_value_new_object();