mirror of
https://github.com/genodelabs/genode.git
synced 2025-02-22 10:21:04 +00:00
wifi: run wpa_main in pthread
This commit is contained in:
parent
73d089da36
commit
8699f5592f
@ -111,7 +111,6 @@ struct Main
|
|||||||
_wifi_frontend = &*_frontend;
|
_wifi_frontend = &*_frontend;
|
||||||
|
|
||||||
_wpa.construct(env, _wpa_startup_lock);
|
_wpa.construct(env, _wpa_startup_lock);
|
||||||
_wpa->start();
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Forcefully disable 11n but for convenience the attribute is used the
|
* Forcefully disable 11n but for convenience the attribute is used the
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
REQUIRES = x86
|
REQUIRES = x86
|
||||||
|
|
||||||
TARGET = wifi_drv
|
TARGET = wifi_drv
|
||||||
SRC_CC = main.cc
|
SRC_CC = main.cc wpa.cc
|
||||||
LIBS = base wifi iwl_firmware
|
LIBS = base wifi iwl_firmware
|
||||||
LIBS += wpa_supplicant
|
LIBS += wpa_supplicant libc
|
||||||
|
|
||||||
# needed for firmware.h
|
# needed for firmware.h
|
||||||
INC_DIR += $(REP_DIR)/src/lib/wifi/include
|
INC_DIR += $(REP_DIR)/src/lib/wifi/include
|
||||||
|
57
repos/dde_linux/src/drivers/wifi/wpa.cc
Normal file
57
repos/dde_linux/src/drivers/wifi/wpa.cc
Normal file
@ -0,0 +1,57 @@
|
|||||||
|
/*
|
||||||
|
* \brief Wpa_supplicant thread of the wifi driver
|
||||||
|
* \author Josef Soentgen
|
||||||
|
* \author Christian Helmuth
|
||||||
|
* \date 2019-12-18
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2019 Genode Labs GmbH
|
||||||
|
*
|
||||||
|
* This file is distributed under the terms of the GNU General Public License
|
||||||
|
* version 2.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Genode includes */
|
||||||
|
#include <base/env.h>
|
||||||
|
#include <base/lock.h>
|
||||||
|
#include <base/sleep.h>
|
||||||
|
|
||||||
|
/* libc includes */
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <pthread.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
#include "wpa.h"
|
||||||
|
|
||||||
|
|
||||||
|
/* entry function */
|
||||||
|
extern "C" int wpa_main(void);
|
||||||
|
|
||||||
|
|
||||||
|
void * Wpa_thread::_entry_trampoline(void *arg)
|
||||||
|
{
|
||||||
|
Wpa_thread *t = (Wpa_thread *)arg;
|
||||||
|
t->_entry();
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Wpa_thread::_entry()
|
||||||
|
{
|
||||||
|
/* wait until the wifi driver is up and running */
|
||||||
|
_lock.lock();
|
||||||
|
_exit = wpa_main();
|
||||||
|
Genode::sleep_forever();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Wpa_thread::Wpa_thread(Genode::Env &env, Genode::Lock &lock)
|
||||||
|
: _lock(lock), _exit(-1)
|
||||||
|
{
|
||||||
|
pthread_t tid = 0;
|
||||||
|
if (pthread_create(&tid, 0, _entry_trampoline, this) != 0) {
|
||||||
|
printf("Error: pthread_create() failed\n");
|
||||||
|
exit(-1);
|
||||||
|
}
|
||||||
|
}
|
@ -14,34 +14,26 @@
|
|||||||
#ifndef _WIFI__WPA_H_
|
#ifndef _WIFI__WPA_H_
|
||||||
#define _WIFI__WPA_H_
|
#define _WIFI__WPA_H_
|
||||||
|
|
||||||
/* Genode includes */
|
|
||||||
#include <base/sleep.h>
|
|
||||||
|
|
||||||
/* entry function */
|
namespace Genode {
|
||||||
extern "C" int wpa_main(void);
|
struct Env;
|
||||||
|
struct Lock;
|
||||||
|
}
|
||||||
|
|
||||||
class Wpa_thread : public Genode::Thread
|
class Wpa_thread
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
|
|
||||||
Genode::Lock &_lock;
|
Genode::Lock &_lock;
|
||||||
int _exit;
|
int _exit;
|
||||||
|
|
||||||
|
static void * _entry_trampoline(void *arg);
|
||||||
|
|
||||||
|
void _entry();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
Wpa_thread(Genode::Env &env, Genode::Lock &lock)
|
Wpa_thread(Genode::Env &env, Genode::Lock &lock);
|
||||||
:
|
|
||||||
Thread(env, "wpa_supplicant", 8*1024*sizeof(long)),
|
|
||||||
_lock(lock), _exit(-1)
|
|
||||||
{ }
|
|
||||||
|
|
||||||
void entry()
|
|
||||||
{
|
|
||||||
/* wait until the wifi driver is up and running */
|
|
||||||
_lock.lock();
|
|
||||||
_exit = wpa_main();
|
|
||||||
Genode::sleep_forever();
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* _WIFI__WPA_H_ */
|
#endif /* _WIFI__WPA_H_ */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user