summaryrefslogtreecommitdiffstats
path: root/audio
diff options
context:
space:
mode:
authorLuiz Augusto von Dentz <luiz.dentz@openbossa.org>2007-07-10 18:10:35 +0000
committerLuiz Augusto von Dentz <luiz.dentz@openbossa.org>2007-07-10 18:10:35 +0000
commita96cee3d98d347664998c718a47082492bb9af3d (patch)
tree10c1c7173e5256e22e4a5354bb776eb6bd41f8e0 /audio
parent66d48b0ac25c85de354f26782a377d0ad91bd322 (diff)
Fix loading default device from every adapter present and devices that are was previous loaded.
Diffstat (limited to 'audio')
-rw-r--r--audio/manager.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/audio/manager.c b/audio/manager.c
index 00f5d931..23811ae2 100644
--- a/audio/manager.c
+++ b/audio/manager.c
@@ -1094,8 +1094,13 @@ static void parse_stored_devices(char *key, char *value, void *data)
if (!key || !value || strcmp(key, "default") == 0)
return;
- info("Loading device %s (%s)", key, value);
str2ba(key, &dst);
+ device = find_device(&dst);
+
+ if (device)
+ return;
+
+ info("Loading device %s (%s)", key, value);
device = create_device(&dst);
if (!device)
@@ -1112,9 +1117,11 @@ static void register_devices_stored(const char *adapter)
char filename[PATH_MAX + 1];
struct stat st;
struct device *device;
+ bdaddr_t default_src;
bdaddr_t src;
bdaddr_t dst;
char *addr;
+ int dev_id;
create_name(filename, PATH_MAX, STORAGEDIR, adapter, "audio");
@@ -1128,6 +1135,14 @@ static void register_devices_stored(const char *adapter)
textfile_foreach(filename, parse_stored_devices, &src);
+ bacpy(&default_src, BDADDR_ANY);
+ dev_id = hci_get_route(NULL);
+ if (dev_id < 0)
+ hci_devba(dev_id, &default_src);
+
+ if (bacmp(&default_src, &src) != 0)
+ return;
+
addr = textfile_get(filename, "default");
if (!addr)
return;