mirror of
https://github.com/genodelabs/genode.git
synced 2025-06-18 23:28:29 +00:00
wifi: defer supplicant start-up
The SDIO connected wireless device on the PinePhone is not available on start-up, which leads to the supplicant failing to initalize 'wlan0'. Normally the supplicant would be used in a way that handling devices that appear at run-time happens gracefully. Rather than supporting this behavior we defer the start-up of the supplicant until the device could be openend successfully for now. Issue #4813
This commit is contained in:
committed by
Christian Helmuth
parent
0b08ae09c4
commit
eaaedb6ae8
@ -474,10 +474,6 @@ class Lx::Socket
|
|||||||
|
|
||||||
static Lx::Socket *_socket;
|
static Lx::Socket *_socket;
|
||||||
|
|
||||||
|
|
||||||
/* implemented in wlan.cc */
|
|
||||||
extern Blockade *wpa_blockade;
|
|
||||||
|
|
||||||
/* implemented in wlan.cc */
|
/* implemented in wlan.cc */
|
||||||
void _wifi_report_mac_address(Net::Mac_address const &mac_address);
|
void _wifi_report_mac_address(Net::Mac_address const &mac_address);
|
||||||
|
|
||||||
@ -489,8 +485,6 @@ extern "C" int socketcall_task_function(void *)
|
|||||||
|
|
||||||
void const *mac_addr = nullptr;
|
void const *mac_addr = nullptr;
|
||||||
|
|
||||||
wpa_blockade->wakeup();
|
|
||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -227,6 +227,26 @@ static int uplink_netdev_event(struct notifier_block *this,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static int new_device_netdev_event(struct notifier_block *this,
|
||||||
|
unsigned long event, void *ptr)
|
||||||
|
{
|
||||||
|
if (event == NETDEV_REGISTER)
|
||||||
|
if (uplink_task_struct_ptr)
|
||||||
|
lx_emul_task_unblock(uplink_task_struct_ptr);
|
||||||
|
|
||||||
|
return NOTIFY_DONE;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static struct notifier_block new_device_netdev_notifier = {
|
||||||
|
.notifier_call = new_device_netdev_event,
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/* implemented by wlan.cc */
|
||||||
|
extern void wakeup_wpa(void);
|
||||||
|
|
||||||
|
|
||||||
static int user_task_function(void *arg)
|
static int user_task_function(void *arg)
|
||||||
{
|
{
|
||||||
struct netdev_event_notification events;
|
struct netdev_event_notification events;
|
||||||
@ -235,6 +255,12 @@ static int user_task_function(void *arg)
|
|||||||
events.nb.notifier_call = uplink_netdev_event;
|
events.nb.notifier_call = uplink_netdev_event;
|
||||||
events.registered = false;
|
events.registered = false;
|
||||||
|
|
||||||
|
if (register_netdevice_notifier(&new_device_netdev_notifier)) {
|
||||||
|
printk("%s:%d: could not register netdev notifer for "
|
||||||
|
"new devices, abort\n", __func__, __LINE__);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
for (;;) {
|
for (;;) {
|
||||||
|
|
||||||
struct net_device *dev;
|
struct net_device *dev;
|
||||||
@ -246,7 +272,8 @@ static int user_task_function(void *arg)
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
/* enable link sensing, repeated calls are handled by testing IFF_UP */
|
/* enable link sensing, repeated calls are handled by testing IFF_UP */
|
||||||
dev_open(dev, 0);
|
if (dev_open(dev, 0) == 0)
|
||||||
|
wakeup_wpa();
|
||||||
|
|
||||||
/* install rx handler once */
|
/* install rx handler once */
|
||||||
if (!netdev_is_rx_handler_busy(dev))
|
if (!netdev_is_rx_handler_busy(dev))
|
||||||
|
@ -180,7 +180,18 @@ struct Wlan
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
Blockade *wpa_blockade;
|
static Blockade *wpa_blockade;
|
||||||
|
|
||||||
|
|
||||||
|
extern "C" void wakeup_wpa()
|
||||||
|
{
|
||||||
|
static bool called_once = false;
|
||||||
|
if (called_once)
|
||||||
|
return;
|
||||||
|
|
||||||
|
wpa_blockade->wakeup();
|
||||||
|
called_once = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void wifi_init(Env &env, Blockade &blockade)
|
void wifi_init(Env &env, Blockade &blockade)
|
||||||
|
Reference in New Issue
Block a user