From: Luiz Augusto von Dentz <luiz.dentz@gmail.com>
To: linux-bluetooth@vger.kernel.org
Subject: [PATCH BlueZ 3/5] core: Simplify set_powered to not use set_mode
Date: Mon, 17 Dec 2012 17:45:53 +0200 [thread overview]
Message-ID: <1355759155-27921-3-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>
---
src/adapter.c | 19 +++++--------------
1 file changed, 5 insertions(+), 14 deletions(-)
diff --git a/src/adapter.c b/src/adapter.c
index ce4e44e..2d81f66 100644
--- a/src/adapter.c
+++ b/src/adapter.c
@@ -373,28 +373,19 @@ static void set_discoverable(struct btd_adapter *adapter,
static void set_powered(struct btd_adapter *adapter, gboolean powered,
GDBusPendingPropertySet id)
{
- uint8_t mode;
int err;
- if (powered)
- return set_discoverable(adapter, adapter->discoverable, id);
-
- mode = MODE_OFF;
-
- if (mode == adapter->mode) {
- adapter->global_mode = mode;
+ if (adapter->powered == powered)
return g_dbus_pending_property_success(id);
- }
- err = set_mode(adapter, mode);
+ err = mgmt_set_powered(adapter->dev_id, powered);
if (err < 0)
return g_dbus_pending_property_error(id,
ERROR_INTERFACE ".Failed",
- strerror(-err));
+ strerror(err));
- adapter->pending_mode = create_session(adapter, NULL, mode,
- SESSION_TYPE_MODE_GLOBAL, NULL);
- adapter->pending_mode->prop_id = id;
+ if (powered == FALSE)
+ adapter->off_requested = TRUE;
}
static void set_pairable(struct btd_adapter *adapter, gboolean pairable,
--
1.7.11.7
next prev parent 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 ` [PATCH BlueZ 2/5] core: Fix set_discoverable " Luiz Augusto von Dentz
2012-12-17 15:45 ` Luiz Augusto von Dentz [this message]
2012-12-17 15:55 ` [PATCH BlueZ 3/5] core: Simplify set_powered to not use set_mode 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-3-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