input/hog: Remove HID device after HoG device disconnects
authorBenjamin Tissoires <benjamin.tissoires@redhat.com>
Fri, 14 Jun 2019 15:31:25 +0000 (17:31 +0200)
committerhimanshu <h.himanshu@samsung.com>
Tue, 11 Feb 2020 08:57:47 +0000 (14:27 +0530)
When the Bluetooth LE device disconnects, make sure to also destroy the
uHID device so that we don't have a lingering HID device accessible from
user-space.

This also fixes the input subsystem never seeing the device reattaching,
causing settings that should be applied on connection not to be applied.

https://bugzilla.kernel.org/show_bug.cgi?id=202909

Tested-by: Bastien Nocera <hadess@hadess.net>
Change-Id: Idbc431d733c5bfba710b9d455e1dc564e2e3c302
Signed-off-by: himanshu <h.himanshu@samsung.com>
profiles/input/hog.c

index 23c9c15..83c017d 100755 (executable)
@@ -199,6 +199,8 @@ static int hog_disconnect(struct btd_service *service)
        struct hog_device *dev = btd_service_get_user_data(service);
 
        bt_hog_detach(dev->hog);
+       bt_hog_unref(dev->hog);
+       dev->hog = NULL;
 
        btd_service_disconnecting_complete(service, 0);