Disconnect HID device service when HID profile is removed. 80/98080/1 accepted/tizen/3.0/common/20161118.192928 accepted/tizen/3.0/ivi/20161118.003719 accepted/tizen/3.0/mobile/20161118.003621 accepted/tizen/3.0/tv/20161118.003637 accepted/tizen/3.0/wearable/20161118.003654 submit/tizen_3.0/20161117.002644
authorDeokhyun Kim <dukan.kim@samsung.com>
Wed, 16 Nov 2016 05:49:42 +0000 (14:49 +0900)
committerDeokhyun Kim <dukan.kim@samsung.com>
Wed, 16 Nov 2016 05:52:29 +0000 (14:52 +0900)
 - Even though App which registered HID device profile is terminated abnoramlly,
   HID is still connected. If trying to connect HID again then it fails always.
 - A profile of device structure & a profile registered by App are different.
   A profile of device structure maintains connceted status.
 - If a HID profile registered by App is removed in status of connected,
   disconnect the connection of the profile intentionally.

Change-Id: I9167ac4457cd431780184a3800a86bf82c2eb4ee
Signed-off-by: Deokhyun Kim <dukan.kim@samsung.com>
src/device.c

index 49de44b..6d2820c 100644 (file)
@@ -5866,8 +5866,27 @@ void device_remove_profile(gpointer a, gpointer b)
        GSList *l;
 
        l = find_service_with_profile(device->services, profile);
+#ifdef TIZEN_BT_HID_DEVICE_ENABLE
+       if (l == NULL) {
+               if (g_strcmp0(profile->local_uuid , HID_DEVICE_UUID) == 0) {
+                       l = find_service_with_uuid(device->services,
+                                       HID_DEVICE_UUID);
+                       service = l->data;
+
+                       if (btd_service_get_state(service) ==
+                               BTD_SERVICE_STATE_CONNECTED) {
+                               int err;
+                               err = btd_service_disconnect(service);
+                               if (err)
+                                       error("error: %s", strerror(-err));
+                       }
+               }
+               return;
+       }
+#else
        if (l == NULL)
                return;
+#endif
 
        service = l->data;
        device->services = g_slist_delete_link(device->services, l);