summaryrefslogtreecommitdiff
path: root/plugins/neard.c
diff options
context:
space:
mode:
authorSzymon Janc <szymon.janc@tieto.com>2013-05-06 15:20:52 +0200
committerJohan Hedberg <johan.hedberg@intel.com>2013-05-08 10:12:23 +0300
commit34e99c8328254583d67eacb5c1fef7e83bfa3745 (patch)
tree6176d082491d58ff7dca8d6cca03772a97e72d81 /plugins/neard.c
parent88daad940280ce2945bfd480ebc993dcad044360 (diff)
downloadbluez-34e99c8328254583d67eacb5c1fef7e83bfa3745.tar.gz
neard: Fix reading local OOB data when adapter is not powered
Read Local OOB data only if adapter is powered. This fix replying with error instead of CPS set to inactive when adapter is not powered.
Diffstat (limited to 'plugins/neard.c')
-rw-r--r--plugins/neard.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/plugins/neard.c b/plugins/neard.c
index dfe4f233c..e4a4d71ea 100644
--- a/plugins/neard.c
+++ b/plugins/neard.c
@@ -790,7 +790,7 @@ static DBusMessage *request_oob(DBusConnection *conn, DBusMessage *msg,
store_params(adapter, device, &remote);
- if (!remote.hash) {
+ if (!remote.hash || !btd_adapter_get_powered(adapter)) {
free_oob_params(&remote);
return create_request_oob_reply(adapter, NULL, NULL, msg);
}
@@ -798,6 +798,9 @@ static DBusMessage *request_oob(DBusConnection *conn, DBusMessage *msg,
read_local:
free_oob_params(&remote);
+ if (!btd_adapter_get_powered(adapter))
+ return create_request_oob_reply(adapter, NULL, NULL, msg);
+
err = btd_adapter_read_local_oob_data(adapter);
if (err < 0)
return error_reply(msg, -err);