2012-04-03 11:53:59

by Hemant Gupta

[permalink] [raw]
Subject: [PATCH v2] Adapter: Fix Discovering state while Powering Off

This patch fixes the adater discovering state while powering off.
Without this fix, BlueZ sends incorrect discovering state to upper
layers while switching off.
---
src/adapter.c | 9 ++++++++-
1 files changed, 8 insertions(+), 1 deletions(-)

diff --git a/src/adapter.c b/src/adapter.c
index eb9745f..f630196 100644
--- a/src/adapter.c
+++ b/src/adapter.c
@@ -2319,10 +2319,17 @@ int btd_adapter_stop(struct btd_adapter *adapter)
ADAPTER_INTERFACE, "Pairable",
DBUS_TYPE_BOOLEAN, &prop_false);

- if (adapter->discovering)
+ if (adapter->discovering) {
emit_property_changed(connection, adapter->path,
ADAPTER_INTERFACE, "Discovering",
DBUS_TYPE_BOOLEAN, &prop_false);
+ /*
+ * Change the discovering state to FALSE, otherwise
+ * inquiry fails to start if BT is switched off and then on
+ * while inquiry is already active.
+ */
+ adapter->discovering = FALSE;
+ }

emit_property_changed(connection, adapter->path, ADAPTER_INTERFACE,
"Powered", DBUS_TYPE_BOOLEAN, &prop_false);
--
1.7.0.4



2012-04-04 10:03:33

by Johan Hedberg

[permalink] [raw]
Subject: Re: [PATCH v2] Adapter: Fix Discovering state while Powering Off

Hi Hemant,

On Tue, Apr 03, 2012, Hemant Gupta wrote:
> This patch fixes the adater discovering state while powering off.
> Without this fix, BlueZ sends incorrect discovering state to upper
> layers while switching off.
> ---
> src/adapter.c | 9 ++++++++-
> 1 files changed, 8 insertions(+), 1 deletions(-)

Applied (with a few modifications). Thanks.

Johan