提交 d577acd7 authored 作者: blu's avatar blu

new feature: evwifi

上级 c62df916
...@@ -63,6 +63,8 @@ class WifiMgr { ...@@ -63,6 +63,8 @@ class WifiMgr {
// stop all // stop all
spdlog::info("prepare to enter AP mode"); spdlog::info("prepare to enter AP mode");
exec("systemctl stop wpa_supplicant@wlan1"); exec("systemctl stop wpa_supplicant@wlan1");
exec("ifconfig wlan1 down");
exec("ifconfig wlan1 up");
exec("ifconfig wlan1 192.168.0.1"); exec("ifconfig wlan1 192.168.0.1");
// exec("systemctl dsiable wpa_supplicant@wlan1 ") // exec("systemctl dsiable wpa_supplicant@wlan1 ")
string apdContent = fmt::format("interface=wlan1\ndriver=nl80211\nssid=EVB-{}\nhw_mode=g\n" string apdContent = fmt::format("interface=wlan1\ndriver=nl80211\nssid=EVB-{}\nhw_mode=g\n"
...@@ -104,9 +106,11 @@ class WifiMgr { ...@@ -104,9 +106,11 @@ class WifiMgr {
wpaFile << wpaContent; wpaFile << wpaContent;
wpaFile.close(); wpaFile.close();
// TODO: verify // TODO: verify
spdlog::info(exec("systemctl enable wpa_supplicant@wlan1")); exec("ifconfig wlan1 down");
spdlog::info(exec("systemctl restart wpa_supplicant@wlan1")); exec("ifconfig wlan1 up");
spdlog::info(exec("dhclient -r wlan1")); exec("systemctl enable wpa_supplicant@wlan1");
exec("systemctl restart wpa_supplicant@wlan1");
exec("dhclient -r wlan1");
}else{ }else{
string msg = fmt::format("failed write wpa config to {}", wpaCfgPath); string msg = fmt::format("failed write wpa config to {}", wpaCfgPath);
ret["code"] = 2; ret["code"] = 2;
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论