From 26e8712f902592f96aae9cbc1fe889e9e9085a20 Mon Sep 17 00:00:00 2001 From: vanhofen Date: Wed, 13 Sep 2017 16:35:52 +0200 Subject: [PATCH 01/38] - parentallock_setup: fix compiler warning; remove easymenu leftover --- src/gui/parentallock_setup.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/gui/parentallock_setup.cpp b/src/gui/parentallock_setup.cpp index 1c77e3800..1fb1f4dc4 100644 --- a/src/gui/parentallock_setup.cpp +++ b/src/gui/parentallock_setup.cpp @@ -109,7 +109,6 @@ int CParentalSetup::showParentalSetup() plock->addIntroItems(); CMenuForwarder * mf; - CPersonalizeGui &p = CNeutrinoApp::getInstance()->getPersonalizeGui(); CMenuOptionChooser * mc; mc = new CMenuOptionChooser(LOCALE_PARENTALLOCK_PROMPT , &g_settings.parentallock_prompt , PARENTALLOCK_PROMPT_OPTIONS, PARENTALLOCK_PROMPT_OPTION_COUNT , !parentallocked); From d30bd0ea268eb0effa680c20afb392d6576f9420 Mon Sep 17 00:00:00 2001 From: Jacek Jendrzej Date: Thu, 14 Sep 2017 11:17:36 +0200 Subject: [PATCH 02/38] src/driver/screenshot.cpp avoid memory ranges overlap --- src/driver/screenshot.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/driver/screenshot.cpp b/src/driver/screenshot.cpp index 1ad99fe01..28366adc2 100644 --- a/src/driver/screenshot.cpp +++ b/src/driver/screenshot.cpp @@ -393,7 +393,7 @@ bool CScreenShot::SaveJpg() int xres2 = xres1+2; for (int x = 0; x < xres; x++) { int x2 = x*3; - memcpy(pixel_data + x2 + xres1, pixel_data + x*4 + y*xres*4, 3); + memmove(pixel_data + x2 + xres1, pixel_data + x*4 + y*xres*4, 3); SWAP(pixel_data[x2 + xres1], pixel_data[x2 + xres2]); } } From 513850f9157613f867d472508dc5d117f39b043e Mon Sep 17 00:00:00 2001 From: Jacek Jendrzej Date: Thu, 14 Sep 2017 12:09:40 +0200 Subject: [PATCH 03/38] try to fix tm thread --- src/gui/components/cc_timer.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/gui/components/cc_timer.cpp b/src/gui/components/cc_timer.cpp index 5f32adf2d..a54c9bfc1 100644 --- a/src/gui/components/cc_timer.cpp +++ b/src/gui/components/cc_timer.cpp @@ -43,11 +43,11 @@ CComponentsTimer::CComponentsTimer(const int& interval, bool is_nano) tm_thread = 0; tm_interval = interval; tm_enable_nano = is_nano; - + tm_enable = false; sl_stop_timer = sigc::mem_fun(*this, &CComponentsTimer::stopTimer); if (interval > 0) - startTimer(); + tm_enable = startTimer(); } CComponentsTimer::~CComponentsTimer() @@ -132,12 +132,11 @@ void CComponentsTimer::stopThread() bool CComponentsTimer::startTimer() { - tm_enable = true; initThread(); if(tm_thread) - return true; + tm_enable = true; - return false; + return tm_enable; } bool CComponentsTimer::stopTimer() From 43c7e0ed0992c0fd0d6a473312ed5533f2e641af Mon Sep 17 00:00:00 2001 From: svenhoefer Date: Thu, 11 Aug 2016 13:52:49 +0200 Subject: [PATCH 04/38] helpers.chh/h: add some helper functions Partial cherry pick from: https://bitbucket.org/neutrino-images/ni-neutrino-hd Signed-off-by: Thilo Graf --- src/system/helpers.cpp | 108 +++++++++++++++++++++++++++++++++++++++++ src/system/helpers.h | 5 ++ 2 files changed, 113 insertions(+) diff --git a/src/system/helpers.cpp b/src/system/helpers.cpp index 59d64524a..17afa8c1a 100644 --- a/src/system/helpers.cpp +++ b/src/system/helpers.cpp @@ -50,6 +50,8 @@ //#include #include #include +#include +#define MD5_DIGEST_LENGTH 16 using namespace std; int mySleep(int sec) { @@ -1273,6 +1275,112 @@ std::string Lang2ISO639_1(std::string& lang) return ret; } +// returns the pid of the first process found in /proc +int getpidof(const char *process) +{ + DIR *dp; + struct dirent *entry; + struct stat statbuf; + + if ((dp = opendir("/proc")) == NULL) + { + fprintf(stderr, "Cannot open directory /proc\n"); + return -1; + } + + while ((entry = readdir(dp)) != NULL) + { + // get information about the file/folder + lstat(entry->d_name, &statbuf); + // files under /proc which start with a digit are processes + if (S_ISDIR(statbuf.st_mode) && isdigit(entry->d_name[0])) + { + // 14 chars for /proc//status + 0 + char procpath[14 + strlen(entry->d_name)]; + char procname[50]; + FILE *file; + + sprintf(procpath, "/proc/%s/status", entry->d_name); + + if (! (file = fopen(procpath, "r")) ) { + continue; + } + + fscanf(file,"%*s %s", procname); + fclose(file); + + // only 15 char available + if (strncmp(procname, process, 15) == 0) { + return atoi(entry->d_name); + } + } + } + closedir (dp); + return 0; +} + +std::string filehash(const char *file) +{ +#if 0 + int fd; + int i; + unsigned long size; + struct stat s_stat; + unsigned char hash[MD5_DIGEST_LENGTH]; + void *buff; + std::ostringstream os; + + memset(hash, 0, MD5_DIGEST_LENGTH); + + fd = open(file, O_RDONLY | O_NONBLOCK); + if (fd > 0) + { + // Get the size of the file by its file descriptor + fstat(fd, &s_stat); + size = s_stat.st_size; + + buff = mmap(0, size, PROT_READ, MAP_SHARED, fd, 0); + MD5((const unsigned char *)buff, size, hash); + munmap(buff, size); + + // Print the MD5 sum as hex-digits. + for(i = 0; i < MD5_DIGEST_LENGTH; ++i) { + os.width(2); + os.fill('0'); + os << std::hex << static_cast(hash[i]); + } + close(fd); + } + return os.str(); +#endif + int i; + unsigned char hash[MD5_DIGEST_LENGTH]; + std::ostringstream os; + + md5_file(file, 1, (unsigned char*) hash); + // Print the MD5 sum as hex-digits. + for(i = 0; i < MD5_DIGEST_LENGTH; ++i) { + os.width(2); + os.fill('0'); + os << std::hex << static_cast(hash[i]); + } + return os.str(); +} + +std::string get_path(const char *path) +{ + if(path[0] == '/' && strstr(path,"/var") == 0) + { + std::string varc = "/var"; + varc += path; + + if(file_exists(varc.c_str())) + return varc; + } + + return path; +} + string readLink(string lnk) { char buf[PATH_MAX]; diff --git a/src/system/helpers.h b/src/system/helpers.h index 48ac50a06..57fe0216d 100644 --- a/src/system/helpers.h +++ b/src/system/helpers.h @@ -146,4 +146,9 @@ std::string getJFFS2MountPoint(int mtdPos); std::string Lang2ISO639_1(std::string& lang); std::string readLink(std::string lnk); +int getpidof(const char *process); +std::string filehash(const char * file); +std::string get_path(const char * path); +inline bool file_exists(const std::string file) { return file_exists(file.c_str()); } + #endif From 9112e85cd3c848fa541fd2f2abc7a64225c6962f Mon Sep 17 00:00:00 2001 From: svenhoefer Date: Tue, 29 Aug 2017 14:38:26 +0200 Subject: [PATCH 05/38] - locale: small changes in update locales Signed-off-by: Thilo Graf --- data/locale/deutsch.locale | 4 ++-- data/locale/english.locale | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/data/locale/deutsch.locale b/data/locale/deutsch.locale index cc5bdc0f7..2ade89a25 100644 --- a/data/locale/deutsch.locale +++ b/data/locale/deutsch.locale @@ -605,7 +605,7 @@ flashupdate.apply_settings Sollen die aktuellen Einstellungen in das neue Image flashupdate.autocheck Beim Start nach Updates suchen flashupdate.cantopenfile kann Datei nicht öffnen flashupdate.cantopenmtd kann MTD nicht öffnen -flashupdate.checkupdate_internet Online nach Updates suchen +flashupdate.checkupdate_internet Online-Update flashupdate.checkupdate_local Lokales Update flashupdate.copy_image Kopiere Image in den Arbeitsspeicher flashupdate.createimage Image speichern @@ -657,7 +657,7 @@ flashupdate.namemode2_default +.img flashupdate.namemode2_hostname_time ++.img flashupdate.new_found Updates verfügbar! flashupdate.new_notfound Keine Updates verfügbar! -flashupdate.noversion Bei Updates werden Versionsüberprüfungen derzeit nur über Web-Updates unterstützt.\nWollen Sie das ausgewählte Image wirklich installieren? +flashupdate.noversion Eine Versionsüberprüfungen ist nur über das Online-Update möglich.\nWollen Sie das ausgewählte Image trotzdem installieren? flashupdate.programmingflash programmiere Flash flashupdate.proxypassword Passwort flashupdate.proxypassword_hint1 Geben sie das Proxy-Passwort ein diff --git a/data/locale/english.locale b/data/locale/english.locale index f12f30850..cb31cda9c 100644 --- a/data/locale/english.locale +++ b/data/locale/english.locale @@ -605,7 +605,7 @@ flashupdate.apply_settings Import current settings into new image? flashupdate.autocheck Auto-check updates on boot flashupdate.cantopenfile can't open file flashupdate.cantopenmtd can't open MTD -flashupdate.checkupdate_internet Check for online updates +flashupdate.checkupdate_internet Online update flashupdate.checkupdate_local Local update flashupdate.copy_image Copy Image to main memory flashupdate.createimage Save image @@ -657,7 +657,7 @@ flashupdate.namemode2_default +