@@ -72,7 +72,16 @@ static void vcp_debug(const char *str, void *user_data)
static int vcp_disconnect(struct btd_service *service)
{
+ struct vcp_data *data = btd_service_get_user_data(service);
DBG("");
+
+ if (!data) {
+ error("VCP service not handled by profile");
+ return -EINVAL;
+ }
+ bt_vcp_detach(data->vcp);
+
+ btd_service_disconnecting_complete(service, 0);
return 0;
}
@@ -188,7 +197,7 @@ bool bt_audio_vcp_set_volume(struct btd_device *device, int8_t volume)
return FALSE;
}
-static void vcp_detached(struct bt_vcp *vcp, void *user_data)
+static void vcp_remote_client_detached(struct bt_vcp *vcp, void *user_data)
{
struct vcp_data *data;
@@ -203,7 +212,7 @@ static void vcp_detached(struct bt_vcp *vcp, void *user_data)
vcp_data_remove(data);
}
-static void vcp_attached(struct bt_vcp *vcp, void *user_data)
+static void vcp_remote_client_attached(struct bt_vcp *vcp, void *user_data)
{
struct vcp_data *data;
struct bt_att *att;
@@ -354,7 +363,8 @@ static int vcp_init(void)
if (err)
return err;
- vcp_id = bt_vcp_register(vcp_attached, vcp_detached, NULL);
+ vcp_id = bt_vcp_register(vcp_remote_client_attached,
+ vcp_remote_client_detached, NULL);
return 0;
}