From c761480865c6b65e370e2bba750c86c226a7fc3f Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Fri, 27 Oct 2006 14:46:36 +0000 Subject: Add skeletons for service implementations --- audio/main.c | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 audio/main.c (limited to 'audio/main.c') diff --git a/audio/main.c b/audio/main.c new file mode 100644 index 00000000..c04bb251 --- /dev/null +++ b/audio/main.c @@ -0,0 +1,34 @@ +/* + * + * BlueZ - Bluetooth protocol stack for Linux + * + * Copyright (C) 2005-2006 Marcel Holtmann + * + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + +#ifdef HAVE_CONFIG_H +#include +#endif + +#include +#include + +int main(int argc, char *argv[]) +{ + return 0; +} -- cgit From 850927098605ff169bcc0b576ebd7e0ace963595 Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Fri, 9 Mar 2007 22:32:47 +0000 Subject: Add skeleton for manager interface --- audio/main.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'audio/main.c') diff --git a/audio/main.c b/audio/main.c index c04bb251..2f3a1fa0 100644 --- a/audio/main.c +++ b/audio/main.c @@ -2,7 +2,7 @@ * * BlueZ - Bluetooth protocol stack for Linux * - * Copyright (C) 2005-2006 Marcel Holtmann + * Copyright (C) 2004-2007 Marcel Holtmann * * * This program is free software; you can redistribute it and/or modify @@ -28,7 +28,13 @@ #include #include +#include "manager.h" + int main(int argc, char *argv[]) { + audio_init(); + + audio_exit(); + return 0; } -- cgit From 7558cca5c0bd954dc3db559c0d58ae6e497b13c0 Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Sun, 8 Apr 2007 23:13:18 +0000 Subject: Add generic audio service init --- audio/main.c | 62 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 60 insertions(+), 2 deletions(-) (limited to 'audio/main.c') diff --git a/audio/main.c b/audio/main.c index 2f3a1fa0..08194d82 100644 --- a/audio/main.c +++ b/audio/main.c @@ -25,16 +25,74 @@ #include #endif -#include -#include +#include +#include +#include + +#include + +#include + +#include "dbus.h" +#include "logging.h" #include "manager.h" +#include "headset.h" + +static GMainLoop *main_loop = NULL; + +static void sig_term(int sig) +{ + g_main_loop_quit(main_loop); +} int main(int argc, char *argv[]) { + DBusConnection *conn; + struct sigaction sa; + + start_logging("audio", "Bluetooth Audio daemon"); + + memset(&sa, 0, sizeof(sa)); + sa.sa_flags = SA_NOCLDSTOP; + sa.sa_handler = sig_term; + sigaction(SIGTERM, &sa, NULL); + sigaction(SIGINT, &sa, NULL); + + sa.sa_handler = SIG_IGN; + sigaction(SIGCHLD, &sa, NULL); + sigaction(SIGPIPE, &sa, NULL); + + enable_debug(); + + main_loop = g_main_loop_new(NULL, FALSE); + + conn = dbus_bus_system_setup_with_main_loop(NULL, NULL, NULL); + if (!conn) { + g_main_loop_unref(main_loop); + exit(1); + } + audio_init(); + headset_init(conn); + + if (argc > 1 && !strcmp(argv[1], "-s")) + register_external_service(conn, "audio", "Audio service", ""); + + g_main_loop_run(main_loop); + + headset_exit(); + audio_exit(); + dbus_connection_unref(conn); + + g_main_loop_unref(main_loop); + + info("Exit"); + + stop_logging(); + return 0; } -- cgit From 353376a06677af64fc6e81d3118adc2e059516b8 Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Sun, 8 Apr 2007 23:19:19 +0000 Subject: Fix some forgotton leftovers --- audio/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'audio/main.c') diff --git a/audio/main.c b/audio/main.c index 08194d82..bf0ddf4d 100644 --- a/audio/main.c +++ b/audio/main.c @@ -73,7 +73,7 @@ int main(int argc, char *argv[]) exit(1); } - audio_init(); + audio_init(conn); headset_init(conn); -- cgit From 35f12dee95378056a2ed7c0d325b2c3b68022da8 Mon Sep 17 00:00:00 2001 From: Johan Hedberg Date: Tue, 10 Apr 2007 11:44:10 +0000 Subject: Audio service refactoring: move all manager functions to manager.c --- audio/main.c | 4 ---- 1 file changed, 4 deletions(-) (limited to 'audio/main.c') diff --git a/audio/main.c b/audio/main.c index bf0ddf4d..6ef3b1c6 100644 --- a/audio/main.c +++ b/audio/main.c @@ -75,15 +75,11 @@ int main(int argc, char *argv[]) audio_init(conn); - headset_init(conn); - if (argc > 1 && !strcmp(argv[1], "-s")) register_external_service(conn, "audio", "Audio service", ""); g_main_loop_run(main_loop); - headset_exit(); - audio_exit(); dbus_connection_unref(conn); -- cgit From e5aff3f6f7c43f4ddf8d83358d6a49ad2f81e750 Mon Sep 17 00:00:00 2001 From: Johan Hedberg Date: Thu, 12 Apr 2007 12:06:33 +0000 Subject: Redo the manager-headset splitup by using object paths as public identifiers for headsets --- audio/main.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'audio/main.c') diff --git a/audio/main.c b/audio/main.c index 6ef3b1c6..3cf609f6 100644 --- a/audio/main.c +++ b/audio/main.c @@ -73,6 +73,8 @@ int main(int argc, char *argv[]) exit(1); } + headset_init(conn); + audio_init(conn); if (argc > 1 && !strcmp(argv[1], "-s")) @@ -82,6 +84,8 @@ int main(int argc, char *argv[]) audio_exit(); + headset_exit(); + dbus_connection_unref(conn); g_main_loop_unref(main_loop); -- cgit From a07ea139e52ab9733f6d1e9f0ab2e0bf232059ef Mon Sep 17 00:00:00 2001 From: Johan Hedberg Date: Thu, 12 Apr 2007 14:26:55 +0000 Subject: A little more refactoring --- audio/main.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'audio/main.c') diff --git a/audio/main.c b/audio/main.c index 3cf609f6..470b26d5 100644 --- a/audio/main.c +++ b/audio/main.c @@ -73,19 +73,25 @@ int main(int argc, char *argv[]) exit(1); } - headset_init(conn); + if (audio_init(conn) < 0) { + error("Audio init failed!"); + exit(1); + } - audio_init(conn); + if (headset_init(conn) < 0) { + error("Headset initialization failed!"); + exit(1); + } if (argc > 1 && !strcmp(argv[1], "-s")) register_external_service(conn, "audio", "Audio service", ""); g_main_loop_run(main_loop); - audio_exit(); - headset_exit(); + audio_exit(); + dbus_connection_unref(conn); g_main_loop_unref(main_loop); -- cgit From 260b175f47f5006b34a8eceda9914f67ef0caa12 Mon Sep 17 00:00:00 2001 From: Johan Hedberg Date: Fri, 13 Apr 2007 11:51:00 +0000 Subject: Cleanup and small fixes --- audio/main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'audio/main.c') diff --git a/audio/main.c b/audio/main.c index 470b26d5..2188e6e7 100644 --- a/audio/main.c +++ b/audio/main.c @@ -88,10 +88,10 @@ int main(int argc, char *argv[]) g_main_loop_run(main_loop); - headset_exit(); - audio_exit(); + headset_exit(); + dbus_connection_unref(conn); g_main_loop_unref(main_loop); -- cgit From 2f9928fa78e9b4c767a5f584d068fb44b43856cd Mon Sep 17 00:00:00 2001 From: Johan Hedberg Date: Tue, 15 May 2007 12:45:35 +0000 Subject: Refactoring to allow adding support for more profiles --- audio/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'audio/main.c') diff --git a/audio/main.c b/audio/main.c index 2188e6e7..5c44df9b 100644 --- a/audio/main.c +++ b/audio/main.c @@ -78,7 +78,7 @@ int main(int argc, char *argv[]) exit(1); } - if (headset_init(conn) < 0) { + if (headset_server_init(conn) < 0) { error("Headset initialization failed!"); exit(1); } -- cgit From d2d76421ad539e2c6da87e4b4fd2a42493053f49 Mon Sep 17 00:00:00 2001 From: Johan Hedberg Date: Sat, 26 May 2007 17:17:34 +0000 Subject: Move unix socket functionality into unix.c --- audio/main.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'audio/main.c') diff --git a/audio/main.c b/audio/main.c index 5c44df9b..98dc1d4f 100644 --- a/audio/main.c +++ b/audio/main.c @@ -36,6 +36,7 @@ #include "dbus.h" #include "logging.h" +#include "unix.h" #include "manager.h" #include "headset.h" @@ -73,6 +74,11 @@ int main(int argc, char *argv[]) exit(1); } + if (unix_init() < 0) { + error("Unable to setup unix socket"); + exit(1); + } + if (audio_init(conn) < 0) { error("Audio init failed!"); exit(1); @@ -92,6 +98,8 @@ int main(int argc, char *argv[]) headset_exit(); + unix_exit(); + dbus_connection_unref(conn); g_main_loop_unref(main_loop); -- cgit From 04efa14f48878cd1c1a31afc106f782fc97277a0 Mon Sep 17 00:00:00 2001 From: Johan Hedberg Date: Thu, 31 May 2007 09:23:17 +0000 Subject: Bring the audio code up-to-date with the current API spec --- audio/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'audio/main.c') diff --git a/audio/main.c b/audio/main.c index 98dc1d4f..80e3fabf 100644 --- a/audio/main.c +++ b/audio/main.c @@ -84,7 +84,7 @@ int main(int argc, char *argv[]) exit(1); } - if (headset_server_init(conn) < 0) { + if (headset_server_init(conn, FALSE) < 0) { error("Headset initialization failed!"); exit(1); } -- cgit From 49f901927ea2133526c360c420b532f6b147f0ad Mon Sep 17 00:00:00 2001 From: Johan Hedberg Date: Thu, 31 May 2007 09:30:23 +0000 Subject: Disable HFP support for now (since it's incomplete) --- audio/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'audio/main.c') diff --git a/audio/main.c b/audio/main.c index 80e3fabf..b0eb30c8 100644 --- a/audio/main.c +++ b/audio/main.c @@ -84,7 +84,7 @@ int main(int argc, char *argv[]) exit(1); } - if (headset_server_init(conn, FALSE) < 0) { + if (headset_server_init(conn, TRUE) < 0) { error("Headset initialization failed!"); exit(1); } -- cgit From 814aed96a2c0afa4218cc4384425934fd30faa68 Mon Sep 17 00:00:00 2001 From: Johan Hedberg Date: Thu, 31 May 2007 12:51:49 +0000 Subject: Add support for configuration file --- audio/main.c | 57 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 56 insertions(+), 1 deletion(-) (limited to 'audio/main.c') diff --git a/audio/main.c b/audio/main.c index b0eb30c8..796af3b5 100644 --- a/audio/main.c +++ b/audio/main.c @@ -40,6 +40,10 @@ #include "manager.h" #include "headset.h" +/* Configuration settings */ +static gboolean disable_hfp = FALSE; +static gboolean sco_hci = TRUE; + static GMainLoop *main_loop = NULL; static void sig_term(int sig) @@ -47,6 +51,55 @@ static void sig_term(int sig) g_main_loop_quit(main_loop); } +void read_config(const char *file) +{ + GKeyFile *keyfile; + GError *err = NULL; + gboolean no_hfp; + char *sco_routing; + + keyfile = g_key_file_new(); + + if (!g_key_file_load_from_file(keyfile, file, 0, &err)) { + error("Parsing %s failed: %s", file, err->message); + g_error_free(err); + g_key_file_free(keyfile); + return; + } + + sco_routing = g_key_file_get_string(keyfile, "General", + "SCORouting", &err); + if (err) { + debug("%s: %s", file, err->message); + g_error_free(err); + err = NULL; + } else { + if (strcmp(sco_routing, "PCM") == 0) + sco_hci = FALSE; + else if (strcmp(sco_routing, "HCI") == 0) + sco_hci = TRUE; + else + error("Invalid Headset Routing value: %s", + sco_routing); + g_free(sco_routing); + } + + no_hfp = g_key_file_get_boolean(keyfile, "Headset", + "DisableHFP", &err); + if (err) { + debug("%s: %s", file, err->message); + g_error_free(err); + err = NULL; + } else + disable_hfp = no_hfp; + + debug("Config options: DisableHFP=%s, SCORouting=%s", + disable_hfp ? "true" : "false", + sco_hci ? "HCI" : "PCM"); + + g_key_file_free(keyfile); +} + int main(int argc, char *argv[]) { DBusConnection *conn; @@ -66,6 +119,8 @@ int main(int argc, char *argv[]) enable_debug(); + read_config(CONFIGDIR "/audio.conf"); + main_loop = g_main_loop_new(NULL, FALSE); conn = dbus_bus_system_setup_with_main_loop(NULL, NULL, NULL); @@ -84,7 +139,7 @@ int main(int argc, char *argv[]) exit(1); } - if (headset_server_init(conn, TRUE) < 0) { + if (headset_server_init(conn, disable_hfp, sco_hci) < 0) { error("Headset initialization failed!"); exit(1); } -- cgit From 9dc2cfaca68df6b7aa9824da20cfe2eb01980f73 Mon Sep 17 00:00:00 2001 From: Johan Hedberg Date: Wed, 13 Jun 2007 06:47:32 +0000 Subject: Set default config values to what currently works --- audio/main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'audio/main.c') diff --git a/audio/main.c b/audio/main.c index 796af3b5..3a170b1a 100644 --- a/audio/main.c +++ b/audio/main.c @@ -41,8 +41,8 @@ #include "headset.h" /* Configuration settings */ -static gboolean disable_hfp = FALSE; -static gboolean sco_hci = TRUE; +static gboolean disable_hfp = TRUE; +static gboolean sco_hci = FALSE; static GMainLoop *main_loop = NULL; -- cgit From eb0899c1c7137ece8c0e5e5ec031cb2b9b4262e3 Mon Sep 17 00:00:00 2001 From: Luiz Augusto von Dentz Date: Mon, 18 Jun 2007 21:08:35 +0000 Subject: Make deprecated headset methods to rely on new device methods. --- audio/main.c | 2 -- 1 file changed, 2 deletions(-) (limited to 'audio/main.c') diff --git a/audio/main.c b/audio/main.c index 3a170b1a..0ca8ce87 100644 --- a/audio/main.c +++ b/audio/main.c @@ -36,9 +36,7 @@ #include "dbus.h" #include "logging.h" -#include "unix.h" #include "manager.h" -#include "headset.h" /* Configuration settings */ static gboolean disable_hfp = TRUE; -- cgit From 22dd53fe6ef9783c3357a6da1ecedd3b01bb7003 Mon Sep 17 00:00:00 2001 From: Luiz Augusto von Dentz Date: Fri, 22 Jun 2007 20:58:12 +0000 Subject: Update build to make use of newly create files. --- audio/main.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'audio/main.c') diff --git a/audio/main.c b/audio/main.c index 0ca8ce87..4a32a320 100644 --- a/audio/main.c +++ b/audio/main.c @@ -40,7 +40,7 @@ /* Configuration settings */ static gboolean disable_hfp = TRUE; -static gboolean sco_hci = FALSE; +static gboolean sco_hci = TRUE; static GMainLoop *main_loop = NULL; @@ -137,7 +137,7 @@ int main(int argc, char *argv[]) exit(1); } - if (headset_server_init(conn, disable_hfp, sco_hci) < 0) { + if (gateway_init(conn, disable_hfp, sco_hci) < 0) { error("Headset initialization failed!"); exit(1); } @@ -149,7 +149,7 @@ int main(int argc, char *argv[]) audio_exit(); - headset_exit(); + gateway_exit(); unix_exit(); -- cgit From ebe177dc2e207790113fa0f34b758a5e4549f06d Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Sat, 23 Jun 2007 00:08:02 +0000 Subject: Fix default config settings --- audio/main.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'audio/main.c') diff --git a/audio/main.c b/audio/main.c index 4a32a320..a7c93201 100644 --- a/audio/main.c +++ b/audio/main.c @@ -38,9 +38,8 @@ #include "manager.h" -/* Configuration settings */ static gboolean disable_hfp = TRUE; -static gboolean sco_hci = TRUE; +static gboolean sco_hci = FALSE; static GMainLoop *main_loop = NULL; @@ -49,7 +48,7 @@ static void sig_term(int sig) g_main_loop_quit(main_loop); } -void read_config(const char *file) +static void read_config(const char *file) { GKeyFile *keyfile; GError *err = NULL; -- cgit From ac9481b7ad48944f727f6f42237e4e4da32a10a7 Mon Sep 17 00:00:00 2001 From: Luiz Augusto von Dentz Date: Fri, 20 Jul 2007 18:03:20 +0000 Subject: Move server registration and sdp record code from gateway to manager. --- audio/main.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) (limited to 'audio/main.c') diff --git a/audio/main.c b/audio/main.c index a7c93201..4da85a29 100644 --- a/audio/main.c +++ b/audio/main.c @@ -131,16 +131,11 @@ int main(int argc, char *argv[]) exit(1); } - if (audio_init(conn) < 0) { + if (audio_init(conn, disable_hfp, sco_hci) < 0) { error("Audio init failed!"); exit(1); } - if (gateway_init(conn, disable_hfp, sco_hci) < 0) { - error("Headset initialization failed!"); - exit(1); - } - if (argc > 1 && !strcmp(argv[1], "-s")) register_external_service(conn, "audio", "Audio service", ""); @@ -148,8 +143,6 @@ int main(int argc, char *argv[]) audio_exit(); - gateway_exit(); - unix_exit(); dbus_connection_unref(conn); -- cgit From 6763ebb3c231740c66a235f94d56e8d8cc213d90 Mon Sep 17 00:00:00 2001 From: Johan Hedberg Date: Sat, 11 Aug 2007 11:05:24 +0000 Subject: Integrate A2DP work from Johan's and Luiz's GIT trees --- audio/main.c | 48 +++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 39 insertions(+), 9 deletions(-) (limited to 'audio/main.c') diff --git a/audio/main.c b/audio/main.c index 4da85a29..72e54133 100644 --- a/audio/main.c +++ b/audio/main.c @@ -35,7 +35,7 @@ #include "dbus.h" #include "logging.h" - +#include "unix.h" #include "manager.h" static gboolean disable_hfp = TRUE; @@ -43,6 +43,15 @@ static gboolean sco_hci = FALSE; static GMainLoop *main_loop = NULL; +static struct enabled_interfaces enabled = { + .headset = TRUE, + .gateway = FALSE, + .sink = TRUE, + .source = FALSE, + .control = FALSE, + .target = FALSE, +}; + static void sig_term(int sig) { g_main_loop_quit(main_loop); @@ -53,7 +62,7 @@ static void read_config(const char *file) GKeyFile *keyfile; GError *err = NULL; gboolean no_hfp; - char *sco_routing; + char *str; keyfile = g_key_file_new(); @@ -64,21 +73,42 @@ static void read_config(const char *file) return; } - sco_routing = g_key_file_get_string(keyfile, "General", + str = g_key_file_get_string(keyfile, "General", "SCORouting", &err); if (err) { debug("%s: %s", file, err->message); g_error_free(err); err = NULL; } else { - if (strcmp(sco_routing, "PCM") == 0) + if (strcmp(str, "PCM") == 0) sco_hci = FALSE; - else if (strcmp(sco_routing, "HCI") == 0) + else if (strcmp(str, "HCI") == 0) sco_hci = TRUE; else - error("Invalid Headset Routing value: %s", - sco_routing); - g_free(sco_routing); + error("Invalid Headset Routing value: %s", str); + g_free(str); + } + + str = g_key_file_get_string(keyfile, "General", + "Disabled", &err); + if (err) { + debug("%s: %s", file, err->message); + g_error_free(err); + err = NULL; + } else { + if (strstr(str, "Headset")) + enabled.headset = FALSE; + if (strstr(str, "Gateway")) + enabled.gateway = FALSE; + if (strstr(str, "Sink")) + enabled.sink = FALSE; + if (strstr(str, "Source")) + enabled.source = FALSE; + if (strstr(str, "Control")) + enabled.control = FALSE; + if (strstr(str, "Target")) + enabled.target = FALSE; + g_free(str); } no_hfp = g_key_file_get_boolean(keyfile, "Headset", @@ -131,7 +161,7 @@ int main(int argc, char *argv[]) exit(1); } - if (audio_init(conn, disable_hfp, sco_hci) < 0) { + if (audio_init(conn, &enabled, disable_hfp, sco_hci) < 0) { error("Audio init failed!"); exit(1); } -- cgit From c2833e263d6cfc4cf82f4bfdcc59640a4071aeae Mon Sep 17 00:00:00 2001 From: Johan Hedberg Date: Mon, 13 Aug 2007 08:14:22 +0000 Subject: Remove ifndef protections and includes from .h files --- audio/main.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'audio/main.c') diff --git a/audio/main.c b/audio/main.c index 72e54133..9e677354 100644 --- a/audio/main.c +++ b/audio/main.c @@ -26,15 +26,18 @@ #endif #include +#include #include #include #include - #include +#include +#include #include "dbus.h" #include "logging.h" +#include "ipc.h" #include "unix.h" #include "manager.h" -- cgit From 2ec3960a534fe2e8e0d63cc3600ef1fd90505b0d Mon Sep 17 00:00:00 2001 From: Johan Hedberg Date: Thu, 23 Aug 2007 18:04:36 +0000 Subject: Update code to match example audio.conf --- audio/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'audio/main.c') diff --git a/audio/main.c b/audio/main.c index 9e677354..bd9cd0c5 100644 --- a/audio/main.c +++ b/audio/main.c @@ -93,7 +93,7 @@ static void read_config(const char *file) } str = g_key_file_get_string(keyfile, "General", - "Disabled", &err); + "Disable", &err); if (err) { debug("%s: %s", file, err->message); g_error_free(err); -- cgit From e1bfc91de96a38616100cc31db7bdb69f2cfbea6 Mon Sep 17 00:00:00 2001 From: Johan Hedberg Date: Mon, 27 Aug 2007 11:31:01 +0000 Subject: Convert alsa initiated headset connections to similar callback system that A2DP is already using --- audio/main.c | 1 - 1 file changed, 1 deletion(-) (limited to 'audio/main.c') diff --git a/audio/main.c b/audio/main.c index bd9cd0c5..3ca2ba40 100644 --- a/audio/main.c +++ b/audio/main.c @@ -37,7 +37,6 @@ #include "dbus.h" #include "logging.h" -#include "ipc.h" #include "unix.h" #include "manager.h" -- cgit From 296dcf42cf8a4f4d6f0192cac58a28887be38552 Mon Sep 17 00:00:00 2001 From: Johan Hedberg Date: Mon, 27 Aug 2007 12:05:10 +0000 Subject: First try at device autocreate support --- audio/main.c | 1 + 1 file changed, 1 insertion(+) (limited to 'audio/main.c') diff --git a/audio/main.c b/audio/main.c index 3ca2ba40..ae43f170 100644 --- a/audio/main.c +++ b/audio/main.c @@ -38,6 +38,7 @@ #include "dbus.h" #include "logging.h" #include "unix.h" +#include "device.h" #include "manager.h" static gboolean disable_hfp = TRUE; -- cgit From e2827b35575bab20a99a170805a0a59a32fb2c48 Mon Sep 17 00:00:00 2001 From: Johan Hedberg Date: Tue, 28 Aug 2007 09:54:21 +0000 Subject: Make SBC Audio Source count configurable and the default value 1 --- audio/main.c | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) (limited to 'audio/main.c') diff --git a/audio/main.c b/audio/main.c index ae43f170..8e27190c 100644 --- a/audio/main.c +++ b/audio/main.c @@ -43,6 +43,7 @@ static gboolean disable_hfp = TRUE; static gboolean sco_hci = FALSE; +static int source_count = 1; static GMainLoop *main_loop = NULL; @@ -123,9 +124,20 @@ static void read_config(const char *file) } else disable_hfp = no_hfp; - debug("Config options: DisableHFP=%s, SCORouting=%s", + str = g_key_file_get_string(keyfile, "A2DP", + "SourceCount", &err); + if (err) { + debug("%s: %s", file, err->message); + g_error_free(err); + err = NULL; + } else { + source_count = atoi(str); + g_free(str); + } + + debug("Config options: DisableHFP=%s, SCORouting=%s, SourceCount=%d", disable_hfp ? "true" : "false", - sco_hci ? "HCI" : "PCM"); + sco_hci ? "HCI" : "PCM", source_count); g_key_file_free(keyfile); } @@ -164,7 +176,8 @@ int main(int argc, char *argv[]) exit(1); } - if (audio_init(conn, &enabled, disable_hfp, sco_hci) < 0) { + if (audio_init(conn, &enabled, disable_hfp, sco_hci, + source_count) < 0) { error("Audio init failed!"); exit(1); } -- cgit From 1e7c36a80b7110b50bc71762f633af1a46b4609c Mon Sep 17 00:00:00 2001 From: Johan Hedberg Date: Tue, 28 Aug 2007 11:49:37 +0000 Subject: Make HCI routing the default --- audio/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'audio/main.c') diff --git a/audio/main.c b/audio/main.c index 8e27190c..e828f022 100644 --- a/audio/main.c +++ b/audio/main.c @@ -42,7 +42,7 @@ #include "manager.h" static gboolean disable_hfp = TRUE; -static gboolean sco_hci = FALSE; +static gboolean sco_hci = TRUE; static int source_count = 1; static GMainLoop *main_loop = NULL; -- cgit From 10abd63aeb3665b2dcade32b6397a485579638ec Mon Sep 17 00:00:00 2001 From: Johan Hedberg Date: Tue, 28 Aug 2007 12:01:15 +0000 Subject: Minor coding style cleanup --- audio/main.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) (limited to 'audio/main.c') diff --git a/audio/main.c b/audio/main.c index e828f022..fb199a4b 100644 --- a/audio/main.c +++ b/audio/main.c @@ -77,8 +77,7 @@ static void read_config(const char *file) return; } - str = g_key_file_get_string(keyfile, "General", - "SCORouting", &err); + str = g_key_file_get_string(keyfile, "General", "SCORouting", &err); if (err) { debug("%s: %s", file, err->message); g_error_free(err); @@ -93,8 +92,7 @@ static void read_config(const char *file) g_free(str); } - str = g_key_file_get_string(keyfile, "General", - "Disable", &err); + str = g_key_file_get_string(keyfile, "General", "Disable", &err); if (err) { debug("%s: %s", file, err->message); g_error_free(err); @@ -115,8 +113,8 @@ static void read_config(const char *file) g_free(str); } - no_hfp = g_key_file_get_boolean(keyfile, "Headset", - "DisableHFP", &err); + no_hfp = g_key_file_get_boolean(keyfile, "Headset", "DisableHFP", + &err); if (err) { debug("%s: %s", file, err->message); g_error_free(err); @@ -124,8 +122,7 @@ static void read_config(const char *file) } else disable_hfp = no_hfp; - str = g_key_file_get_string(keyfile, "A2DP", - "SourceCount", &err); + str = g_key_file_get_string(keyfile, "A2DP", "SourceCount", &err); if (err) { debug("%s: %s", file, err->message); g_error_free(err); -- cgit From de72271829f6bfd21aa6550a2ac6d81e35b53cad Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Tue, 23 Oct 2007 17:17:47 +0000 Subject: Update copyright information --- audio/main.c | 1 + 1 file changed, 1 insertion(+) (limited to 'audio/main.c') diff --git a/audio/main.c b/audio/main.c index fb199a4b..2ec605d0 100644 --- a/audio/main.c +++ b/audio/main.c @@ -2,6 +2,7 @@ * * BlueZ - Bluetooth protocol stack for Linux * + * Copyright (C) 2006-2007 Nokia Corporation * Copyright (C) 2004-2007 Marcel Holtmann * * -- cgit From 999314c0bc7a87f1fb4a771569aaed99aa9ac5b6 Mon Sep 17 00:00:00 2001 From: Johan Hedberg Date: Wed, 24 Oct 2007 20:02:53 +0000 Subject: Add support for Enable config option --- audio/main.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'audio/main.c') diff --git a/audio/main.c b/audio/main.c index 2ec605d0..61ca1e3e 100644 --- a/audio/main.c +++ b/audio/main.c @@ -93,6 +93,27 @@ static void read_config(const char *file) g_free(str); } + str = g_key_file_get_string(keyfile, "General", "Enable", &err); + if (err) { + debug("%s: %s", file, err->message); + g_error_free(err); + err = NULL; + } else { + if (strstr(str, "Headset")) + enabled.headset = TRUE; + if (strstr(str, "Gateway")) + enabled.gateway = TRUE; + if (strstr(str, "Sink")) + enabled.sink = TRUE; + if (strstr(str, "Source")) + enabled.source = TRUE; + if (strstr(str, "Control")) + enabled.control = TRUE; + if (strstr(str, "Target")) + enabled.target = TRUE; + g_free(str); + } + str = g_key_file_get_string(keyfile, "General", "Disable", &err); if (err) { debug("%s: %s", file, err->message); -- cgit From 9a6980f36017217d56c34d736dd31128e2e73cb4 Mon Sep 17 00:00:00 2001 From: Johan Hedberg Date: Tue, 27 Nov 2007 09:15:54 +0000 Subject: Enable AVRCP by default --- audio/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'audio/main.c') diff --git a/audio/main.c b/audio/main.c index 61ca1e3e..52396beb 100644 --- a/audio/main.c +++ b/audio/main.c @@ -53,7 +53,7 @@ static struct enabled_interfaces enabled = { .gateway = FALSE, .sink = TRUE, .source = FALSE, - .control = FALSE, + .control = TRUE, .target = FALSE, }; -- cgit From 3eb854122f31b55fc4ba56b5ce555c380947f710 Mon Sep 17 00:00:00 2001 From: Johan Hedberg Date: Wed, 16 Jan 2008 09:08:26 +0000 Subject: Reorganize audio.conf parsing in a more modular manner --- audio/main.c | 111 +++++------------------------------------------------------ 1 file changed, 9 insertions(+), 102 deletions(-) (limited to 'audio/main.c') diff --git a/audio/main.c b/audio/main.c index 52396beb..75cb67e6 100644 --- a/audio/main.c +++ b/audio/main.c @@ -42,32 +42,17 @@ #include "device.h" #include "manager.h" -static gboolean disable_hfp = TRUE; -static gboolean sco_hci = TRUE; -static int source_count = 1; - static GMainLoop *main_loop = NULL; -static struct enabled_interfaces enabled = { - .headset = TRUE, - .gateway = FALSE, - .sink = TRUE, - .source = FALSE, - .control = TRUE, - .target = FALSE, -}; - static void sig_term(int sig) { g_main_loop_quit(main_loop); } -static void read_config(const char *file) +static GKeyFile *load_config_file(const char *file) { - GKeyFile *keyfile; GError *err = NULL; - gboolean no_hfp; - char *str; + GKeyFile *keyfile; keyfile = g_key_file_new(); @@ -75,96 +60,17 @@ static void read_config(const char *file) error("Parsing %s failed: %s", file, err->message); g_error_free(err); g_key_file_free(keyfile); - return; - } - - str = g_key_file_get_string(keyfile, "General", "SCORouting", &err); - if (err) { - debug("%s: %s", file, err->message); - g_error_free(err); - err = NULL; - } else { - if (strcmp(str, "PCM") == 0) - sco_hci = FALSE; - else if (strcmp(str, "HCI") == 0) - sco_hci = TRUE; - else - error("Invalid Headset Routing value: %s", str); - g_free(str); - } - - str = g_key_file_get_string(keyfile, "General", "Enable", &err); - if (err) { - debug("%s: %s", file, err->message); - g_error_free(err); - err = NULL; - } else { - if (strstr(str, "Headset")) - enabled.headset = TRUE; - if (strstr(str, "Gateway")) - enabled.gateway = TRUE; - if (strstr(str, "Sink")) - enabled.sink = TRUE; - if (strstr(str, "Source")) - enabled.source = TRUE; - if (strstr(str, "Control")) - enabled.control = TRUE; - if (strstr(str, "Target")) - enabled.target = TRUE; - g_free(str); + return NULL; } - str = g_key_file_get_string(keyfile, "General", "Disable", &err); - if (err) { - debug("%s: %s", file, err->message); - g_error_free(err); - err = NULL; - } else { - if (strstr(str, "Headset")) - enabled.headset = FALSE; - if (strstr(str, "Gateway")) - enabled.gateway = FALSE; - if (strstr(str, "Sink")) - enabled.sink = FALSE; - if (strstr(str, "Source")) - enabled.source = FALSE; - if (strstr(str, "Control")) - enabled.control = FALSE; - if (strstr(str, "Target")) - enabled.target = FALSE; - g_free(str); - } - - no_hfp = g_key_file_get_boolean(keyfile, "Headset", "DisableHFP", - &err); - if (err) { - debug("%s: %s", file, err->message); - g_error_free(err); - err = NULL; - } else - disable_hfp = no_hfp; - - str = g_key_file_get_string(keyfile, "A2DP", "SourceCount", &err); - if (err) { - debug("%s: %s", file, err->message); - g_error_free(err); - err = NULL; - } else { - source_count = atoi(str); - g_free(str); - } - - debug("Config options: DisableHFP=%s, SCORouting=%s, SourceCount=%d", - disable_hfp ? "true" : "false", - sco_hci ? "HCI" : "PCM", source_count); - - g_key_file_free(keyfile); + return keyfile; } int main(int argc, char *argv[]) { DBusConnection *conn; struct sigaction sa; + GKeyFile *config; start_logging("audio", "Bluetooth Audio daemon"); @@ -180,7 +86,7 @@ int main(int argc, char *argv[]) enable_debug(); - read_config(CONFIGDIR "/audio.conf"); + config = load_config_file(CONFIGDIR "/audio.conf"); main_loop = g_main_loop_new(NULL, FALSE); @@ -195,14 +101,15 @@ int main(int argc, char *argv[]) exit(1); } - if (audio_init(conn, &enabled, disable_hfp, sco_hci, - source_count) < 0) { + if (audio_init(conn, config) < 0) { error("Audio init failed!"); exit(1); } if (argc > 1 && !strcmp(argv[1], "-s")) register_external_service(conn, "audio", "Audio service", ""); + if (config) + g_key_file_free(config); g_main_loop_run(main_loop); -- cgit From e823c15e43a6f924779e466d434c51157002d9ee Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Sat, 2 Feb 2008 03:37:05 +0000 Subject: Update copyright information --- audio/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'audio/main.c') diff --git a/audio/main.c b/audio/main.c index 75cb67e6..6c6b0d79 100644 --- a/audio/main.c +++ b/audio/main.c @@ -3,7 +3,7 @@ * BlueZ - Bluetooth protocol stack for Linux * * Copyright (C) 2006-2007 Nokia Corporation - * Copyright (C) 2004-2007 Marcel Holtmann + * Copyright (C) 2004-2008 Marcel Holtmann * * * This program is free software; you can redistribute it and/or modify -- cgit From 7299869ac79b76564cd68411acb18f4233ddbbb7 Mon Sep 17 00:00:00 2001 From: Luiz Augusto von Dentz Date: Thu, 27 Mar 2008 23:07:19 +0000 Subject: Convert audio service into a plugin. --- audio/main.c | 80 +++++++++++++++++++----------------------------------------- 1 file changed, 25 insertions(+), 55 deletions(-) (limited to 'audio/main.c') diff --git a/audio/main.c b/audio/main.c index 6c6b0d79..f96b19f8 100644 --- a/audio/main.c +++ b/audio/main.c @@ -26,29 +26,21 @@ #include #endif -#include -#include -#include -#include +#include +#include +#include +#include #include #include -#include -#include +#include "plugin.h" #include "dbus.h" #include "logging.h" #include "unix.h" #include "device.h" #include "manager.h" -static GMainLoop *main_loop = NULL; - -static void sig_term(int sig) -{ - g_main_loop_quit(main_loop); -} - static GKeyFile *load_config_file(const char *file) { GError *err = NULL; @@ -66,64 +58,42 @@ static GKeyFile *load_config_file(const char *file) return keyfile; } -int main(int argc, char *argv[]) +static DBusConnection *conn; + +static int audio_init(void) { - DBusConnection *conn; - struct sigaction sa; GKeyFile *config; - start_logging("audio", "Bluetooth Audio daemon"); - - memset(&sa, 0, sizeof(sa)); - sa.sa_flags = SA_NOCLDSTOP; - sa.sa_handler = sig_term; - sigaction(SIGTERM, &sa, NULL); - sigaction(SIGINT, &sa, NULL); - - sa.sa_handler = SIG_IGN; - sigaction(SIGCHLD, &sa, NULL); - sigaction(SIGPIPE, &sa, NULL); - - enable_debug(); + conn = dbus_bus_get(DBUS_BUS_SYSTEM, NULL); + if (conn == NULL) + return -EIO; config = load_config_file(CONFIGDIR "/audio.conf"); - main_loop = g_main_loop_new(NULL, FALSE); - - conn = dbus_bus_system_setup_with_main_loop(NULL, NULL, NULL); - if (!conn) { - g_main_loop_unref(main_loop); - exit(1); - } - if (unix_init() < 0) { error("Unable to setup unix socket"); - exit(1); + return -EIO; } - if (audio_init(conn, config) < 0) { - error("Audio init failed!"); - exit(1); + if (audio_manager_init(conn, config) < 0) { + dbus_connection_unref(conn); + return -EIO; } - if (argc > 1 && !strcmp(argv[1], "-s")) - register_external_service(conn, "audio", "Audio service", ""); - if (config) - g_key_file_free(config); + g_key_file_free(config); + + register_external_service(conn, "audio", "audio service", ""); - g_main_loop_run(main_loop); + return 0; +} - audio_exit(); +static void audio_exit(void) +{ + audio_manager_exit(); unix_exit(); dbus_connection_unref(conn); - - g_main_loop_unref(main_loop); - - info("Exit"); - - stop_logging(); - - return 0; } + +BLUETOOTH_PLUGIN_DEFINE("audio", audio_init, audio_exit) -- cgit From 34b8fd54ca89ff67e3f319747dcf3cf8b9e305f5 Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Fri, 28 Mar 2008 20:46:51 +0000 Subject: Fix service description --- audio/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'audio/main.c') diff --git a/audio/main.c b/audio/main.c index f96b19f8..b2566c95 100644 --- a/audio/main.c +++ b/audio/main.c @@ -82,7 +82,7 @@ static int audio_init(void) g_key_file_free(config); - register_external_service(conn, "audio", "audio service", ""); + register_external_service(conn, "audio", "Audio service", ""); return 0; } -- cgit From 098cd10838193272c669348c5ffd0410218e1bcc Mon Sep 17 00:00:00 2001 From: Claudio Takahasi Date: Thu, 1 May 2008 01:05:46 +0000 Subject: fixed service authorization --- audio/main.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'audio/main.c') diff --git a/audio/main.c b/audio/main.c index b2566c95..47e2c513 100644 --- a/audio/main.c +++ b/audio/main.c @@ -41,6 +41,20 @@ #include "device.h" #include "manager.h" +static const char *uuids[] = { + GENERIC_AUDIO_UUID, + HSP_HS_UUID, + HSP_AG_UUID, + HFP_HS_UUID, + HFP_AG_UUID, + ADVANCED_AUDIO_UUID, + A2DP_SOURCE_UUID, + A2DP_SINK_UUID, + AVRCP_REMOTE_UUID, + AVRCP_TARGET_UUID, + NULL +}; + static GKeyFile *load_config_file(const char *file) { GError *err = NULL; @@ -82,6 +96,8 @@ static int audio_init(void) g_key_file_free(config); + register_uuids("audio", &uuids); + register_external_service(conn, "audio", "Audio service", ""); return 0; -- cgit From 3f8860031e5241fbb145fdd71e1a46c2c28f393e Mon Sep 17 00:00:00 2001 From: Claudio Takahasi Date: Thu, 1 May 2008 01:23:02 +0000 Subject: fixed build warnings --- audio/main.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'audio/main.c') diff --git a/audio/main.c b/audio/main.c index 47e2c513..22a5e20a 100644 --- a/audio/main.c +++ b/audio/main.c @@ -35,6 +35,7 @@ #include #include "plugin.h" +#include "dbus-service.h" #include "dbus.h" #include "logging.h" #include "unix.h" @@ -96,7 +97,7 @@ static int audio_init(void) g_key_file_free(config); - register_uuids("audio", &uuids); + register_uuids("audio", uuids); register_external_service(conn, "audio", "Audio service", ""); -- cgit From 9491a544f622e40453265c30f24ce44a61440cc1 Mon Sep 17 00:00:00 2001 From: Claudio Takahasi Date: Thu, 1 May 2008 13:52:26 +0000 Subject: Moving authorization code to dbus-service.c --- audio/main.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'audio/main.c') diff --git a/audio/main.c b/audio/main.c index 22a5e20a..eaa04806 100644 --- a/audio/main.c +++ b/audio/main.c @@ -29,14 +29,13 @@ #include #include #include -#include #include -#include + +#include "dbus.h" #include "plugin.h" #include "dbus-service.h" -#include "dbus.h" #include "logging.h" #include "unix.h" #include "device.h" -- cgit From 2af3c3a7ddc43577c067892cdfdc06dc4e63386c Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Thu, 8 May 2008 17:24:48 +0000 Subject: Remove service daemon activation handling --- audio/main.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'audio/main.c') diff --git a/audio/main.c b/audio/main.c index eaa04806..f54f74de 100644 --- a/audio/main.c +++ b/audio/main.c @@ -96,15 +96,19 @@ static int audio_init(void) g_key_file_free(config); - register_uuids("audio", uuids); + register_service("audio"); - register_external_service(conn, "audio", "Audio service", ""); + register_uuids("audio", uuids); return 0; } static void audio_exit(void) { + unregister_uuids("audio"); + + unregister_service("audio"); + audio_manager_exit(); unix_exit(); -- cgit From b5514e6c7f0258da455bbde02482fbcdb29d4442 Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Thu, 8 May 2008 18:37:09 +0000 Subject: Register service and UUIDs in one step --- audio/main.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) (limited to 'audio/main.c') diff --git a/audio/main.c b/audio/main.c index f54f74de..5b4e395b 100644 --- a/audio/main.c +++ b/audio/main.c @@ -96,17 +96,13 @@ static int audio_init(void) g_key_file_free(config); - register_service("audio"); - - register_uuids("audio", uuids); + register_service("audio", uuids); return 0; } static void audio_exit(void) { - unregister_uuids("audio"); - unregister_service("audio"); audio_manager_exit(); -- cgit From e7d668ac9e813bc9922ee7d771848bd8822d5d1f Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Thu, 8 May 2008 20:23:45 +0000 Subject: Move D-Bus watch functions into libgdbus --- audio/main.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'audio/main.c') diff --git a/audio/main.c b/audio/main.c index 5b4e395b..ef606223 100644 --- a/audio/main.c +++ b/audio/main.c @@ -31,8 +31,7 @@ #include #include - -#include "dbus.h" +#include #include "plugin.h" #include "dbus-service.h" -- cgit From 067f966a9b5ed7e8e28b5f2b483fb4650da9de88 Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Thu, 15 May 2008 02:51:55 +0000 Subject: Fix default value handling when config file is not present --- audio/main.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'audio/main.c') diff --git a/audio/main.c b/audio/main.c index ef606223..6419da9a 100644 --- a/audio/main.c +++ b/audio/main.c @@ -93,7 +93,8 @@ static int audio_init(void) return -EIO; } - g_key_file_free(config); + if (config) + g_key_file_free(config); register_service("audio", uuids); -- cgit From caf9fdd6d0183afc3b21d1cd82eb637773c131de Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Thu, 29 May 2008 08:05:16 +0000 Subject: Replace struct device with struct audio_device --- audio/main.c | 49 ++++++++++++++++++++++++++++++++----------------- 1 file changed, 32 insertions(+), 17 deletions(-) (limited to 'audio/main.c') diff --git a/audio/main.c b/audio/main.c index 6419da9a..2b9a1e95 100644 --- a/audio/main.c +++ b/audio/main.c @@ -34,24 +34,41 @@ #include #include "plugin.h" -#include "dbus-service.h" +#include "../hcid/device.h" #include "logging.h" #include "unix.h" #include "device.h" #include "manager.h" -static const char *uuids[] = { - GENERIC_AUDIO_UUID, - HSP_HS_UUID, - HSP_AG_UUID, - HFP_HS_UUID, - HFP_AG_UUID, - ADVANCED_AUDIO_UUID, - A2DP_SOURCE_UUID, - A2DP_SINK_UUID, - AVRCP_REMOTE_UUID, - AVRCP_TARGET_UUID, - NULL +static DBusConnection *conn; + +static int audio_probe(const char *path) +{ + debug("path %s", path); + + return 0; +} + +static void audio_remove(const char *path) +{ + debug("path %s", path); +} + +static struct btd_device_driver audio_driver = { + .name = "audio", + .uuids = BTD_UUIDS( + GENERIC_AUDIO_UUID, + HSP_HS_UUID, + HSP_AG_UUID, + HFP_HS_UUID, + HFP_AG_UUID, + ADVANCED_AUDIO_UUID, + A2DP_SOURCE_UUID, + A2DP_SINK_UUID, + AVRCP_REMOTE_UUID, + AVRCP_TARGET_UUID), + .probe = audio_probe, + .remove = audio_remove, }; static GKeyFile *load_config_file(const char *file) @@ -71,8 +88,6 @@ static GKeyFile *load_config_file(const char *file) return keyfile; } -static DBusConnection *conn; - static int audio_init(void) { GKeyFile *config; @@ -96,14 +111,14 @@ static int audio_init(void) if (config) g_key_file_free(config); - register_service("audio", uuids); + btd_register_device_driver(&audio_driver); return 0; } static void audio_exit(void) { - unregister_service("audio"); + btd_unregister_device_driver(&audio_driver); audio_manager_exit(); -- cgit From 8bf636881f152a97727774f4f9ea2504c72dfb23 Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Sun, 8 Jun 2008 20:54:55 +0000 Subject: Use DBG in plugin to show function names --- audio/main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'audio/main.c') diff --git a/audio/main.c b/audio/main.c index 2b9a1e95..06a2a046 100644 --- a/audio/main.c +++ b/audio/main.c @@ -44,14 +44,14 @@ static DBusConnection *conn; static int audio_probe(const char *path) { - debug("path %s", path); + DBG("path %s", path); return 0; } static void audio_remove(const char *path) { - debug("path %s", path); + DBG("path %s", path); } static struct btd_device_driver audio_driver = { -- cgit From 6a87d1b7e5ad1046abfcc2e89cc924b6e1d0db67 Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Sun, 8 Jun 2008 21:13:23 +0000 Subject: Have the audio plugin register headset and sink drivers --- audio/main.c | 51 ++++++++++++++++++++++++++++++++------------------- 1 file changed, 32 insertions(+), 19 deletions(-) (limited to 'audio/main.c') diff --git a/audio/main.c b/audio/main.c index 06a2a046..9b780aa0 100644 --- a/audio/main.c +++ b/audio/main.c @@ -42,33 +42,42 @@ static DBusConnection *conn; -static int audio_probe(const char *path) +static int headset_probe(const char *path) { DBG("path %s", path); return 0; } -static void audio_remove(const char *path) +static void headset_remove(const char *path) { DBG("path %s", path); } -static struct btd_device_driver audio_driver = { - .name = "audio", - .uuids = BTD_UUIDS( - GENERIC_AUDIO_UUID, - HSP_HS_UUID, - HSP_AG_UUID, - HFP_HS_UUID, - HFP_AG_UUID, - ADVANCED_AUDIO_UUID, - A2DP_SOURCE_UUID, - A2DP_SINK_UUID, - AVRCP_REMOTE_UUID, - AVRCP_TARGET_UUID), - .probe = audio_probe, - .remove = audio_remove, +static struct btd_device_driver headset_driver = { + .name = "headset", + .uuids = BTD_UUIDS(HSP_HS_UUID, HFP_HS_UUID), + .probe = headset_probe, + .remove = headset_remove, +}; + +static int a2dp_probe(const char *path) +{ + DBG("path %s", path); + + return 0; +} + +static void a2dp_remove(const char *path) +{ + DBG("path %s", path); +} + +static struct btd_device_driver a2dp_driver = { + .name = "sink", + .uuids = BTD_UUIDS(A2DP_SINK_UUID), + .probe = a2dp_probe, + .remove = a2dp_remove, }; static GKeyFile *load_config_file(const char *file) @@ -111,14 +120,18 @@ static int audio_init(void) if (config) g_key_file_free(config); - btd_register_device_driver(&audio_driver); + btd_register_device_driver(&headset_driver); + + btd_register_device_driver(&a2dp_driver); return 0; } static void audio_exit(void) { - btd_unregister_device_driver(&audio_driver); + btd_unregister_device_driver(&a2dp_driver); + + btd_unregister_device_driver(&headset_driver); audio_manager_exit(); -- cgit From 5243ac4fd278b0176ece84cbcec537a92a9c7290 Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Sun, 8 Jun 2008 22:57:11 +0000 Subject: Update probe/remove callback and implement serial API --- audio/main.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'audio/main.c') diff --git a/audio/main.c b/audio/main.c index 9b780aa0..86efce27 100644 --- a/audio/main.c +++ b/audio/main.c @@ -42,16 +42,16 @@ static DBusConnection *conn; -static int headset_probe(const char *path) +static int headset_probe(struct btd_device *device) { - DBG("path %s", path); + DBG("path %s", device->path); return 0; } -static void headset_remove(const char *path) +static void headset_remove(struct btd_device *device) { - DBG("path %s", path); + DBG("path %s", device->path); } static struct btd_device_driver headset_driver = { @@ -61,16 +61,16 @@ static struct btd_device_driver headset_driver = { .remove = headset_remove, }; -static int a2dp_probe(const char *path) +static int a2dp_probe(struct btd_device *device) { - DBG("path %s", path); + DBG("path %s", device->path); return 0; } -static void a2dp_remove(const char *path) +static void a2dp_remove(struct btd_device *device) { - DBG("path %s", path); + DBG("path %s", device->path); } static struct btd_device_driver a2dp_driver = { -- cgit From e8ca2351ee3ba3f8b2b99731972234f42ae9b64b Mon Sep 17 00:00:00 2001 From: Luiz Augusto von Dentz Date: Tue, 17 Jun 2008 19:37:36 +0000 Subject: Fix authorization mechanism for 3.x. --- audio/main.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'audio/main.c') diff --git a/audio/main.c b/audio/main.c index 86efce27..bbe06e05 100644 --- a/audio/main.c +++ b/audio/main.c @@ -80,6 +80,28 @@ static struct btd_device_driver a2dp_driver = { .remove = a2dp_remove, }; +static int audio_probe(struct btd_device *device) +{ + DBG("path %s", device->path); + + return 0; +} + +static void audio_remove(struct btd_device *device) +{ + DBG("path %s", device->path); +} + +static struct btd_device_driver audio_driver = { + .name = "audio", + .uuids = BTD_UUIDS(HSP_HS_UUID, HFP_HS_UUID, HSP_AG_UUID, HFP_AG_UUID, + ADVANCED_AUDIO_UUID, A2DP_SOURCE_UUID, A2DP_SINK_UUID, + AVRCP_TARGET_UUID, AVRCP_REMOTE_UUID), + .probe = audio_probe, + .remove = audio_remove, +}; + + static GKeyFile *load_config_file(const char *file) { GError *err = NULL; @@ -124,11 +146,15 @@ static int audio_init(void) btd_register_device_driver(&a2dp_driver); + btd_register_device_driver(&audio_driver); + return 0; } static void audio_exit(void) { + btd_unregister_device_driver(&audio_driver); + btd_unregister_device_driver(&a2dp_driver); btd_unregister_device_driver(&headset_driver); -- cgit From c4139033616c53b1f790fe165d1a22fcce292e74 Mon Sep 17 00:00:00 2001 From: Claudio Takahasi Date: Mon, 30 Jun 2008 17:35:47 +0000 Subject: Fixed missing include --- audio/main.c | 1 + 1 file changed, 1 insertion(+) (limited to 'audio/main.c') diff --git a/audio/main.c b/audio/main.c index bbe06e05..607e3ca9 100644 --- a/audio/main.c +++ b/audio/main.c @@ -29,6 +29,7 @@ #include #include #include +#include #include #include -- cgit