From 2ed2c75c11d682a9767247f4bcad40a636030d89 Mon Sep 17 00:00:00 2001 From: Dmitriy Paliy Date: Fri, 29 Jul 2011 11:33:48 +0300 Subject: [PATCH] Fix adapter->global_mode updating in btd_adapter_switch_offline() Currently, use of RequestSession and SetProperty adapter method calls sets global_mode to on. Switching adapter off via plug-in interface in this scenario releases all sessions, that, in turn, restores adapter's state to global_mode, which is on. Result is the adapter is switched off and immediately switched on. This patch fixes such inconsistency by overwriting global_mode to mode off when request comes from plug-in. --- src/adapter.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/adapter.c b/src/adapter.c index e1b8d5d6d..4c88a0e4e 100644 --- a/src/adapter.c +++ b/src/adapter.c @@ -3425,6 +3425,8 @@ int btd_adapter_switch_offline(struct btd_adapter *adapter) if (adapter->off_timer) return 0; + adapter->global_mode = MODE_OFF; + if (adapter->connections == NULL) return adapter_ops->set_powered(adapter->dev_id, FALSE); -- 2.47.3