[PATCH 08/14] neard: Add support for setting power state in RequestOOB reply

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

 



This allows neard to properly set Bluetooth carrier power state in
handover message.
---
 plugins/neard.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/plugins/neard.c b/plugins/neard.c
index 0418430..0bd376b 100644
--- a/plugins/neard.c
+++ b/plugins/neard.c
@@ -173,6 +173,19 @@ unregister:
 							AGENT_INTERFACE);
 }
 
+static void add_power_state(DBusMessageIter *dict, struct btd_adapter *adapter)
+{
+	const char *state;
+
+	if (btd_adapter_get_powered(adapter) &&
+			btd_adapter_get_connectable(adapter))
+		state = "active";
+	else
+		state = "inactive";
+
+	dict_append_entry(dict, "State", DBUS_TYPE_STRING, &state);
+}
+
 static DBusMessage *create_request_oob_reply(struct btd_adapter *adapter,
 						const uint8_t *hash,
 						const uint8_t *randomizer,
@@ -208,6 +221,8 @@ static DBusMessage *create_request_oob_reply(struct btd_adapter *adapter,
 
 	dict_append_array(&dict, "EIR", DBUS_TYPE_BYTE, &peir, len);
 
+	add_power_state(&dict, adapter);
+
 	dbus_message_iter_close_container(&iter, &dict);
 
 	return reply;
-- 
1.8.1.1

--
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