diff --git a/repos/dde_linux/README b/repos/dde_linux/README index 6326f2aa96..00ae88a3e5 100644 --- a/repos/dde_linux/README +++ b/repos/dde_linux/README @@ -197,14 +197,7 @@ Configuration snippet: ! ! ! -! -!network={ -! id_str="foobar" -! ssid="foobar" -! key_mgmt=WPA-PSK -! psk="foobarfoobar" -!} -! +! ! ! ! @@ -214,6 +207,17 @@ Configuration snippet: ! !... + +Also, the driver can be switched to verbose logging with + +!... + The wifi_drv creates two distinct reports to communicate its state and information about the wireless infrastructure to other components. The first one is a list of all available accesspoints. The following examplary diff --git a/repos/dde_linux/run/wifi.run b/repos/dde_linux/run/wifi.run index e228b09b3e..44f470229c 100644 --- a/repos/dde_linux/run/wifi.run +++ b/repos/dde_linux/run/wifi.run @@ -7,8 +7,7 @@ set build_components { drivers/timer drivers/wifi drivers/rtc server/report_rom - server/ram_fs - server/fs_rom + server/dynamic_rom test/lwip/http_srv lib/vfs/jitterentropy } @@ -60,55 +59,44 @@ set config { - - - - - - - - - - - - } -append config " - " -append config { - - - - + + - + - - - - + + + + + } +append config "" +append config { + + + + - + - + - - + - - + + } @@ -143,7 +131,7 @@ set firmware_modules { # generic modules set boot_modules { - core init timer rtc_drv ram_fs report_rom fs_rom + core init timer rtc_drv report_rom dynamic_rom vfs_jitterentropy.lib.so ld.lib.so libc.lib.so libcrypto.lib.so libssl.lib.so diff --git a/repos/dde_linux/src/drivers/wifi/main.cc b/repos/dde_linux/src/drivers/wifi/main.cc index 279780d83c..507aafefbf 100644 --- a/repos/dde_linux/src/drivers/wifi/main.cc +++ b/repos/dde_linux/src/drivers/wifi/main.cc @@ -230,7 +230,8 @@ struct Main Main(Genode::Env &env) : env(env) { - bool const verbose = config_rom.xml().attribute_value("verbose", false); + bool const verbose = config_rom.xml().attribute_value("verbose", false); + long const interval = config_rom.xml().attribute_value("connected_scan_interval", 0L); /* * Forcefully disable 11n but for convenience the attribute is used the @@ -238,7 +239,7 @@ struct Main */ bool const disable_11n = !config_rom.xml().attribute_value("use_11n", true); - wpa = new (&heap) Wpa_thread(env, wpa_startup_lock(), verbose); + wpa = new (&heap) Wpa_thread(env, wpa_startup_lock(), verbose, interval); wpa->start(); diff --git a/repos/dde_linux/src/drivers/wifi/wpa.h b/repos/dde_linux/src/drivers/wifi/wpa.h index 2378be5340..016d56fd7e 100644 --- a/repos/dde_linux/src/drivers/wifi/wpa.h +++ b/repos/dde_linux/src/drivers/wifi/wpa.h @@ -18,7 +18,7 @@ #include /* entry function */ -extern "C" int wpa_main(int); +extern "C" int wpa_main(int debug_msg, int connected_scan_interval); extern "C" void wpa_conf_reload(void); class Wpa_thread : public Genode::Thread @@ -28,19 +28,23 @@ class Wpa_thread : public Genode::Thread Genode::Lock &_lock; int _exit; bool _debug_msg; + int _connected_scan_interval; public: - Wpa_thread(Genode::Env &env, Genode::Lock &lock, bool debug_msg) + Wpa_thread(Genode::Env &env, Genode::Lock &lock, + bool debug_msg, int connected_scan_interval) : Thread(env, "wpa_supplicant", 8*1024*sizeof(long)), - _lock(lock), _exit(-1), _debug_msg(debug_msg) { } + _lock(lock), _exit(-1), + _debug_msg(debug_msg), _connected_scan_interval(connected_scan_interval) + { } void entry() { /* wait until the wifi driver is up and running */ _lock.lock(); - _exit = wpa_main(_debug_msg); + _exit = wpa_main(_debug_msg, _connected_scan_interval); Genode::sleep_forever(); } }; diff --git a/repos/dde_linux/src/lib/wifi/lxcc_emul.cc b/repos/dde_linux/src/lib/wifi/lxcc_emul.cc index 2ab05b54c2..7cdc5cc3b2 100644 --- a/repos/dde_linux/src/lib/wifi/lxcc_emul.cc +++ b/repos/dde_linux/src/lib/wifi/lxcc_emul.cc @@ -981,11 +981,9 @@ void __free_page_frag(void *addr) void __free_pages(struct page *page, unsigned int order) { - if (!atomic_dec_and_test(&page->_count)) { - Genode::warning("attempting to free page ", page, " with _count: ", - atomic_read(&page->_count)); + if (!atomic_dec_and_test(&page->_count)) + /* reference counter did not drop to zero - do not free yet */ return; - } Addr_to_page_mapping::remove(page); diff --git a/repos/dde_linux/src/lib/wpa_supplicant/main.c b/repos/dde_linux/src/lib/wpa_supplicant/main.c index 1186f44437..b02e4dea78 100644 --- a/repos/dde_linux/src/lib/wpa_supplicant/main.c +++ b/repos/dde_linux/src/lib/wpa_supplicant/main.c @@ -30,14 +30,31 @@ /* local includes */ #include "includes.h" #include "common.h" +#include "eloop.h" #include "wpa_supplicant_i.h" +#include "driver_i.h" +#include "scan.h" static char const *conf_file = "/config/wpa_supplicant.conf"; +static int connected_scan_interval; -int wpa_main(int debug_msg) +static void connected_scan_handler(void *eloop_ctx, void *user_ctx) { + struct wpa_supplicant *wpa_s = (struct wpa_supplicant *)eloop_ctx; + + if (wpa_s->wpa_state >= WPA_ASSOCIATED) + wpa_supplicant_req_scan(wpa_s, 0, 0); + + eloop_register_timeout(connected_scan_interval, 0, connected_scan_handler, wpa_s, 0); +} + + +int wpa_main(int debug_msg, int interval) +{ + connected_scan_interval = interval; + struct wpa_interface iface; int exitcode = 0; struct wpa_params params; @@ -59,6 +76,10 @@ int wpa_main(int debug_msg) if (wpa_supplicant_add_iface(global, &iface) == NULL) exitcode = -1; + if (connected_scan_interval > 0) + eloop_register_timeout(connected_scan_interval, 0, + connected_scan_handler, global->ifaces, 0); + if (exitcode == 0) exitcode = wpa_supplicant_run(global); @@ -78,7 +99,7 @@ void wpa_conf_reload(void) int wpa_write_conf(char const *buffer, size_t len) { - int fd = open(conf_file, O_TRUNC|O_WRONLY); + int fd = open(conf_file, O_CREAT|O_TRUNC|O_WRONLY); if (fd == -1) return -1;