diff options
author | Johan Hedberg <johan.hedberg@nokia.com> | 2007-08-11 11:05:24 +0000 |
---|---|---|
committer | Johan Hedberg <johan.hedberg@nokia.com> | 2007-08-11 11:05:24 +0000 |
commit | 6763ebb3c231740c66a235f94d56e8d8cc213d90 (patch) | |
tree | 527ad7a778289b70ac64b2d4e49512eae6d634e2 /audio/main.c | |
parent | 46e860574f3d6d70d961e38270522764191cea20 (diff) |
Integrate A2DP work from Johan's and Luiz's GIT trees
Diffstat (limited to 'audio/main.c')
-rw-r--r-- | audio/main.c | 48 |
1 files changed, 39 insertions, 9 deletions
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); } |