diff --git a/repos/gems/run/sculpt/wifi.config b/repos/gems/run/sculpt/wifi.config index 29bc2ccd3..fca9f9fd0 100644 --- a/repos/gems/run/sculpt/wifi.config +++ b/repos/gems/run/sculpt/wifi.config @@ -1,3 +1,3 @@ - + diff --git a/repos/gems/src/app/sculpt_manager/model/wifi_connection.h b/repos/gems/src/app/sculpt_manager/model/wifi_connection.h index 85f906c4b..505c4ffc3 100644 --- a/repos/gems/src/app/sculpt_manager/model/wifi_connection.h +++ b/repos/gems/src/app/sculpt_manager/model/wifi_connection.h @@ -25,6 +25,8 @@ struct Sculpt::Wifi_connection State state; + bool auth_failed; + Access_point::Bssid bssid; Access_point::Ssid ssid; @@ -36,25 +38,35 @@ struct Sculpt::Wifi_connection bool const connected = node.has_sub_node("accesspoint") && node.sub_node("accesspoint").attribute("state").has_value("connected"); + bool const connecting = + node.has_sub_node("accesspoint") && + node.sub_node("accesspoint").attribute("state").has_value("connecting"); + bool const auth_failed = + node.has_sub_node("accesspoint") && + node.sub_node("accesspoint").attribute_value("auth_failure", false); - if (!connected) + if (!connected && !connecting) return { .state = DISCONNECTED, + .auth_failed = auth_failed, .bssid = Access_point::Bssid{}, .ssid = Access_point::Bssid{} }; Xml_node const ap = node.sub_node("accesspoint"); - return { .state = CONNECTED, + return { .state = connected ? CONNECTED : CONNECTING, + .auth_failed = false, .bssid = ap.attribute_value("bssid", Access_point::Bssid()), .ssid = ap.attribute_value("ssid", Access_point::Ssid()) }; } static Wifi_connection disconnected_wifi_connection() { - return Wifi_connection { DISCONNECTED, Access_point::Bssid{}, Access_point::Ssid{} }; + return Wifi_connection { DISCONNECTED, false, Access_point::Bssid{}, Access_point::Ssid{} }; } - bool connected() const { return state == CONNECTED; } + bool connected() const { return state == CONNECTED; } + bool connecting() const { return state == CONNECTING; } + bool auth_failure() const { return auth_failed; } }; #endif /* _MODEL__WIFI_CONNECTION_H_ */ diff --git a/repos/gems/src/app/sculpt_manager/network.h b/repos/gems/src/app/sculpt_manager/network.h index e0b98b61e..0608be3d0 100644 --- a/repos/gems/src/app/sculpt_manager/network.h +++ b/repos/gems/src/app/sculpt_manager/network.h @@ -165,7 +165,7 @@ struct Sculpt::Network : Network_dialog::Action xml.attribute("verbose_state", false); xml.attribute("verbose", false); - xml.node("accesspoint", [&]() { + xml.node("network", [&]() { xml.attribute("ssid", ap.ssid); /* for now always try to use WPA2 */ @@ -193,14 +193,14 @@ struct Sculpt::Network : Network_dialog::Action xml.attribute("scan_interval", 10U); xml.attribute("use_11n", false); - xml.node("accesspoints", [&]() { - xml.node("accesspoint", [&]() { + xml.attribute("verbose_state", false); + xml.attribute("verbose", false); - /* generate attributes to ease subsequent manual tweaking */ - xml.attribute("ssid", ""); - xml.attribute("protection", "NONE"); - xml.attribute("passphrase", ""); - }); + xml.node("network", [&]() { + /* generate attributes to ease subsequent manual tweaking */ + xml.attribute("ssid", ""); + xml.attribute("protection", "NONE"); + xml.attribute("passphrase", ""); }); }); diff --git a/repos/gems/src/app/sculpt_manager/runtime/wifi_drv.cc b/repos/gems/src/app/sculpt_manager/runtime/wifi_drv.cc index 28fd26a49..8f589be22 100644 --- a/repos/gems/src/app/sculpt_manager/runtime/wifi_drv.cc +++ b/repos/gems/src/app/sculpt_manager/runtime/wifi_drv.cc @@ -15,7 +15,7 @@ void Sculpt::gen_wifi_drv_start_content(Xml_generator &xml) { - gen_common_start_content(xml, "wifi_drv", Cap_quota{200}, Ram_quota{24*1024*1024}); + gen_common_start_content(xml, "wifi_drv", Cap_quota{200}, Ram_quota{32*1024*1024}); gen_provides(xml); diff --git a/repos/gems/src/app/sculpt_manager/view/network_dialog.cc b/repos/gems/src/app/sculpt_manager/view/network_dialog.cc index bc9a99a48..09779fad1 100644 --- a/repos/gems/src/app/sculpt_manager/view/network_dialog.cc +++ b/repos/gems/src/app/sculpt_manager/view/network_dialog.cc @@ -75,7 +75,8 @@ bool Sculpt::Network_dialog::_selected_ap_unprotected() const bool Sculpt::Network_dialog::need_keyboard_focus_for_passphrase() const { - if (_wifi_connection.state == Wifi_connection::CONNECTED) + if ( _wifi_connection.state == Wifi_connection::CONNECTED + || _wifi_connection.state == Wifi_connection::CONNECTING) return false; if (!_nic_target.wifi()) @@ -86,7 +87,8 @@ bool Sculpt::Network_dialog::need_keyboard_focus_for_passphrase() const } -void Sculpt::Network_dialog::_gen_access_point_list(Xml_generator &xml) const +void Sculpt::Network_dialog::_gen_access_point_list(Xml_generator &xml, + bool auth_failure) const { if (_wlan_config_policy == WLAN_CONFIG_MANUAL) return; @@ -121,7 +123,9 @@ void Sculpt::Network_dialog::_gen_access_point_list(Xml_generator &xml) const if (ap.protection == Access_point::WPA_PSK) { gen_named_node(xml, "label", "passphrase msg", [&] () { - xml.attribute("text", "Enter passphrase:"); }); + xml.attribute("text", auth_failure ? "Enter passphrase (auth failure):" + : "Enter passphrase:"); + }); gen_named_node(xml, "frame", "passphrase", [&] () { xml.node("float", [&] () { @@ -160,7 +164,7 @@ void Sculpt::Network_dialog::_gen_access_point_list(Xml_generator &xml) const } -void Sculpt::Network_dialog::_gen_connected_ap(Xml_generator &xml) const +void Sculpt::Network_dialog::_gen_connected_ap(Xml_generator &xml, bool connected) const { bool done = false; @@ -185,7 +189,9 @@ void Sculpt::Network_dialog::_gen_connected_ap(Xml_generator &xml) const Access_point::UNKNOWN }); gen_named_node(xml, "label", "associated", [&] () { - xml.attribute("text", "associated"); }); + xml.attribute("text", connected ? "associated" + : "connecting"); + }); } @@ -243,9 +249,12 @@ void Sculpt::Network_dialog::generate(Xml_generator &xml) const */ if (_nic_target.wifi()) { if (_wifi_connection.connected()) - _gen_connected_ap(xml); + _gen_connected_ap(xml, true); + else if (_wifi_connection.connecting()) + _gen_connected_ap(xml, false); else - _gen_access_point_list(xml); + _gen_access_point_list(xml, + _wifi_connection.auth_failure()); } /* append display of uplink IP address */ diff --git a/repos/gems/src/app/sculpt_manager/view/network_dialog.h b/repos/gems/src/app/sculpt_manager/view/network_dialog.h index 6da9a8abf..44e17c897 100644 --- a/repos/gems/src/app/sculpt_manager/view/network_dialog.h +++ b/repos/gems/src/app/sculpt_manager/view/network_dialog.h @@ -73,8 +73,8 @@ struct Sculpt::Network_dialog : Dialog bool _selected_ap_unprotected() const; void _gen_access_point(Xml_generator &, Access_point const &) const; - void _gen_connected_ap(Xml_generator &) const; - void _gen_access_point_list(Xml_generator &) const; + void _gen_connected_ap(Xml_generator &, bool) const; + void _gen_access_point_list(Xml_generator &, bool) const; void generate(Xml_generator &) const;