Linux bluetooth development
 help / color / mirror / Atom feed
* [Bluez PATCH v3 1/3] service: add adapter powered check before connecting
@ 2020-11-05  6:40 Archie Pusaka
  2020-11-05  6:40 ` [Bluez PATCH v3 2/3] audio: unref session when failed to setup Archie Pusaka
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Archie Pusaka @ 2020-11-05  6:40 UTC (permalink / raw)
  To: linux-bluetooth, Luiz Augusto von Dentz; +Cc: CrosBT Upstreaming, Archie Pusaka

From: Archie Pusaka <apusaka@chromium.org>

When policy_connect() is called, there might be a case where the
power is just turned off, hence the adapter is down. Add a check in
btd_service_connect to detect such condition.
---

Changes in v3:
* Update the commit message to reflect changes in v2.

Changes in v2:
* Add adapter status check in btd_service_connect() instead of using
  btd_device_connect_services()

 src/service.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/service.c b/src/service.c
index d810fc3b05..21a52762e6 100644
--- a/src/service.c
+++ b/src/service.c
@@ -229,6 +229,9 @@ int btd_service_connect(struct btd_service *service)
 	if (!profile->connect)
 		return -ENOTSUP;
 
+	if (!btd_adapter_get_powered(device_get_adapter(service->device)))
+		return -ENETDOWN;
+
 	switch (service->state) {
 	case BTD_SERVICE_STATE_UNAVAILABLE:
 		return -EINVAL;
-- 
2.29.1.341.ge80a0c044ae-goog


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

end of thread, other threads:[~2020-11-05 18:53 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-11-05  6:40 [Bluez PATCH v3 1/3] service: add adapter powered check before connecting Archie Pusaka
2020-11-05  6:40 ` [Bluez PATCH v3 2/3] audio: unref session when failed to setup Archie Pusaka
2020-11-05  6:40 ` [Bluez PATCH v3 3/3] audio/avdtp: Report failure in disconnected state Archie Pusaka
2020-11-05  6:47 ` [Bluez,v3,1/3] service: add adapter powered check before connecting bluez.test.bot
2020-11-05 18:53   ` Luiz Augusto von Dentz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox