2012-07-06 20:26:58

by Vinicius Costa Gomes

[permalink] [raw]
Subject: [PATCH BlueZ v2] mgmtops: Fix calling btd_adapter_start() for an off adapter

When the adapter mode is off and the controller is down, we should
not consider that the adapter is powered up.
---
plugins/mgmtops.c | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/plugins/mgmtops.c b/plugins/mgmtops.c
index c060ada..27cec09 100644
--- a/plugins/mgmtops.c
+++ b/plugins/mgmtops.c
@@ -1072,11 +1072,12 @@ static void read_info_complete(int sk, uint16_t index, void *buf, size_t len)
return;
}

- if (mode != MODE_OFF && !mgmt_powered(info->current_settings))
- mgmt_set_powered(index, TRUE);
- else {
- get_connections(sk, index);
- btd_adapter_start(adapter);
+ if (mode != MODE_OFF) {
+ if (mgmt_powered(info->current_settings)) {
+ get_connections(sk, index);
+ btd_adapter_start(adapter);
+ } else
+ mgmt_set_powered(index, TRUE);
}

btd_adapter_unref(adapter);
--
1.7.10.4



2012-07-07 09:16:24

by Johan Hedberg

[permalink] [raw]
Subject: Re: [PATCH BlueZ v2] mgmtops: Fix calling btd_adapter_start() for an off adapter

Hi Vinicius,

On Fri, Jul 06, 2012, Vinicius Costa Gomes wrote:
> When the adapter mode is off and the controller is down, we should
> not consider that the adapter is powered up.
> ---
> plugins/mgmtops.c | 11 ++++++-----
> 1 file changed, 6 insertions(+), 5 deletions(-)

Applied. Thanks.

Johan