mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-08-27 15:32:59 +02:00
lcd4l: apply calls of exec_initscript() with "systemctl" as 3rd argument
Is required for image with system NOTE: CLCD4l::lcd4linux(int run) is adjusted but not really used at the moment
This commit is contained in:
@@ -161,7 +161,7 @@ void CLCD4l::StartLCD4l()
|
|||||||
dprintf(DEBUG_NORMAL, "\033[32m[CLCD4l] [%s - %d] thread [%p] is running\033[0m\n", __func__, __LINE__, thrLCD4l);
|
dprintf(DEBUG_NORMAL, "\033[32m[CLCD4l] [%s - %d] thread [%p] is running\033[0m\n", __func__, __LINE__, thrLCD4l);
|
||||||
}
|
}
|
||||||
if (g_settings.lcd4l_support)
|
if (g_settings.lcd4l_support)
|
||||||
exec_initscript("lcd4linux", "start");
|
exec_initscript("lcd4linux", "start", "systemctl");
|
||||||
}
|
}
|
||||||
|
|
||||||
void CLCD4l::StopLCD4l()
|
void CLCD4l::StopLCD4l()
|
||||||
@@ -178,7 +178,7 @@ void CLCD4l::StopLCD4l()
|
|||||||
thrLCD4l = NULL;
|
thrLCD4l = NULL;
|
||||||
dprintf(DEBUG_NORMAL, "\033[32m[CLCD4l] [%s - %d] thread [%p] terminated\033[0m\n", __func__, __LINE__, thrLCD4l);
|
dprintf(DEBUG_NORMAL, "\033[32m[CLCD4l] [%s - %d] thread [%p] terminated\033[0m\n", __func__, __LINE__, thrLCD4l);
|
||||||
}
|
}
|
||||||
exec_initscript("lcd4linux", "stop");
|
exec_initscript("lcd4linux", "stop", "systemctl");
|
||||||
}
|
}
|
||||||
|
|
||||||
void CLCD4l::SwitchLCD4l()
|
void CLCD4l::SwitchLCD4l()
|
||||||
@@ -298,7 +298,6 @@ void CLCD4l::Init()
|
|||||||
void *CLCD4l::LCD4lProc(void *arg)
|
void *CLCD4l::LCD4lProc(void *arg)
|
||||||
{
|
{
|
||||||
CLCD4l *PLCD4l = static_cast<CLCD4l *>(arg);
|
CLCD4l *PLCD4l = static_cast<CLCD4l *>(arg);
|
||||||
|
|
||||||
PLCD4l->Init();
|
PLCD4l->Init();
|
||||||
|
|
||||||
sleep(5); //please wait !
|
sleep(5); //please wait !
|
||||||
@@ -341,11 +340,6 @@ void *CLCD4l::LCD4lProc(void *arg)
|
|||||||
PLCD4l->WriteFile(FLAG_LCD4LINUX);
|
PLCD4l->WriteFile(FLAG_LCD4LINUX);
|
||||||
FirstRun = false;
|
FirstRun = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!g_settings.lcd4l_support) //off
|
|
||||||
lcd4linux(false);
|
|
||||||
else
|
|
||||||
lcd4linux(true);
|
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -543,6 +537,7 @@ void CLCD4l::ParseInfo(uint64_t parseID, bool newID, bool firstRun)
|
|||||||
m_Tuner = Tuner;
|
m_Tuner = Tuner;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ----------------------------------------------------------------- */
|
/* ----------------------------------------------------------------- */
|
||||||
|
|
||||||
int Volume = g_settings.current_volume;
|
int Volume = g_settings.current_volume;
|
||||||
@@ -872,7 +867,7 @@ void CLCD4l::ParseInfo(uint64_t parseID, bool newID, bool firstRun)
|
|||||||
WriteFile(LAYOUT, Layout);
|
WriteFile(LAYOUT, Layout);
|
||||||
m_Layout = Layout;
|
m_Layout = Layout;
|
||||||
if (!firstRun)
|
if (!firstRun)
|
||||||
exec_initscript("lcd4linux", "reload");
|
exec_initscript("lcd4linux", "restart", "systemctl");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1264,17 +1259,22 @@ std::string CLCD4l::hexStrA2A(unsigned char data)
|
|||||||
return std::string(hexstr);
|
return std::string(hexstr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CLCD4l::lcd4linux(bool run)
|
void CLCD4l::lcd4linux(int run)
|
||||||
{
|
{
|
||||||
const char *buf = "lcd4linux";
|
const char *lcd4lbin = "lcd4linux";
|
||||||
const char *conf = "/etc/lcd4linux.conf";
|
const char *conf = "/etc/lcd4linux.conf";
|
||||||
std::string lcd4l_bin = find_executable(buf);
|
const std::string systemd_cmd = "systemctl";
|
||||||
|
std::string lcd4lbin_path = find_executable(lcd4lbin);
|
||||||
bool isPNG;
|
bool isPNG;
|
||||||
|
|
||||||
chmod(conf,0x600);
|
chmod(conf,0x600);
|
||||||
chown(conf,0,0);
|
chown(conf,0,0);
|
||||||
|
|
||||||
if (run == true)
|
int lcd4_pid = getpidof(lcd4lbin);
|
||||||
|
|
||||||
|
if (run == START_LCD4L)
|
||||||
|
{
|
||||||
|
if (lcd4_pid == 0)
|
||||||
{
|
{
|
||||||
switch (g_settings.lcd4l_display_type)
|
switch (g_settings.lcd4l_display_type)
|
||||||
{
|
{
|
||||||
@@ -1290,22 +1290,28 @@ void CLCD4l::lcd4linux(bool run)
|
|||||||
|
|
||||||
if (isPNG)
|
if (isPNG)
|
||||||
{
|
{
|
||||||
if (my_system(3, lcd4l_bin.c_str(), "-o", PNGFILE) != 0)
|
if (my_system(3, lcd4lbin_path.c_str(), "-o", PNGFILE) != 0)
|
||||||
printf("[CLCD4l] %s: executing '%s -o %s' failed\n", __FUNCTION__, lcd4l_bin.c_str(), PNGFILE);
|
dprintf(DEBUG_NORMAL,"\033[33m[CLCD4l] [%s - %d] executing '%s -o %s' failed \033[0m\n", __func__, __LINE__, lcd4lbin, PNGFILE);
|
||||||
} else {
|
}
|
||||||
if (my_system(1, lcd4l_bin.c_str()) != 0)
|
else
|
||||||
printf("[CLCD4l] %s: executing '%s' failed\n", __FUNCTION__, lcd4l_bin.c_str());
|
{
|
||||||
|
if (exec_initscript(lcd4lbin, "start", systemd_cmd) != 0)
|
||||||
|
dprintf(DEBUG_NORMAL,"\033[33m[CLCD4l] [%s - %d] %s start failed \033[0m\n", __func__, __LINE__, lcd4lbin);
|
||||||
}
|
}
|
||||||
sleep(2);
|
sleep(2);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
else if (run == RELOAD_LCD4L)
|
||||||
|
{
|
||||||
|
if (exec_initscript(lcd4lbin, "reload", systemd_cmd) != 0)
|
||||||
|
dprintf(DEBUG_NORMAL,"\033[33m[CLCD4l] [%s - %d] %s reload failed \033[0m\n", __func__, __LINE__, lcd4lbin);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (file_exists(PIDFILE))
|
if (lcd4_pid)
|
||||||
{
|
{
|
||||||
if (my_system(3, "killall", "-9", buf) != 0)
|
if (exec_initscript(lcd4lbin, "stop", systemd_cmd) != 0)
|
||||||
printf("[CLCD4l] %s: terminating '%s' failed\n", __FUNCTION__, buf);
|
dprintf(DEBUG_NORMAL,"\033[33m[CLCD4l] [%s - %d] %s stop failed \033[0m\n", __func__, __LINE__, lcd4lbin);
|
||||||
}
|
}
|
||||||
else
|
|
||||||
dprintf(DEBUG_NORMAL,"\033[33m[CLCD4l] [%s - %d] %s is not running \033[0m\n", __func__, __LINE__,lcd4l_bin.c_str());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -67,7 +67,14 @@ class CLCD4l
|
|||||||
int GetMaxBrightness();
|
int GetMaxBrightness();
|
||||||
|
|
||||||
void ResetParseID() { m_ParseID = 0; }
|
void ResetParseID() { m_ParseID = 0; }
|
||||||
static void lcd4linux(bool run);
|
|
||||||
|
static void lcd4linux(int run);
|
||||||
|
enum
|
||||||
|
{
|
||||||
|
STOP_LCD4L = 0,
|
||||||
|
START_LCD4L = 1,
|
||||||
|
RELOAD_LCD4L = 2
|
||||||
|
};
|
||||||
private:
|
private:
|
||||||
std::thread *thrLCD4l;
|
std::thread *thrLCD4l;
|
||||||
static void *LCD4lProc(void *arg);
|
static void *LCD4lProc(void *arg);
|
||||||
|
Reference in New Issue
Block a user