[PATCH 2/2] neard: Fix reading local OOB data when adapter is not powered

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.
---
 plugins/neard.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/plugins/neard.c b/plugins/neard.c
index dfe4f23..e4a4d71 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);
-- 
1.8.2.2

--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux