Add call to check if the dbus service is started.
This commit is contained in:
+12
-2
@@ -67,13 +67,18 @@ void going_active(int block) {
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_DBUS_INTERFACE
|
||||
if (dbus_service_is_running())
|
||||
shairport_sync_set_active(SHAIRPORT_SYNC(shairportSyncSkeleton), TRUE);
|
||||
#endif
|
||||
|
||||
if (config.disable_standby_mode == disable_standby_while_active) {
|
||||
config.keep_dac_busy = 1;
|
||||
#ifdef CONFIG_DBUS_INTERFACE
|
||||
if (dbus_service_is_running())
|
||||
shairport_sync_set_disable_standby(SHAIRPORT_SYNC(shairportSyncSkeleton), TRUE);
|
||||
else
|
||||
config.keep_dac_busy = 1;
|
||||
#else
|
||||
config.keep_dac_busy = 1;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
@@ -89,13 +94,18 @@ void going_inactive(int block) {
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_DBUS_INTERFACE
|
||||
if (dbus_service_is_running())
|
||||
shairport_sync_set_active(SHAIRPORT_SYNC(shairportSyncSkeleton), FALSE);
|
||||
#endif
|
||||
|
||||
if (config.disable_standby_mode == disable_standby_while_active) {
|
||||
config.keep_dac_busy = 0;
|
||||
#ifdef CONFIG_DBUS_INTERFACE
|
||||
if (dbus_service_is_running())
|
||||
shairport_sync_set_disable_standby(SHAIRPORT_SYNC(shairportSyncSkeleton), FALSE);
|
||||
else
|
||||
config.keep_dac_busy = 0;
|
||||
#else
|
||||
config.keep_dac_busy = 0;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1533,7 +1533,12 @@ void alsa_buffer_monitor_thread_cleanup_function(__attribute__((unused)) void
|
||||
*/
|
||||
|
||||
void *alsa_buffer_monitor_thread_code(__attribute__((unused)) void *arg) {
|
||||
int okb = -1;
|
||||
while (1) {
|
||||
if (okb != config.keep_dac_busy) {
|
||||
debug(1,"keep_dac_busy is now %d",config.keep_dac_busy);
|
||||
okb = config.keep_dac_busy;
|
||||
}
|
||||
if ((config.keep_dac_busy != 0) && (alsa_device_initialised == 0)) {
|
||||
debug(2, "alsa: alsa_buffer_monitor_thread_code() calling "
|
||||
"do_alsa_device_init_if_needed.");
|
||||
|
||||
@@ -15,6 +15,8 @@
|
||||
|
||||
#include "dbus-service.h"
|
||||
|
||||
int service_is_running = 0;
|
||||
|
||||
ShairportSyncDiagnostics *shairportSyncDiagnosticsSkeleton = NULL;
|
||||
ShairportSyncRemoteControl *shairportSyncRemoteControlSkeleton = NULL;
|
||||
ShairportSyncAdvancedRemoteControl *shairportSyncAdvancedRemoteControlSkeleton = NULL;
|
||||
@@ -841,6 +843,7 @@ static void on_dbus_name_acquired(GDBusConnection *connection, const gchar *name
|
||||
|
||||
debug(1, "Shairport Sync native D-Bus service started at \"%s\" on the %s bus.", name,
|
||||
(config.dbus_service_bus_type == DBT_session) ? "session" : "system");
|
||||
service_is_running = 1;
|
||||
}
|
||||
|
||||
static void on_dbus_name_lost_again(__attribute__((unused)) GDBusConnection *connection,
|
||||
@@ -887,4 +890,9 @@ void stop_dbus_service() {
|
||||
g_bus_unown_name(ownerID);
|
||||
else
|
||||
debug(1, "Zero OwnerID for \"org.gnome.ShairportSync\".");
|
||||
service_is_running = 0;
|
||||
}
|
||||
|
||||
int dbus_service_is_running() {
|
||||
return service_is_running;
|
||||
}
|
||||
|
||||
@@ -7,5 +7,6 @@ ShairportSync *shairportSyncSkeleton;
|
||||
|
||||
int start_dbus_service();
|
||||
void stop_dbus_service();
|
||||
int dbus_service_is_running();
|
||||
|
||||
#endif /* #ifndef DBUS_SERVICE_H */
|
||||
|
||||
Reference in New Issue
Block a user