From 11d8172a19f77852a5b6b8e6e07496fa7dcee884 Mon Sep 17 00:00:00 2001 From: vanhofen Date: Sun, 14 Mar 2021 10:08:27 +0100 Subject: [PATCH] helpers: add getBoxMode() function Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/3dc8822e9b46e897b1539476aa9b41d3deb6c35d Author: vanhofen Date: 2021-03-14 (Sun, 14 Mar 2021) Origin message was: ------------------ - helpers: add getBoxMode() function --- src/system/helpers.cpp | 23 +++++++++++++++++++++++ src/system/helpers.h | 1 + 2 files changed, 24 insertions(+) diff --git a/src/system/helpers.cpp b/src/system/helpers.cpp index 8b0cb2320..0f5b25283 100644 --- a/src/system/helpers.cpp +++ b/src/system/helpers.cpp @@ -2006,6 +2006,29 @@ bool isDigitWord(std::string str) return true; } +int getBoxMode() +{ + int boxmode = -1; + +#if BOXMODEL_HD51 || BOXMODEL_BRE2ZE4K || BOXMODEL_H7 + FILE *f = fopen("/proc/cmdline", "r"); + if (f) + { + char buf[256] = ""; + while(fgets(buf, sizeof(buf), f) != NULL) + { + if (strstr(buf, "boxmode=12") != NULL) + boxmode = 12; + else + boxmode = 1; + } + fclose(f); + } +#endif + + return boxmode; +} + int getActivePartition() { int c = -1; diff --git a/src/system/helpers.h b/src/system/helpers.h index 006868679..83df327b8 100644 --- a/src/system/helpers.h +++ b/src/system/helpers.h @@ -194,6 +194,7 @@ bool downloadUrl(std::string url, std::string file, const std::string userAgent bool isDigitWord(std::string str); +int getBoxMode(); int getActivePartition(); std::string GetSpecialName(std::string NormalName);