From 36ee93e0fe52d2cbd1eeaabf9d629881df22620a Mon Sep 17 00:00:00 2001 From: Dean Lee Date: Tue, 9 Jun 2020 08:24:55 +0800 Subject: [PATCH] remove function is_leon (#1660) old-commit-hash: 5fdb60d43e8d141c086d9c25f2235cfb18106a17 --- selfdrive/ui/ui.cc | 19 ++----------------- 1 file changed, 2 insertions(+), 17 deletions(-) diff --git a/selfdrive/ui/ui.cc b/selfdrive/ui/ui.cc index 96ec3571af..8127e9ee05 100644 --- a/selfdrive/ui/ui.cc +++ b/selfdrive/ui/ui.cc @@ -14,6 +14,7 @@ #include "common/touch.h" #include "common/visionimg.h" #include "common/params.h" +#include "common/utilpp.h" #include "ui.hpp" static int last_brightness = -1; @@ -716,22 +717,6 @@ fail: #endif -int is_leon() { - #define MAXCHAR 1000 - FILE *fp; - char str[MAXCHAR]; - const char* filename = "/proc/cmdline"; - - fp = fopen(filename, "r"); - if (fp == NULL){ - printf("Could not open file %s",filename); - return 0; - } - fgets(str, MAXCHAR, fp); - fclose(fp); - return strstr(str, "letv") != NULL; -} - int main(int argc, char* argv[]) { int err; setpriority(PRIO_PROCESS, 0, -14); @@ -762,7 +747,7 @@ int main(int argc, char* argv[]) { ui_sound_init(); // light sensor scaling params - const int LEON = is_leon(); + const bool LEON = util::read_file("/proc/cmdline").find("letv") != std::string::npos; float brightness_b, brightness_m; int result = read_param(&brightness_b, "BRIGHTNESS_B", true);