summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLuiz Augusto von Dentz <luiz.dentz@openbossa.org>2007-10-09 13:31:57 +0000
committerLuiz Augusto von Dentz <luiz.dentz@openbossa.org>2007-10-09 13:31:57 +0000
commitaf44f3cafbe4a2a2f2c4bb5879d803f766cf775a (patch)
tree305615a154490bd3175c6fe093a69bff46159ac8
parent0d1a32ac9d3fcdcbcd4ea20b76a1818db819fea7 (diff)
Fix device removal when it is not the current adapter.
-rw-r--r--audio/device.c5
-rw-r--r--audio/device.h1
-rw-r--r--audio/manager.c4
3 files changed, 8 insertions, 2 deletions
diff --git a/audio/device.c b/audio/device.c
index 9c90ed43..9b76e019 100644
--- a/audio/device.c
+++ b/audio/device.c
@@ -301,6 +301,7 @@ struct device *device_register(DBusConnection *conn,
dev->path = g_strdup(path);
bacpy(&dev->dst, bda);
bacpy(&dev->src, &src);
+ bacpy(&dev->store, &src);
dev->conn = dbus_connection_ref(conn);
return dev;
@@ -317,7 +318,7 @@ int device_store(struct device *dev, gboolean is_default)
return -EINVAL;
ba2str(&dev->dst, dst_addr);
- ba2str(&dev->src, src_addr);
+ ba2str(&dev->store, src_addr);
create_name(filename, PATH_MAX, STORAGEDIR, src_addr, "audio");
create_file(filename, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
@@ -356,7 +357,7 @@ int device_remove_stored(struct device *dev)
char src_addr[18], dst_addr[18];
ba2str(&dev->dst, dst_addr);
- ba2str(&dev->src, src_addr);
+ ba2str(&dev->store, src_addr);
create_name(filename, PATH_MAX, STORAGEDIR, src_addr, "audio");
diff --git a/audio/device.h b/audio/device.h
index a9954314..61ccc677 100644
--- a/audio/device.h
+++ b/audio/device.h
@@ -55,6 +55,7 @@ struct device {
DBusConnection *conn;
char *adapter_path;
char *path;
+ bdaddr_t store;
bdaddr_t src;
bdaddr_t dst;
diff --git a/audio/manager.c b/audio/manager.c
index e1fb81ce..f5a67cac 100644
--- a/audio/manager.c
+++ b/audio/manager.c
@@ -1024,6 +1024,7 @@ static DBusSignalVTable manager_signals[] = {
static void parse_stored_devices(char *key, char *value, void *data)
{
+ bdaddr_t *src = data;
struct device *device;
bdaddr_t dst;
@@ -1042,6 +1043,9 @@ static void parse_stored_devices(char *key, char *value, void *data)
if (!device)
return;
+ /* Change storage to source adapter */
+ bacpy(&device->store, src);
+
if (strstr(value, "headset"))
device->headset = headset_init(device, NULL, 0);
if (strstr(value, "sink"))