sculpt_manager: adapt to new wifi_drv front end

This commit is contained in:
Josef Söntgen 2018-08-07 16:47:55 +02:00 committed by Christian Helmuth
parent ae50bf84c6
commit 4bb5046e1f
9 changed files with 54 additions and 34 deletions

View File

@ -91,7 +91,7 @@ install_config {
<dir name="managed">
<rom name="fonts" label="fonts.config"/>
<rom name="fb_drv" label="fb_drv.config"/>
<rom name="wlan" label="wlan.config"/>
<rom name="wifi" label="wifi.config"/>
<rom name="installation"/>
<rom name="runtime" label="empty_runtime.config"/>
<rom name="input_filter" label="input_filter.config"/>
@ -149,8 +149,8 @@ install_config {
<dir name="runtime">
<inline name="state"><empty/></inline>
<dir name="wifi_drv">
<inline name="wlan_accesspoints"><empty/></inline>
<inline name="wlan_state"> <empty/> </inline>
<inline name="accesspoints"><empty/></inline>
<inline name="state"> <empty/></inline>
</dir>
<dir name="nic_router"> <inline name="state"> <empty/></inline> </dir>
<dir name="update"> <inline name="state"> <empty/></inline> </dir>

View File

@ -166,8 +166,8 @@
<route>
<service name="Report" label="runtime_config">
<child name="config_fs_report" label="managed -> runtime"/> </service>
<service name="Report" label="wlan_config">
<child name="config_fs_report" label="managed -> wlan"/> </service>
<service name="Report" label="wifi_config">
<child name="config_fs_report" label="managed -> wifi"/> </service>
<service name="Report" label="fonts_config">
<child name="config_fs_report" label="managed -> fonts"/> </service>
<service name="Report" label="nic_router_config">

View File

@ -0,0 +1,3 @@
<wifi connected_scan_interval="0" scan_interval="5" use_11n="no" rfkill="no" verbose="no">
<accesspoint ssid="" protection="NONE" passphrase=""/>
</wifi>

View File

@ -1 +0,0 @@
<selected_network ssid="" protection="WPA-PSK" psk=""/>

View File

@ -47,7 +47,7 @@ struct Sculpt::Access_point : List_model<Access_point>::Element
/**
* Policy for transforming a 'wlan_accesspoints' report into a list model
* Policy for transforming a 'accesspoints' report into a list model
*/
struct Sculpt::Access_point_update_policy : List_model<Access_point>::Update_policy
{
@ -60,12 +60,13 @@ struct Sculpt::Access_point_update_policy : List_model<Access_point>::Update_pol
Access_point &create_element(Xml_node node)
{
auto const protection = node.attribute_value("protection", String<16>());
bool const use_protection = protection == "WPA" || protection == "WPA2";
return *new (_alloc)
Access_point(node.attribute_value("bssid", Access_point::Bssid()),
node.attribute_value("ssid", Access_point::Ssid()),
protection == "WPA-PSK" ? Access_point::Protection::WPA_PSK :
Access_point::Protection::UNPROTECTED);
use_protection ? Access_point::Protection::WPA_PSK
: Access_point::Protection::UNPROTECTED);
}
void update_element(Access_point &ap, Xml_node node)

View File

@ -29,7 +29,7 @@ struct Sculpt::Wifi_connection
Access_point::Ssid ssid;
/**
* Create 'Wifi_connection' object from 'wlan_state' report
* Create 'Wifi_connection' object from 'state' report
*/
static Wifi_connection from_xml(Xml_node node)
{

View File

@ -53,10 +53,10 @@ struct Sculpt::Network : Network_dialog::Action
bool _use_wifi_drv = false;
Attached_rom_dataspace _wlan_accesspoints_rom {
_env, "report -> runtime/wifi_drv/wlan_accesspoints" };
_env, "report -> runtime/wifi_drv/accesspoints" };
Attached_rom_dataspace _wlan_state_rom {
_env, "report -> runtime/wifi_drv/wlan_state" };
_env, "report -> runtime/wifi_drv/state" };
Attached_rom_dataspace _nic_router_state_rom {
_env, "report -> runtime/nic_router/state" };
@ -102,7 +102,7 @@ struct Sculpt::Network : Network_dialog::Action
_pci_info };
Managed_config<Network> _wlan_config {
_env, "selected_network", "wlan", *this, &Network::_handle_wlan_config };
_env, "config", "wifi", *this, &Network::_handle_wlan_config };
void _handle_wlan_config(Xml_node)
{
@ -157,12 +157,24 @@ struct Sculpt::Network : Network_dialog::Action
_wifi_connection.state = Wifi_connection::CONNECTING;
_wlan_config.generate([&] (Xml_generator &xml) {
xml.attribute("ssid", ap.ssid);
if (ap.protection == Access_point::WPA_PSK) {
xml.attribute("protection", "WPA-PSK");
String<128> const psk(wpa_passphrase);
xml.attribute("psk", psk);
}
xml.attribute("connected_scan_interval", 0U);
xml.attribute("scan_interval", 10U);
xml.attribute("use_11n", false);
xml.attribute("verbose_state", false);
xml.attribute("verbose", false);
xml.node("accesspoint", [&]() {
xml.attribute("ssid", ap.ssid);
/* for now always try to use WPA2 */
if (ap.protection == Access_point::WPA_PSK) {
xml.attribute("protection", "WPA2");
String<128> const psk(wpa_passphrase);
xml.attribute("passphrase", psk);
}
});
});
});
}
@ -177,10 +189,19 @@ struct Sculpt::Network : Network_dialog::Action
_wlan_config.generate([&] (Xml_generator &xml) {
/* generate attributes to ease subsequent manual tweaking */
xml.attribute("ssid", "");
xml.attribute("protection", "WPA-PSK");
xml.attribute("psk", "");
xml.attribute("connected_scan_interval", 0U);
xml.attribute("scan_interval", 10U);
xml.attribute("use_11n", false);
xml.node("accesspoints", [&]() {
xml.node("accesspoint", [&]() {
/* generate attributes to ease subsequent manual tweaking */
xml.attribute("ssid", "");
xml.attribute("protection", "NONE");
xml.attribute("passphrase", "");
});
});
});
_runtime_config_generator.generate_runtime_config();

View File

@ -15,13 +15,11 @@
void Sculpt::gen_wifi_drv_start_content(Xml_generator &xml)
{
gen_common_start_content(xml, "wifi_drv", Cap_quota{300}, Ram_quota{54*1024*1024});
gen_common_start_content(xml, "wifi_drv", Cap_quota{200}, Ram_quota{24*1024*1024});
gen_provides<Nic::Session>(xml);
xml.node("config", [&] () {
xml.attribute("connected_scan_interval", "0");
xml.attribute("use_11n", "no");
xml.node("vfs", [&] () {
gen_named_node(xml, "dir", "dev", [&] () {
@ -29,16 +27,14 @@ void Sculpt::gen_wifi_drv_start_content(Xml_generator &xml)
xml.node("zero", [&] () {});
xml.node("rtc", [&] () {});
xml.node("log", [&] () {});
xml.node("null", [&] () {});
gen_named_node(xml, "jitterentropy", "random");
gen_named_node(xml, "jitterentropy", "urandom"); });
gen_named_node(xml, "dir", "config", [&] () {
xml.node("ram", [&] () {}); });
});
xml.node("libc", [&] () {
xml.attribute("stdout", "/dev/null");
xml.attribute("stderr", "/dev/log");
xml.attribute("stderr", "/dev/null");
xml.attribute("rtc", "/dev/rtc");
});
});
@ -75,9 +71,9 @@ void Sculpt::gen_wifi_drv_start_content(Xml_generator &xml)
gen_parent_route<Report::Session> (xml);
gen_service_node<Rom_session>(xml, [&] () {
xml.attribute("label", "wlan_configuration");
xml.attribute("label", "wifi_config");
xml.node("parent", [&] () {
xml.attribute("label", "config -> managed/wlan"); }); });
xml.attribute("label", "config -> managed/wifi"); }); });
gen_service_node<Platform::Session>(xml, [&] () {
xml.node("parent", [&] () {

View File

@ -151,7 +151,7 @@ void Sculpt::Network_dialog::_gen_access_point_list(Xml_generator &xml) const
});
/*
* Present motivational message until we get the first 'wlan_accesspoints'
* Present motivational message until we get the first 'accesspoints'
* report.
*/
if (cnt == 0)
@ -177,7 +177,7 @@ void Sculpt::Network_dialog::_gen_connected_ap(Xml_generator &xml) const
/*
* If access point is not present in the list, fall back to the information
* given in the 'wlan_state' report.
* given in the 'state' report.
*/
if (!done)
_gen_access_point(xml, Access_point { _wifi_connection.bssid,