All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC BlueZ 0/1] core: Fix adapter mode inconsistency
@ 2012-04-23  8:34 Mikel Astiz
  2012-04-23  8:34 ` [RFC BlueZ 1/1] " Mikel Astiz
  0 siblings, 1 reply; 3+ messages in thread
From: Mikel Astiz @ 2012-04-23  8:34 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Mikel Astiz

Hi all,

There seems to be a bug with the management interface plugin that enters an inconsistent state if the adapter is discoverable during startup.

I'm not really sure if this is a proper solution but it does fix the problem.

Cheers,
Mikel

Mikel Astiz (1):
  core: Fix adapter mode inconsistency

 src/adapter.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

-- 
1.7.7.6


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

* [RFC BlueZ 1/1] core: Fix adapter mode inconsistency
  2012-04-23  8:34 [RFC BlueZ 0/1] core: Fix adapter mode inconsistency Mikel Astiz
@ 2012-04-23  8:34 ` Mikel Astiz
  2012-04-23  9:57   ` Johan Hedberg
  0 siblings, 1 reply; 3+ messages in thread
From: Mikel Astiz @ 2012-04-23  8:34 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Mikel Astiz

The mode change in btd_adapter_start() doesn't check if the adapter is
discoverable, creating an inconsistency between the plugin and the core.

Using the management interface it is easy to reproduce the problem, by
starting BlueZ while the adapter is discoverable. After this, the state
cannot be changed.
---
 src/adapter.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/src/adapter.c b/src/adapter.c
index 12b6aeb..a4180b1 100644
--- a/src/adapter.c
+++ b/src/adapter.c
@@ -2183,9 +2183,13 @@ void btd_adapter_start(struct btd_adapter *adapter)
 	adapter->up = TRUE;
 	adapter->discov_timeout = get_discoverable_timeout(address);
 	adapter->pairable_timeout = get_pairable_timeout(address);
-	adapter->mode = MODE_CONNECTABLE;
 	adapter->off_timer = 0;
 
+	if (adapter->scan_mode & SCAN_INQUIRY)
+		adapter->mode = MODE_DISCOVERABLE;
+	else
+		adapter->mode = MODE_CONNECTABLE;
+
 	powered = TRUE;
 	emit_property_changed(connection, adapter->path,
 					ADAPTER_INTERFACE, "Powered",
-- 
1.7.7.6


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

* Re: [RFC BlueZ 1/1] core: Fix adapter mode inconsistency
  2012-04-23  8:34 ` [RFC BlueZ 1/1] " Mikel Astiz
@ 2012-04-23  9:57   ` Johan Hedberg
  0 siblings, 0 replies; 3+ messages in thread
From: Johan Hedberg @ 2012-04-23  9:57 UTC (permalink / raw)
  To: Mikel Astiz; +Cc: linux-bluetooth

Hi Mikel,

On Mon, Apr 23, 2012, Mikel Astiz wrote:
> The mode change in btd_adapter_start() doesn't check if the adapter is
> discoverable, creating an inconsistency between the plugin and the core.
> 
> Using the management interface it is easy to reproduce the problem, by
> starting BlueZ while the adapter is discoverable. After this, the state
> cannot be changed.
> ---
>  src/adapter.c |    6 +++++-
>  1 files changed, 5 insertions(+), 1 deletions(-)

Thanks. Applied, but I really wish we could clean up and simplify this
code. Probably adapter->mode and adapter->scan_mode should be completely
removed and new connectable and discoverable boolean variables added
(since this is how the mgmt API anyway presents these settings).

Johan

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

end of thread, other threads:[~2012-04-23  9:57 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-04-23  8:34 [RFC BlueZ 0/1] core: Fix adapter mode inconsistency Mikel Astiz
2012-04-23  8:34 ` [RFC BlueZ 1/1] " Mikel Astiz
2012-04-23  9:57   ` Johan Hedberg

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.