sculpt: restore wifi and nic restart option

Issue #5174
This commit is contained in:
Norman Feske 2024-04-08 14:22:57 +02:00 committed by Christian Helmuth
parent 594da536c7
commit 3f66bf25aa
3 changed files with 38 additions and 26 deletions

View File

@ -103,6 +103,15 @@ struct Sculpt::Main : Input_event_handler,
Registry<Child_state> _child_states { }; Registry<Child_state> _child_states { };
void _with_child(auto const &name, auto const &fn)
{
_child_states.for_each([&] (Child_state &child) {
if (child.name() == name)
fn(child); });
_child_states.for_each([&] (Child_state &) { }); /* restore orig. order */
}
Input::Seq_number _global_input_seq_number { }; Input::Seq_number _global_input_seq_number { };
Gui::Connection _gui { _env, "input" }; Gui::Connection _gui { _env, "input" };
@ -1397,17 +1406,17 @@ struct Sculpt::Main : Input_event_handler,
*/ */
void restart_deployed_component(Start_name const &name) override void restart_deployed_component(Start_name const &name) override
{ {
if (name == "nic_drv") { auto restart = [&] (auto const &name)
{
_with_child(name, [&] (Child_state &child) {
child.trigger_restart();
generate_runtime_config();
});
};
_network.restart_nic_drv_on_next_runtime_cfg(); if (name == "nic" || name == "wifi")
generate_runtime_config(); restart(name);
else {
} else if (name == "wifi_drv") {
_network.restart_wifi_drv_on_next_runtime_cfg();
generate_runtime_config();
} else {
_runtime_state.restart(name); _runtime_state.restart(name);

View File

@ -88,6 +88,15 @@ struct Sculpt::Main : Input_event_handler,
Registry<Child_state> _child_states { }; Registry<Child_state> _child_states { };
void _with_child(auto const &name, auto const &fn)
{
_child_states.for_each([&] (Child_state &child) {
if (child.name() == name)
fn(child); });
_child_states.for_each([&] (Child_state &) { }); /* restore orig. order */
}
Input::Seq_number _global_input_seq_number { }; Input::Seq_number _global_input_seq_number { };
Gui::Connection _gui { _env, "input" }; Gui::Connection _gui { _env, "input" };
@ -932,17 +941,17 @@ struct Sculpt::Main : Input_event_handler,
*/ */
void restart_deployed_component(Start_name const &name) override void restart_deployed_component(Start_name const &name) override
{ {
if (name == "nic") { auto restart = [&] (auto const &name)
{
_with_child(name, [&] (Child_state &child) {
child.trigger_restart();
generate_runtime_config();
});
};
_network.restart_nic_drv_on_next_runtime_cfg(); if (name == "nic" || name == "wifi")
generate_runtime_config(); restart(name);
else {
} else if (name == "wifi") {
_network.restart_wifi_drv_on_next_runtime_cfg();
generate_runtime_config();
} else {
_runtime_state.restart(name); _runtime_state.restart(name);

View File

@ -61,9 +61,6 @@ struct Sculpt::Network : Noncopyable
Wpa_passphrase wpa_passphrase { }; Wpa_passphrase wpa_passphrase { };
unsigned _nic_drv_version = 0;
unsigned _wifi_drv_version = 0;
Rom_handler<Network> _wlan_accesspoints_rom { Rom_handler<Network> _wlan_accesspoints_rom {
_env, "report -> runtime/wifi/accesspoints", *this, &Network::_handle_wlan_accesspoints }; _env, "report -> runtime/wifi/accesspoints", *this, &Network::_handle_wlan_accesspoints };
@ -165,9 +162,6 @@ struct Sculpt::Network : Noncopyable
}); });
} }
void restart_nic_drv_on_next_runtime_cfg() { _nic_drv_version++; }
void restart_wifi_drv_on_next_runtime_cfg() { _wifi_drv_version++; }
void wifi_disconnect() void wifi_disconnect()
{ {
/* /*