mirror of
https://github.com/genodelabs/genode.git
synced 2025-04-09 04:15:52 +00:00
parent
293e86eda9
commit
337184fbc6
@ -1,3 +1,3 @@
|
||||
<wifi connected_scan_interval="0" scan_interval="5" use_11n="no" rfkill="no" verbose="no">
|
||||
<accesspoint ssid="" protection="NONE" passphrase=""/>
|
||||
<network ssid="" protection="NONE" passphrase=""/>
|
||||
</wifi>
|
||||
|
@ -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_ */
|
||||
|
@ -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", "");
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -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<Nic::Session>(xml);
|
||||
|
||||
|
@ -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 */
|
||||
|
@ -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;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user