diff options
author | Mikel Astiz <mikel.astiz.oss@gmail.com> | 2012-04-23 10:34:35 +0200 |
---|---|---|
committer | Johan Hedberg <johan.hedberg@intel.com> | 2012-04-23 12:54:10 +0300 |
commit | f4807c64e0fdfca2c546c13753257437a879c203 (patch) | |
tree | 88a6fa1c424d1c04c80bdb83d2aa06786f25ca64 /src/adapter.c | |
parent | ed31ac59ecb6e4e15c350e44637c05d7ef58c019 (diff) | |
download | bluez-f4807c64e0fdfca2c546c13753257437a879c203.tar.gz bluez-f4807c64e0fdfca2c546c13753257437a879c203.tar.xz bluez-f4807c64e0fdfca2c546c13753257437a879c203.zip |
core: Fix adapter mode inconsistency
The mode change in btd_adapter_start() doesn't check if the adapter is
discoverable, creating an inconsistency between the plugin and the core.
Using the management interface it is easy to reproduce the problem, by
starting BlueZ while the adapter is discoverable. After this, the state
cannot be changed.
Diffstat (limited to 'src/adapter.c')
-rw-r--r-- | src/adapter.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/adapter.c b/src/adapter.c index 12b6aeb2..a4180b14 100644 --- a/src/adapter.c +++ b/src/adapter.c @@ -2183,9 +2183,13 @@ void btd_adapter_start(struct btd_adapter *adapter) adapter->up = TRUE; adapter->discov_timeout = get_discoverable_timeout(address); adapter->pairable_timeout = get_pairable_timeout(address); - adapter->mode = MODE_CONNECTABLE; adapter->off_timer = 0; + if (adapter->scan_mode & SCAN_INQUIRY) + adapter->mode = MODE_DISCOVERABLE; + else + adapter->mode = MODE_CONNECTABLE; + powered = TRUE; emit_property_changed(connection, adapter->path, ADAPTER_INTERFACE, "Powered", |