From f0b9549376c348ef6754b434713e0e060c1b1dd2 Mon Sep 17 00:00:00 2001 From: Christian Helmuth Date: Wed, 26 May 2021 17:14:35 +0200 Subject: [PATCH] wifi_drv: optionally report MAC address Issue #4133 --- repos/dde_linux/README | 7 +++++++ repos/dde_linux/run/wifi.run | 9 +++++++++ repos/dde_linux/src/lib/wifi/nic.cc | 22 ++++++++++++++++++++++ 3 files changed, 38 insertions(+) diff --git a/repos/dde_linux/README b/repos/dde_linux/README index 0d16b3b78c..bc38568bf4 100644 --- a/repos/dde_linux/README +++ b/repos/dde_linux/README @@ -285,6 +285,13 @@ On certain cards, e.g. Intel Wireless 6200 ABG, it may be necessary to disable the 11n mode. This can be achieved by setting the 'use_11n' attribute in the 'wifi_config' node to 'no'. +The driver optionally reports the following information under the +label "devices" if requested in the config as depicted. + +! + +! + lx_kit ###### diff --git a/repos/dde_linux/run/wifi.run b/repos/dde_linux/run/wifi.run index 244fd647c3..0c98914e14 100644 --- a/repos/dde_linux/run/wifi.run +++ b/repos/dde_linux/run/wifi.run @@ -195,9 +195,17 @@ append config { + + + + + + + + @@ -211,6 +219,7 @@ append config { + diff --git a/repos/dde_linux/src/lib/wifi/nic.cc b/repos/dde_linux/src/lib/wifi/nic.cc index 06ac95efe5..7d7aa1c6c1 100644 --- a/repos/dde_linux/src/lib/wifi/nic.cc +++ b/repos/dde_linux/src/lib/wifi/nic.cc @@ -18,6 +18,7 @@ #include #include #include +#include #include #include @@ -111,6 +112,8 @@ class Genode::Wifi_uplink net_device *_device { nullptr }; + Constructible _reporter { }; + static Wifi_uplink *_instance; class Uplink_client : public Uplink_client_base @@ -175,6 +178,8 @@ class Genode::Wifi_uplink !(_ndev.state & 1UL << __LINK_STATE_NOCARRIER)); } + Net::Mac_address mac_address() const { return _drv_mac_addr; } + void handle_driver_link_state(bool state) { _drv_handle_link_state(state); @@ -241,6 +246,23 @@ class Genode::Wifi_uplink void activate() { _client.construct(_env, _alloc, device()); + + Lx_kit::env().config_rom().xml().with_sub_node("report", [&] (Xml_node const &xml) { + bool const report_mac_address = + xml.attribute_value("mac_address", false); + + if (!report_mac_address) + return; + + _reporter.construct(_env, "devices"); + _reporter->enabled(true); + + Reporter::Xml_generator report(*_reporter, [&] () { + report.node("nic", [&] () { + report.attribute("mac_address", String<32>(_client->mac_address())); + }); + }); + }); } void handle_driver_rx_packet(struct sk_buff *skb)