Skip to content

Commit

Permalink
Merge branch 'hfp' into 'master'
Browse files Browse the repository at this point in the history
Register HandsfreeAudioManager straight away at startup

See merge request mer-core/ofono!277
  • Loading branch information
monich committed Nov 19, 2020
2 parents 6976366 + d682fcd commit 50a5f25
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
1 change: 0 additions & 1 deletion ofono/drivers/ril/ril_plugin.c
Expand Up @@ -2369,7 +2369,6 @@ static int ril_plugin_init(void)
static void ril_plugin_exit(void)
{
DBG("");
GASSERT(ril_driver);

ofono_ril_transport_unregister(&ril_socket_transport);
ofono_modem_driver_unregister(&ril_modem_driver);
Expand Down
5 changes: 2 additions & 3 deletions ofono/plugins/hfp_ag_bluez5.c
Expand Up @@ -495,8 +495,6 @@ static void hfp_ag_enable(DBusConnection *conn)
connection_hash = g_hash_table_new_full(g_str_hash, g_str_equal,
g_free, connection_destroy);

ofono_handsfree_audio_ref();

hfp_ag_enabled = TRUE;
}

Expand Down Expand Up @@ -525,7 +523,6 @@ static void hfp_ag_disable(DBusConnection *conn)
g_dbus_unregister_interface(conn, HFP_AG_EXT_PROFILE_PATH,
BLUEZ_PROFILE_INTERFACE);
ofono_handsfree_card_driver_unregister(&hfp_ag_driver);
ofono_handsfree_audio_unref();
}

hfp_ag_enabled = FALSE;
Expand All @@ -552,6 +549,7 @@ static int hfp_ag_init(void)
bluez_disconnect_cb,
NULL, NULL);

ofono_handsfree_audio_ref();
return 0;
}

Expand All @@ -565,6 +563,7 @@ static void hfp_ag_exit(void)
}

hfp_ag_disable(conn);
ofono_handsfree_audio_unref();
}

OFONO_PLUGIN_DEFINE(hfp_ag_bluez5, "Hands-Free Audio Gateway Profile Plugins",
Expand Down
5 changes: 0 additions & 5 deletions ofono/plugins/hfp_hf_bluez5.c
Expand Up @@ -49,7 +49,6 @@
#include <ofono/handsfree.h>
#include <ofono/handsfree-audio.h>
#include <ofono/siri.h>
#include <ofono.h>

#include <drivers/atmodem/atutil.h>
#include <drivers/hfpmodem/slc.h>
Expand Down Expand Up @@ -833,8 +832,6 @@ static int hfp_init(void)
if (DBUS_TYPE_UNIX_FD < 0)
return -EBADF;

__ofono_handsfree_audio_manager_init();

/* Registers External Profile handler */
if (!g_dbus_register_interface(conn, HFP_EXT_PROFILE_PATH,
BLUEZ_PROFILE_INTERFACE,
Expand Down Expand Up @@ -890,8 +887,6 @@ static void hfp_exit(void)
g_dbus_client_unref(bluez);

ofono_handsfree_audio_unref();

__ofono_handsfree_audio_manager_cleanup();
}

OFONO_PLUGIN_DEFINE(hfp_bluez5, "External Hands-Free Profile Plugin", VERSION,
Expand Down
11 changes: 9 additions & 2 deletions ofono/src/main.c
Expand Up @@ -3,6 +3,8 @@
* oFono - Open Source Telephony
*
* Copyright (C) 2008-2011 Intel Corporation. All rights reserved.
* Copyright (C) 2015-2020 Jolla Ltd.
* Copyright (C) 2019-2020 Open Mobile Platform LLC.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
Expand Down Expand Up @@ -281,7 +283,7 @@ int main(int argc, char **argv)

dbus_error_init(&error);

conn = g_dbus_setup_bus(DBUS_BUS_SYSTEM, OFONO_SERVICE, &error);
conn = g_dbus_setup_bus(DBUS_BUS_SYSTEM, NULL, &error);
if (conn == NULL) {
if (dbus_error_is_set(&error) == TRUE) {
ofono_error("Unable to hop onto D-Bus: %s",
Expand All @@ -308,7 +310,12 @@ int main(int argc, char **argv)
g_free(option_plugin);
g_free(option_noplugin);

g_main_loop_run(event_loop);
if (g_dbus_request_name(conn, OFONO_SERVICE, &error)) {
g_main_loop_run(event_loop);
} else {
ofono_error("Unable to register D-Bus name: %s", error.message);
dbus_error_free(&error);
}

__ofono_plugin_cleanup();

Expand Down

0 comments on commit 50a5f25

Please sign in to comment.