diff options
Diffstat (limited to 'src/modules/bluetooth/module-bluetooth-discover.c')
-rw-r--r-- | src/modules/bluetooth/module-bluetooth-discover.c | 27 |
1 files changed, 21 insertions, 6 deletions
diff --git a/src/modules/bluetooth/module-bluetooth-discover.c b/src/modules/bluetooth/module-bluetooth-discover.c index a33ca648..2fe09370 100644 --- a/src/modules/bluetooth/module-bluetooth-discover.c +++ b/src/modules/bluetooth/module-bluetooth-discover.c @@ -44,7 +44,7 @@ PA_MODULE_USAGE(""); struct module { char *profile; - pa_module *pa_m; + uint32_t index; PA_LLIST_FIELDS(struct module); }; @@ -78,7 +78,7 @@ static struct module *module_new(const char *profile, pa_module *pa_m) { m = pa_xnew(struct module, 1); m->profile = pa_xstrdup(profile); - m->pa_m = pa_m; + m->index = pa_m->index; PA_LLIST_INIT(struct module, m); return m; @@ -94,7 +94,7 @@ static void module_free(struct module *m) { static struct module* module_find(struct device *d, const char *profile) { struct module *m; - for (m = d->module_list; d; d = d->next) + for (m = d->module_list; m; m = m->next) if (pa_streq(m->profile, profile)) return m; @@ -346,7 +346,7 @@ static void load_module_for_device(struct userdata *u, struct device *d, const c pa_m = pa_module_load(u->module->core, "module-bluetooth-device", args); pa_xfree(args); - if (!m) { + if (!pa_m) { pa_log_debug("Failed to load module for device %s", d->object_path); return; } @@ -364,7 +364,7 @@ static void unload_module_for_device(struct userdata *u, struct device *d, const if (!(m = module_find(d, profile))) return; - pa_module_unload_request(m->pa_m, TRUE); + pa_module_unload_request_by_index(u->module->core, m->index, TRUE); PA_LLIST_REMOVE(struct module, d->module_list, m); module_free(m); @@ -485,8 +485,23 @@ void pa__done(pa_module* m) { device_free(i); } - if (u->conn) + if (u->conn) { + DBusError error; + dbus_error_init(&error); + + dbus_bus_remove_match(pa_dbus_connection_get(u->conn), "type='signal',sender='org.bluez',interface='org.bluez.Adapter',member='DeviceRemoved'", &error); + dbus_error_free(&error); + + dbus_bus_remove_match(pa_dbus_connection_get(u->conn), "type='signal',sender='org.bluez',interface='org.bluez.Headset',member='PropertyChanged'", &error); + dbus_error_free(&error); + + dbus_bus_remove_match(pa_dbus_connection_get(u->conn), "type='signal',sender='org.bluez',interface='org.bluez.AudioSink',member='PropertyChanged'", &error); + dbus_error_free(&error); + + dbus_connection_remove_filter(pa_dbus_connection_get(u->conn), filter_cb, u); + pa_dbus_connection_unref(u->conn); + } pa_xfree(u); } |