- lcd4l: fix removing start/stop hint when init script fails

Conflicts:
	src/driver/lcd4l.h

Signed-off-by: Thilo Graf <dbt@novatux.de>
This commit is contained in:
svenhoefer
2021-07-16 23:51:41 +02:00
committed by Thilo Graf
parent 1df285f4ff
commit f9ad744722
3 changed files with 15 additions and 6 deletions

View File

@@ -167,6 +167,8 @@ void CLCD4l::StartLCD4l()
{ {
if (exec_initscript("lcd4linux", "start", "systemctl")) if (exec_initscript("lcd4linux", "start", "systemctl"))
OnAfterStart(); OnAfterStart();
else
OnAfterError();
} }
} }
@@ -188,6 +190,8 @@ void CLCD4l::StopLCD4l()
if (exec_initscript("lcd4linux", "stop", "systemctl")) if (exec_initscript("lcd4linux", "stop", "systemctl"))
OnAfterStop(); OnAfterStop();
else
OnAfterError();
} }
void CLCD4l::SwitchLCD4l() void CLCD4l::SwitchLCD4l()
@@ -881,6 +885,8 @@ void CLCD4l::ParseInfo(uint64_t parseID, bool newID, bool firstRun)
OnBeforeRestart(); OnBeforeRestart();
if (exec_initscript("lcd4linux", "restart", "systemctl")) if (exec_initscript("lcd4linux", "restart", "systemctl"))
OnAfterRestart(); OnAfterRestart();
else
OnAfterError();
} }
} }
} }

View File

@@ -79,12 +79,13 @@ class CLCD4l
// use signal/slot handlers // use signal/slot handlers
// That is helping to keep the GUI code away from code inside ./src/driver. // That is helping to keep the GUI code away from code inside ./src/driver.
sigc::signal<void> OnBeforeRestart, sigc::signal<void> OnBeforeStart,
OnAfterRestart, OnAfterStart,
OnBeforeStart, OnBeforeStop,
OnAfterStart, OnAfterStop,
OnBeforeStop, OnBeforeRestart,
OnAfterStop; OnAfterRestart,
OnAfterError;
private: private:
std::thread *thrLCD4l; std::thread *thrLCD4l;

View File

@@ -328,4 +328,6 @@ void CLCD4lSetup::connectSlots()
CLCD4l::getInstance()->OnAfterStart.connect(sl_remove); CLCD4l::getInstance()->OnAfterStart.connect(sl_remove);
CLCD4l::getInstance()->OnAfterStop.connect(sl_remove); CLCD4l::getInstance()->OnAfterStop.connect(sl_remove);
CLCD4l::getInstance()->OnAfterRestart.connect(sl_remove); CLCD4l::getInstance()->OnAfterRestart.connect(sl_remove);
CLCD4l::getInstance()->OnAfterError.connect(sl_remove);
} }