diff mbox series

[BlueZ,v2,3/3] input/device: Don't destroy UHID device on disconnect

Message ID 20240209185237.3611995-3-luiz.dentz@gmail.com
State Superseded
Headers show
Series [BlueZ,v2,1/3] hog-lib: Don't destroy UHID device on detach | expand

Commit Message

Luiz Augusto von Dentz Feb. 9, 2024, 6:52 p.m. UTC
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

This makes classic HID behave like HoG which keeps the UHID device
around while disconnected so it doesn't have to be recreated on every
reconnection.
---
 profiles/input/device.c | 4 ++++
 1 file changed, 4 insertions(+)
diff mbox series

Patch

diff --git a/profiles/input/device.c b/profiles/input/device.c
index 6c64ff1c1c52..9aea9e48891e 100644
--- a/profiles/input/device.c
+++ b/profiles/input/device.c
@@ -985,6 +985,10 @@  static int uhid_disconnect(struct input_device *idev)
 	if (!idev->uhid_created)
 		return 0;
 
+	/* Only destroy the node if virtual cable unplug flag has been set */
+	if (idev->virtual_cable_unplug)
+		return 0;
+
 	bt_uhid_unregister_all(idev->uhid);
 
 	memset(&ev, 0, sizeof(ev));