diff mbox series

[BlueZ,4/7] adapter: Add support for the get supported phy property

Message ID 20210722052640.5863-5-ayush.garg@samsung.com (mailing list archive)
State New, archived
Headers show
Series Support for Adapter's Default PHY Configuration | expand

Commit Message

Ayush Garg July 22, 2021, 5:26 a.m. UTC
This change introduces a new adapter property which
will allow user to get the adapter supported PHYs.

Reviewed-by: Anupam Roy <anupam.r@samsung.com>
---
 src/adapter.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)
diff mbox series

Patch

diff --git a/src/adapter.c b/src/adapter.c
index fd4c654dc..c64a5333d 100644
--- a/src/adapter.c
+++ b/src/adapter.c
@@ -3405,6 +3405,22 @@  failed:
 	return -EIO;
 }
 
+static gboolean property_get_supported_phy(
+					const GDBusPropertyTable *property,
+					DBusMessageIter *iter, void *user_data)
+{
+	struct btd_adapter *adapter = user_data;
+	DBusMessageIter array;
+
+	dbus_message_iter_open_container(iter, DBUS_TYPE_ARRAY, "s", &array);
+
+	append_phys_str(&array, adapter->supported_phys);
+
+	dbus_message_iter_close_container(iter, &array);
+
+	return TRUE;
+}
+
 static gboolean property_get_phy_configuration(
 					const GDBusPropertyTable *property,
 					DBusMessageIter *iter, void *user_data)
@@ -3753,6 +3769,8 @@  static const GDBusPropertyTable adapter_properties[] = {
 	{ "Modalias", "s", property_get_modalias, NULL,
 					property_exists_modalias },
 	{ "Roles", "as", property_get_roles },
+	{ "SupportedPhyConfiguration", "as", property_get_supported_phy,
+					NULL},
 	{ "PhyConfiguration", "as", property_get_phy_configuration,
 					property_set_phy_configuration },
 	{ }