Skip to content

Commit 85402aa

Browse files
committed
gmenu2x now stops/starts audio ampli when needed
1 parent 4220f3a commit 85402aa

File tree

3 files changed

+13
-1
lines changed

3 files changed

+13
-1
lines changed

src/funkeymenu.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,8 @@ typedef enum {ASPECT_RATIOS} ENUM_ASPECT_RATIOS_TYPES;
5555
#define SHELL_CMD_SCHEDULE_POWERDOWN "sched_shutdown"
5656
#define SHELL_CMD_SET_LAUNCHER_GMENU2X "set_launcher gmenu2x"
5757
#define SHELL_CMD_SET_LAUNCHER_RETROFE "set_launcher retrofe"
58+
#define SHELL_CMD_TURN_AMPLI_ON "start_audio_amp 1"
59+
#define SHELL_CMD_TURN_AMPLI_OFF "start_audio_amp 0"
5860

5961
class FunkeyMenu
6062
{

src/gmenu2x.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,9 @@ int main(int /*argc*/, char * /*argv*/[]) {
178178
set_handler(SIGTERM, &quit_all);
179179
set_handler(SIGUSR1, &handle_sigusr1);
180180

181+
/* Stop Ampli */
182+
popen(SHELL_CMD_TURN_AMPLI_OFF, "r");
183+
181184
char *home = getenv("HOME");
182185
if (home == NULL) {
183186
ERROR("Unable to find gmenu2x home directory. The $HOME variable is not defined.\n");

src/launcher.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#include "launcher.h"
2-
2+
#include "funkeymenu.h"
33
#include "debug.h"
44

55
#include <cerrno>
@@ -32,6 +32,10 @@ Launcher::Launcher(vector<string> && commandLine, bool consoleApp)
3232

3333
void Launcher::exec()
3434
{
35+
36+
/* Start audio amp */
37+
popen(SHELL_CMD_TURN_AMPLI_ON, "r");
38+
3539
if (consoleApp) {
3640
#ifdef BIND_CONSOLE
3741
/* Enable the framebuffer console */
@@ -55,12 +59,15 @@ void Launcher::exec()
5559
#endif
5660
}
5761

62+
INFO("Launching '");
5863
vector<const char *> args;
5964
args.reserve(commandLine.size() + 1);
6065
for (auto arg : commandLine) {
6166
args.push_back(strdup(arg.c_str()));
67+
INFO("%s ", args.back() );
6268
}
6369
args.push_back(nullptr);
70+
INFO("'\n");
6471

6572
execvp(commandLine[0].c_str(), (char * const *)args.data());
6673
WARNING("Failed to exec '%s': %s\n",

0 commit comments

Comments
 (0)