mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-04 13:30:12 -05:00
parent
529f4d318f
commit
68677774fc
2 changed files with 17 additions and 17 deletions
|
|
@ -757,6 +757,7 @@ static int device_connected_old(struct spa_bt_monitor *monitor, struct spa_bt_de
|
||||||
info.props = &SPA_DICT_INIT(items, n_items);
|
info.props = &SPA_DICT_INIT(items, n_items);
|
||||||
spa_device_emit_object_info(&monitor->hooks, device->id, &info);
|
spa_device_emit_object_info(&monitor->hooks, device->id, &info);
|
||||||
} else {
|
} else {
|
||||||
|
device->added = false;
|
||||||
battery_remove(device);
|
battery_remove(device);
|
||||||
spa_bt_device_release_transports(device);
|
spa_bt_device_release_transports(device);
|
||||||
spa_device_emit_object_info(&monitor->hooks, device->id, NULL);
|
spa_device_emit_object_info(&monitor->hooks, device->id, NULL);
|
||||||
|
|
@ -833,10 +834,6 @@ static int device_connected(struct spa_bt_monitor *monitor, struct spa_bt_device
|
||||||
info.props = &SPA_DICT_INIT(items, n_items);
|
info.props = &SPA_DICT_INIT(items, n_items);
|
||||||
spa_device_emit_object_info(&monitor->hooks, device->id, &info);
|
spa_device_emit_object_info(&monitor->hooks, device->id, &info);
|
||||||
|
|
||||||
if(!init && !device->connected) {
|
|
||||||
spa_device_emit_object_info(&monitor->hooks, device->id, NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -452,15 +452,23 @@ exit:
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void bluez5_remove_device(struct impl *impl, struct device *device)
|
static void bluez5_device_free(struct device *device)
|
||||||
{
|
{
|
||||||
|
|
||||||
pw_log_debug("remove device %u", device->id);
|
|
||||||
|
|
||||||
if (device->sdevice) {
|
if (device->sdevice) {
|
||||||
sm_object_destroy(&device->sdevice->obj);
|
sm_object_destroy(&device->sdevice->obj);
|
||||||
device->sdevice = NULL;
|
device->sdevice = NULL;
|
||||||
}
|
}
|
||||||
|
spa_list_remove(&device->link);
|
||||||
|
pw_unload_spa_handle(device->handle);
|
||||||
|
pw_properties_free(device->props);
|
||||||
|
free(device);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void bluez5_remove_device(struct impl *impl, struct device *device)
|
||||||
|
{
|
||||||
|
|
||||||
|
pw_log_debug("remove device %u", device->id);
|
||||||
|
bluez5_device_free(device);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void bluez5_update_device(struct impl *impl, struct device *device,
|
static void bluez5_update_device(struct impl *impl, struct device *device,
|
||||||
|
|
@ -484,24 +492,19 @@ static void bluez5_update_device(struct impl *impl, struct device *device,
|
||||||
device->sdevice = sm_media_session_export_device(impl->session,
|
device->sdevice = sm_media_session_export_device(impl->session,
|
||||||
&device->props->dict, device->device);
|
&device->props->dict, device->device);
|
||||||
if (device->sdevice == NULL) {
|
if (device->sdevice == NULL) {
|
||||||
bluez5_remove_device(impl, device);
|
bluez5_device_free(device);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
sm_object_add_listener(&device->sdevice->obj,
|
sm_object_add_listener(&device->sdevice->obj,
|
||||||
&device->listener,
|
&device->listener,
|
||||||
&device_events, device);
|
&device_events, device);
|
||||||
|
} else if (device->sdevice != NULL && !connected) {
|
||||||
|
sm_object_destroy(&device->sdevice->obj);
|
||||||
|
device->sdevice = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void bluez5_device_free(struct device *device)
|
|
||||||
{
|
|
||||||
spa_list_remove(&device->link);
|
|
||||||
pw_unload_spa_handle(device->handle);
|
|
||||||
pw_properties_free(device->props);
|
|
||||||
free(device);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void bluez5_enum_object_info(void *data, uint32_t id,
|
static void bluez5_enum_object_info(void *data, uint32_t id,
|
||||||
const struct spa_device_object_info *info)
|
const struct spa_device_object_info *info)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue