mirror of
https://github.com/troglobit/finit.git
synced 2026-10-30 12:50:34 +00:00
ALSA plugin: only run if /usr/sbin/alsactl exists
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
1 parent
4cf60b7491
commit
42800a1cc8
1 file changed
+13
-11
+13
-11
@@ -1,6 +1,6 @@
|
|||||||
/* Save and restore ALSA sound settings using alsactl
|
/* Save and restore ALSA sound settings using alsactl
|
||||||
*
|
*
|
||||||
* Copyright (c) 2012 Joachim Nilsson <troglobit@gmail.com>
|
* Copyright (c) 2012-2016 Joachim Nilsson <troglobit@gmail.com>
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
* of this software and associated documentation files (the "Software"), to deal
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
@@ -26,26 +26,28 @@
|
|||||||
#include "../helpers.h"
|
#include "../helpers.h"
|
||||||
#include "../plugin.h"
|
#include "../plugin.h"
|
||||||
|
|
||||||
|
#define ALSACTL "/usr/sbin/alsactl"
|
||||||
|
|
||||||
static void save(void *UNUSED(arg))
|
static void save(void *UNUSED(arg))
|
||||||
{
|
{
|
||||||
_d("Saving sound settings ...");
|
if (fexist(ALSACTL)) {
|
||||||
run_interactive("/usr/sbin/alsactl -g store", "Saving sound settings");
|
_d("Saving sound settings ...");
|
||||||
|
run_interactive(ALSACTL " -g store", "Saving sound settings");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void restore(void *UNUSED(arg))
|
static void restore(void *UNUSED(arg))
|
||||||
{
|
{
|
||||||
_d("Restoring sound settings ...");
|
if (fexist(ALSACTL)) {
|
||||||
run_interactive("/usr/sbin/alsactl -g restore", "Restoring sound settings");
|
_d("Restoring sound settings ...");
|
||||||
|
run_interactive(ALSACTL " -g restore", "Restoring sound settings");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static plugin_t plugin = {
|
static plugin_t plugin = {
|
||||||
.name = __FILE__,
|
.name = __FILE__,
|
||||||
.hook[HOOK_BASEFS_UP] = {
|
.hook[HOOK_BASEFS_UP] = { .cb = restore },
|
||||||
.cb = restore
|
.hook[HOOK_SHUTDOWN] = { .cb = save }
|
||||||
},
|
|
||||||
.hook[HOOK_SHUTDOWN] = {
|
|
||||||
.cb = save
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
PLUGIN_INIT(plugin_init)
|
PLUGIN_INIT(plugin_init)
|
||||||
|
|||||||
Reference in new issue
Block a user