Linux bluetooth development
 help / color / mirror / Atom feed
From: Luiz Augusto von Dentz <luiz.dentz@gmail.com>
To: linux-bluetooth@vger.kernel.org
Subject: [PATCH BlueZ 2/5] core: Fix set_discoverable to not attempt to power on the adapter
Date: Mon, 17 Dec 2012 17:45:52 +0200	[thread overview]
Message-ID: <1355759155-27921-2-git-send-email-luiz.dentz@gmail.com> (raw)
In-Reply-To: <1355759155-27921-1-git-send-email-luiz.dentz@gmail.com>

From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

Discoverable flag is completely independent flag for the kernel so we
can reflect this in the D-Bus API.
---
 src/adapter.c | 21 ++-------------------
 1 file changed, 2 insertions(+), 19 deletions(-)

diff --git a/src/adapter.c b/src/adapter.c
index 375bff4..ce4e44e 100644
--- a/src/adapter.c
+++ b/src/adapter.c
@@ -366,25 +366,8 @@ done:
 static void set_discoverable(struct btd_adapter *adapter,
 			gboolean discoverable, GDBusPendingPropertySet id)
 {
-	uint8_t mode;
-	int err;
-
-	mode = discoverable ? MODE_DISCOVERABLE : MODE_CONNECTABLE;
-
-	if (mode == adapter->mode) {
-		adapter->global_mode = mode;
-		return g_dbus_pending_property_success(id);
-	}
-
-	err = set_mode(adapter, mode);
-	if (err < 0)
-		return g_dbus_pending_property_error(id,
-						ERROR_INTERFACE ".Failed",
-						strerror(-err));
-
-	adapter->pending_mode = create_session(adapter, NULL, mode,
-					SESSION_TYPE_MODE_GLOBAL, NULL);
-	adapter->pending_mode->prop_id = id;
+	mgmt_set_discoverable(adapter->dev_id, discoverable, 0);
+	g_dbus_pending_property_success(id);
 }
 
 static void set_powered(struct btd_adapter *adapter, gboolean powered,
-- 
1.7.11.7


  reply	other threads:[~2012-12-17 15:45 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-12-17 15:45 [PATCH BlueZ 1/5] core: Fix set_pairable to not attempt to power on the adapter Luiz Augusto von Dentz
2012-12-17 15:45 ` Luiz Augusto von Dentz [this message]
2012-12-17 15:45 ` [PATCH BlueZ 3/5] core: Simplify set_powered to not use set_mode Luiz Augusto von Dentz
2012-12-17 15:55   ` Anderson Lizardo
2012-12-17 18:30     ` Johan Hedberg
2012-12-17 15:45 ` [PATCH BlueZ 4/5] core: Remove mode session code Luiz Augusto von Dentz
2012-12-17 15:45 ` [PATCH BlueZ 5/5] core: Fix emitting changes to properties on power off Luiz Augusto von Dentz
2012-12-17 15:51 ` [PATCH BlueZ 1/5] core: Fix set_pairable to not attempt to power on the adapter Johan Hedberg

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1355759155-27921-2-git-send-email-luiz.dentz@gmail.com \
    --to=luiz.dentz@gmail.com \
    --cc=linux-bluetooth@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox