* [PATCH] Maemo6 MCE: skip first adapter_powered callback
@ 2011-02-24 12:27 Daniel Örstadius
2011-02-24 19:42 ` Johan Hedberg
0 siblings, 1 reply; 2+ messages in thread
From: Daniel Örstadius @ 2011-02-24 12:27 UTC (permalink / raw)
To: linux-bluetooth
[-- Attachment #1: Type: text/plain, Size: 1 bytes --]
[-- Attachment #2: 0001-Maemo6-MCE-skip-first-adapter_powered-callback.patch --]
[-- Type: text/x-patch, Size: 1690 bytes --]
From 12f6e83e8a437f945a18d9e15e956039acad3a4b Mon Sep 17 00:00:00 2001
From: Daniel Orstadius <daniel.orstadius@nokia.com>
Date: Thu, 24 Feb 2011 13:45:33 +0200
Subject: [PATCH] Maemo6 MCE: skip first adapter_powered callback
The maemo6 MCE plugin should be used with the flag InitiallyPowered
in main.conf set to 'true' so that BlueZ powers on the adapter
and leaves it in that state when the daemon is started. The plugin
will read the radio state from the MCE and set the state
accordingly. The maemo6 plugin is a btd_adapter_driver and those
drivers are loaded after BlueZ has read the BD address etc from the
adapter.
This patch adds a boolean flag in the callback to ignore the initial
powering on of the adapter by BlueZ, since it shouldn't be
propagated to the MCE. With InitiallyPowered set to 'false' the
adapter_powered callback is not called when the adapter is turned
on at BlueZ startup, which is why this wasn't implemented before.
---
plugins/maemo6.c | 6 ++++++
1 files changed, 6 insertions(+), 0 deletions(-)
diff --git a/plugins/maemo6.c b/plugins/maemo6.c
index 3c91926..56f2664 100644
--- a/plugins/maemo6.c
+++ b/plugins/maemo6.c
@@ -135,9 +135,15 @@ static void adapter_powered(struct btd_adapter *adapter, gboolean powered)
DBusMessage *msg;
dbus_uint32_t radio_states = 0;
dbus_uint32_t radio_mask = MCE_RADIO_STATE_BLUETOOTH;
+ static gboolean startup = TRUE;
DBG("adapter_powered called with %d", powered);
+ if (startup) {
+ startup = FALSE;
+ return;
+ }
+
/* check if the plugin got the get_radio_states reply from the
* mce when the adapter was not yet down during the power
* cycling when bluetoothd is started */
--
1.6.0.4
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH] Maemo6 MCE: skip first adapter_powered callback
2011-02-24 12:27 [PATCH] Maemo6 MCE: skip first adapter_powered callback Daniel Örstadius
@ 2011-02-24 19:42 ` Johan Hedberg
0 siblings, 0 replies; 2+ messages in thread
From: Johan Hedberg @ 2011-02-24 19:42 UTC (permalink / raw)
To: Daniel Westerlund; +Cc: linux-bluetooth
Hi Daniel,
> From: Daniel Orstadius <daniel.orstadius@nokia.com>
> Date: Thu, 24 Feb 2011 13:45:33 +0200
> Subject: [PATCH] Maemo6 MCE: skip first adapter_powered callback
>
> The maemo6 MCE plugin should be used with the flag InitiallyPowered
> in main.conf set to 'true' so that BlueZ powers on the adapter
> and leaves it in that state when the daemon is started. The plugin
> will read the radio state from the MCE and set the state
> accordingly. The maemo6 plugin is a btd_adapter_driver and those
> drivers are loaded after BlueZ has read the BD address etc from the
> adapter.
>
> This patch adds a boolean flag in the callback to ignore the initial
> powering on of the adapter by BlueZ, since it shouldn't be
> propagated to the MCE. With InitiallyPowered set to 'false' the
> adapter_powered callback is not called when the adapter is turned
> on at BlueZ startup, which is why this wasn't implemented before.
> ---
> plugins/maemo6.c | 6 ++++++
> 1 files changed, 6 insertions(+), 0 deletions(-)
This patch has been pushed upstream. Thanks.
Johan
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2011-02-24 19:42 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-02-24 12:27 [PATCH] Maemo6 MCE: skip first adapter_powered callback Daniel Örstadius
2011-02-24 19:42 ` Johan Hedberg
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox