linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH BlueZ] mgmtops: Fix calling btd_adapter_start() for an off adapter
@ 2012-07-06 18:47 Vinicius Costa Gomes
  2012-07-06 20:04 ` Johan Hedberg
  0 siblings, 1 reply; 3+ messages in thread
From: Vinicius Costa Gomes @ 2012-07-06 18:47 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Vinicius Costa Gomes

When the adapter mode is off and the controller is down, we should
not consider that the adapter is powered up.
---
 plugins/mgmtops.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/plugins/mgmtops.c b/plugins/mgmtops.c
index c060ada..4c86389 100644
--- a/plugins/mgmtops.c
+++ b/plugins/mgmtops.c
@@ -1074,7 +1074,7 @@ static void read_info_complete(int sk, uint16_t index, void *buf, size_t len)
 
 	if (mode != MODE_OFF && !mgmt_powered(info->current_settings))
 		mgmt_set_powered(index, TRUE);
-	else {
+	else if (mode != MODE_OFF) {
 		get_connections(sk, index);
 		btd_adapter_start(adapter);
 	}
-- 
1.7.10.4


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

* Re: [PATCH BlueZ] mgmtops: Fix calling btd_adapter_start() for an off adapter
  2012-07-06 18:47 [PATCH BlueZ] mgmtops: Fix calling btd_adapter_start() for an off adapter Vinicius Costa Gomes
@ 2012-07-06 20:04 ` Johan Hedberg
  2012-07-06 20:24   ` Vinicius Costa Gomes
  0 siblings, 1 reply; 3+ messages in thread
From: Johan Hedberg @ 2012-07-06 20:04 UTC (permalink / raw)
  To: Vinicius Costa Gomes; +Cc: linux-bluetooth, Vinicius Costa Gomes

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 |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/plugins/mgmtops.c b/plugins/mgmtops.c
> index c060ada..4c86389 100644
> --- a/plugins/mgmtops.c
> +++ b/plugins/mgmtops.c
> @@ -1074,7 +1074,7 @@ static void read_info_complete(int sk, uint16_t index, void *buf, size_t len)
>  
>  	if (mode != MODE_OFF && !mgmt_powered(info->current_settings))
>  		mgmt_set_powered(index, TRUE);
> -	else {
> +	else if (mode != MODE_OFF) {
>  		get_connections(sk, index);
>  		btd_adapter_start(adapter);
>  	}

Thanks for catching this, but I think the following would be even more
clear:

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

Could you please resend a patch with this logic (assuming you agree)?

Johan

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

* Re: [PATCH BlueZ] mgmtops: Fix calling btd_adapter_start() for an off adapter
  2012-07-06 20:04 ` Johan Hedberg
@ 2012-07-06 20:24   ` Vinicius Costa Gomes
  0 siblings, 0 replies; 3+ messages in thread
From: Vinicius Costa Gomes @ 2012-07-06 20:24 UTC (permalink / raw)
  To: Vinicius Costa Gomes, linux-bluetooth

Hi Johan,

On 21:04 Fri 06 Jul, Johan Hedberg wrote:
> 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 |    2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/plugins/mgmtops.c b/plugins/mgmtops.c
> > index c060ada..4c86389 100644
> > --- a/plugins/mgmtops.c
> > +++ b/plugins/mgmtops.c
> > @@ -1074,7 +1074,7 @@ static void read_info_complete(int sk, uint16_t index, void *buf, size_t len)
> >  
> >  	if (mode != MODE_OFF && !mgmt_powered(info->current_settings))
> >  		mgmt_set_powered(index, TRUE);
> > -	else {
> > +	else if (mode != MODE_OFF) {
> >  		get_connections(sk, index);
> >  		btd_adapter_start(adapter);
> >  	}
> 
> Thanks for catching this, but I think the following would be even more
> clear:
> 
> 	if (mode != MODE_OFF) {
> 		if (mgmt_powered(info->current_settings)) {
> 			get_connections(sk, index);
> 			btd_adapter_start(adapter);
> 		} else
> 			mgmt_set_powered(index, TRUE);
> 	}
> 
> Could you please resend a patch with this logic (assuming you agree)?

Yeah, I agree. Patch coming in a few moments.

> 
> Johan


Cheers,
-- 
Vinicius

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

end of thread, other threads:[~2012-07-06 20:24 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-07-06 18:47 [PATCH BlueZ] mgmtops: Fix calling btd_adapter_start() for an off adapter Vinicius Costa Gomes
2012-07-06 20:04 ` Johan Hedberg
2012-07-06 20:24   ` Vinicius Costa Gomes

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).