[PATCH BlueZ 5/7] adapter: Add support for PHY Configuration Changed event

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

 



This change will subscribe the MGTM PHY Configuration
Changed event. This event will come whenever the controller
PHYs changed. Upon receiving the event, it will notify the
user by emitting "PhyConfiguration" property changed event.

Reviewed-by: Anupam Roy <anupam.r@xxxxxxxxxxx>
---
 src/adapter.c | 27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)

diff --git a/src/adapter.c b/src/adapter.c
index c64a5333d..84dd2e5bd 100644
--- a/src/adapter.c
+++ b/src/adapter.c
@@ -9682,6 +9682,28 @@ static void read_phy_configuration(struct btd_adapter *adapter)
 	btd_error(adapter->dev_id, "Failed to read phy configuration info");
 }
 
+static void phy_configuration_changed_callback(uint16_t index,
+					uint16_t length, const void *param,
+					void *user_data)
+{
+	const struct mgmt_ev_phy_configuration_changed *ev = param;
+	struct btd_adapter *adapter = user_data;
+
+	if (length < sizeof(*ev)) {
+		btd_error(adapter->dev_id,
+				"Too small PHY configuration changed event");
+		return;
+	}
+
+	adapter->selected_phys = get_le32(&ev->selected_phys);
+	info("PHYs changed, New PHYs [0x%x]", adapter->selected_phys);
+
+	adapter->pending_phys = 0;
+
+	g_dbus_emit_property_changed(dbus_conn, adapter->path,
+					ADAPTER_INTERFACE, "PhyConfiguration");
+}
+
 static void read_info_complete(uint8_t status, uint16_t length,
 					const void *param, void *user_data)
 {
@@ -9917,6 +9939,11 @@ static void read_info_complete(uint8_t status, uint16_t length,
 						controller_resume_callback,
 						adapter, NULL);
 
+	mgmt_register(adapter->mgmt, MGMT_EV_PHY_CONFIGURATION_CHANGED,
+						adapter->dev_id,
+						phy_configuration_changed_callback,
+						adapter, NULL);
+
 	set_dev_class(adapter);
 
 	set_name(adapter, btd_adapter_get_name(adapter));
-- 
2.17.1




[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