All of lore.kernel.org
 help / color / mirror / Atom feed
* [Bluez PATCH] input/device: Notify failure if ctrl disconnect when waiting intr
@ 2022-05-18  4:33 Archie Pusaka
  2022-05-18 22:30 ` patchwork-bot+bluetooth
  0 siblings, 1 reply; 2+ messages in thread
From: Archie Pusaka @ 2022-05-18  4:33 UTC (permalink / raw)
  To: linux-bluetooth, Luiz Augusto von Dentz
  Cc: CrosBT Upstreaming, Archie Pusaka, Sonny Sasaka

From: Archie Pusaka <apusaka@chromium.org>

On some rare occasions, the peer HID device might disconnect the ctrl
channel when we are trying to connect the intr channel. If this
happens, interrupt_connect_cb() will not be called by btio, and we
will be stuck in "connecting" state. Any future connection attempt to
the peer device will fail because of "busy".

This patch prevents that by checking if we need to report connection
failure when the ctrl channel is disconnected.

Reviewed-by: Sonny Sasaka <sonnysasaka@chromium.org>
---

 profiles/input/device.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/profiles/input/device.c b/profiles/input/device.c
index ff4aa771ac..e2ac6ea603 100644
--- a/profiles/input/device.c
+++ b/profiles/input/device.c
@@ -581,6 +581,13 @@ static gboolean ctrl_watch_cb(GIOChannel *chan, GIOCondition cond, gpointer data
 	if (idev->intr_io && !(cond & G_IO_NVAL))
 		g_io_channel_shutdown(idev->intr_io, TRUE, NULL);
 
+	/* It's possible this is triggered while the intr channel is not even
+	 * connected yet, therefore we are still in the connecting state.
+	 */
+	if (btd_service_get_state(idev->service) ==
+						BTD_SERVICE_STATE_CONNECTING)
+		btd_service_connecting_complete(idev->service, -EIO);
+
 	if (!idev->intr_io && idev->virtual_cable_unplug)
 		virtual_cable_unplug(idev);
 
-- 
2.36.0.550.gb090851708-goog


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

* Re: [Bluez PATCH] input/device: Notify failure if ctrl disconnect when waiting intr
  2022-05-18  4:33 [Bluez PATCH] input/device: Notify failure if ctrl disconnect when waiting intr Archie Pusaka
@ 2022-05-18 22:30 ` patchwork-bot+bluetooth
  0 siblings, 0 replies; 2+ messages in thread
From: patchwork-bot+bluetooth @ 2022-05-18 22:30 UTC (permalink / raw)
  To: Archie Pusaka
  Cc: linux-bluetooth, luiz.dentz, chromeos-bluetooth-upstreaming,
	apusaka, sonnysasaka

Hello:

This patch was applied to bluetooth/bluez.git (master)
by Luiz Augusto von Dentz <luiz.von.dentz@intel.com>:

On Wed, 18 May 2022 12:33:07 +0800 you wrote:
> From: Archie Pusaka <apusaka@chromium.org>
> 
> On some rare occasions, the peer HID device might disconnect the ctrl
> channel when we are trying to connect the intr channel. If this
> happens, interrupt_connect_cb() will not be called by btio, and we
> will be stuck in "connecting" state. Any future connection attempt to
> the peer device will fail because of "busy".
> 
> [...]

Here is the summary with links:
  - [Bluez] input/device: Notify failure if ctrl disconnect when waiting intr
    https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=c159d790e878

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



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

end of thread, other threads:[~2022-05-18 22:30 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-18  4:33 [Bluez PATCH] input/device: Notify failure if ctrl disconnect when waiting intr Archie Pusaka
2022-05-18 22:30 ` patchwork-bot+bluetooth

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.