linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] input/hog: Remove HID device after HoG device disconnects
@ 2019-06-14 15:31 Bastien Nocera
  2019-07-15 12:51 ` Szymon Janc
  0 siblings, 1 reply; 2+ messages in thread
From: Bastien Nocera @ 2019-06-14 15:31 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Benjamin Tissoires

From: Benjamin Tissoires <benjamin.tissoires@redhat.com>

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>
---
 profiles/input/hog.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/profiles/input/hog.c b/profiles/input/hog.c
index 23c9c1529..83c017dcb 100644
--- a/profiles/input/hog.c
+++ b/profiles/input/hog.c
@@ -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);
 
-- 
2.21.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] input/hog: Remove HID device after HoG device disconnects
  2019-06-14 15:31 [PATCH] input/hog: Remove HID device after HoG device disconnects Bastien Nocera
@ 2019-07-15 12:51 ` Szymon Janc
  0 siblings, 0 replies; 2+ messages in thread
From: Szymon Janc @ 2019-07-15 12:51 UTC (permalink / raw)
  To: Bastien Nocera; +Cc: linux-bluetooth, Benjamin Tissoires

Hi,

On Friday, 14 June 2019 17:31:25 CEST Bastien Nocera wrote:
> From: Benjamin Tissoires <benjamin.tissoires@redhat.com>
> 
> 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>
> ---
>  profiles/input/hog.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/profiles/input/hog.c b/profiles/input/hog.c
> index 23c9c1529..83c017dcb 100644
> --- a/profiles/input/hog.c
> +++ b/profiles/input/hog.c
> @@ -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);

I've tested this with device I have and introduced delay is acceptable imho.
Since this fix end-user usabiblity for some of the devices on the market I 
think the trade-off is justified.

Patch is now applied.

-- 
pozdrawiam
Szymon Janc



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-07-15 12:51 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-06-14 15:31 [PATCH] input/hog: Remove HID device after HoG device disconnects Bastien Nocera
2019-07-15 12:51 ` Szymon Janc

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).