From bf60429e36de76f11bf567bb7dac32470a7ee4e3 Mon Sep 17 00:00:00 2001 From: Linus Dierheimer Date: Sun, 9 Jan 2022 16:51:57 +0100 Subject: [PATCH] Android support part 1 --- src/common/logo.c | 51 +++++++++++++++++++++++++++++++++++ src/common/settings.c | 2 +- src/common/threading.c | 10 ------- src/detection/terminalShell.c | 4 +-- src/modules/cpu.c | 4 +-- 5 files changed, 56 insertions(+), 15 deletions(-) diff --git a/src/common/logo.c b/src/common/logo.c index 3bec52ba1..792d25764 100644 --- a/src/common/logo.c +++ b/src/common/logo.c @@ -47,6 +47,55 @@ static const FFlogo* getLogoNone() FF_LOGO_RETURN } +static const FFlogo* getLogoAndroid() +{ + FF_LOGO_INIT + FF_LOGO_NAMES("android") + FF_LOGO_LINES( + "$1 -o o- \n" + "$1 +hydNNNNdyh+ \n" + "$1 +mMMMMMMMMMMMMm+ \n" + "$1 `dMM$2m:$1NMMMMMMN$2:m$1MMd` \n" + "$1 hMMMMMMMMMMMMMMMMMMh \n" + "$1 .. yyyyyyyyyyyyyyyyyyyy .. \n" + "$1.mMMm`MMMMMMMMMMMMMMMMMMMM`mMMm.\n" + "$1:MMMM-MMMMMMMMMMMMMMMMMMMM-MMMM:\n" + "$1:MMMM-MMMMMMMMMMMMMMMMMMMM-MMMM:\n" + "$1:MMMM-MMMMMMMMMMMMMMMMMMMM-MMMM:\n" + "$1:MMMM-MMMMMMMMMMMMMMMMMMMM-MMMM:\n" + "$1-MMMM-MMMMMMMMMMMMMMMMMMMM-MMMM-\n" + "$1 +yy+ MMMMMMMMMMMMMMMMMMMM +yy+ \n" + "$1 mMMMMMMMMMMMMMMMMMMm \n" + "$1 `/++MMMMh++hMMMM++/` \n" + "$1 MMMMo oMMMM \n" + "$1 MMMMo oMMMM \n" + "$1 oNMm- -mMNs " + ) + FF_LOGO_COLORS( + "32", //green + "37" //white + ) + FF_LOGO_RETURN +} + +static const FFlogo* getLogoAndroidSmall() +{ + FF_LOGO_INIT + FF_LOGO_NAMES("android-small", "android_small") + FF_LOGO_LINES( + "$1 ;, ,; \n" + "$1 ';,.-----.,;' \n" + "$1 ,' ', \n" + "$1 / O O \\ \n" + "$1| |\n" + "$1'-----------------'" + ) + FF_LOGO_COLORS( + "32" //green + ) + FF_LOGO_RETURN +} + static const FFlogo* getLogoArch() { FF_LOGO_INIT @@ -765,6 +814,8 @@ static GetLogoMethod* getLogoMethods() static GetLogoMethod logoMethods[] = { getLogoNone, getLogoUnknown, + getLogoAndroid, + getLogoAndroidSmall, getLogoArch, getLogoArchSmall, getLogoArcoLinux, diff --git a/src/common/settings.c b/src/common/settings.c index cd35acee0..256ad5cf2 100644 --- a/src/common/settings.c +++ b/src/common/settings.c @@ -271,6 +271,6 @@ FFvariant ffSettingsGetXFConf(FFinstance* instance, const char* channelName, con #include void ffSettingsGetAndroidProperty(const char* propName, FFstrbuf* result) { ffStrbufEnsureCapacity(result, PROP_VALUE_MAX); - result->length = __system_property_get(propName, result->chars); + result->length = (uint32_t) __system_property_get(propName, result->chars); } #endif diff --git a/src/common/threading.c b/src/common/threading.c index b9277e10e..a4abb33f4 100644 --- a/src/common/threading.c +++ b/src/common/threading.c @@ -32,12 +32,6 @@ static inline void* connectDisplayServerThreadMain(void* instance) return NULL; } -static inline void* detectTerminalShellThreadMain(void* instance) -{ - ffDetectTerminalShell((FFinstance*)instance); - return NULL; -} - static inline void* startThreadsThreadMain(void* instance) { pthread_t dsThread; @@ -56,10 +50,6 @@ static inline void* startThreadsThreadMain(void* instance) pthread_create(>k4Thread, NULL, detectGTK4ThreadMain, instance); pthread_detach(gtk4Thread); - pthread_t terminalShellThread; - pthread_create(&terminalShellThread, NULL, detectTerminalShellThreadMain, instance); - pthread_detach(terminalShellThread); - pthread_t plasmaThread; pthread_create(&plasmaThread, NULL, detectPlasmaThreadMain, instance); pthread_detach(plasmaThread); diff --git a/src/detection/terminalShell.c b/src/detection/terminalShell.c index 5a7ad848b..9767c1ad8 100644 --- a/src/detection/terminalShell.c +++ b/src/detection/terminalShell.c @@ -249,8 +249,8 @@ const FFTerminalShellResult* ffDetectTerminalShell(FFinstance* instance) result.userShellExeName = result.userShellExe.chars; ffStrbufInit(&result.userShellVersion); - char ppid[256]; - snprintf(ppid, 255, "%i", getppid()); + char ppid[32]; + snprintf(ppid, sizeof(ppid) - 1, "%i", getppid()); getTerminalShell(&result, ppid); getTerminalFromEnv(&result); diff --git a/src/modules/cpu.c b/src/modules/cpu.c index 8588f27e5..d9515459d 100644 --- a/src/modules/cpu.c +++ b/src/modules/cpu.c @@ -153,10 +153,10 @@ void ffPrintCPU(FFinstance* instance) else if(vendor.length > 0) { ffStrbufAppend(&cpu, &vendor); - ffStrbufAppendS(&cpu, " unknown processor"); + ffStrbufAppendS(&cpu, " CPU"); } else - ffStrbufAppendS(&cpu, "unknown processor"); + ffStrbufAppendS(&cpu, "CPU"); if(numProcs > 1) ffStrbufAppendF(&cpu, " (%i)", numProcs);