mirror of
https://github.com/Quill-OS/quill.git
synced 2024-12-26 07:37:21 -08:00
Wi-Fi fix
This commit is contained in:
parent
af75ba1969
commit
fe0e62d672
2 changed files with 26 additions and 17 deletions
|
@ -1102,22 +1102,31 @@ namespace {
|
|||
}
|
||||
}
|
||||
global::wifi::wifiState checkWifiState() {
|
||||
foreach(QNetworkInterface interface, QNetworkInterface::allInterfaces()) {
|
||||
// If something is wrong, debug with this:
|
||||
// qDebug() << interface;
|
||||
if(interface.flags().testFlag(QNetworkInterface::IsLoopBack) == false) {
|
||||
if(interface.flags().testFlag(QNetworkInterface::IsUp) == true) {
|
||||
if(interface.flags().testFlag(QNetworkInterface::IsRunning) == true) {
|
||||
global::wifi::isConnected = true;
|
||||
return global::wifi::wifiState::configured;
|
||||
}
|
||||
global::wifi::isConnected = false;
|
||||
return global::wifi::wifiState::enabled;
|
||||
}
|
||||
}
|
||||
QString interfaceStateFileHead = "/sys/class/net/";
|
||||
QString interfaceStateFileTail = "/operstate";
|
||||
QString interfaceName;
|
||||
QString interfaceStateFile;
|
||||
if(global::deviceID == "n437\n" or global::deviceID == "kt\n") {
|
||||
interfaceName = "wlan0";
|
||||
}
|
||||
else {
|
||||
interfaceName = "eth0";
|
||||
}
|
||||
interfaceStateFile = interfaceStateFileHead + interfaceName + interfaceStateFileTail;
|
||||
|
||||
QString state = readFile(interfaceStateFile);
|
||||
if(state == "up\n") {
|
||||
global::wifi::isConnected = true;
|
||||
return global::wifi::wifiState::configured;
|
||||
}
|
||||
else if(state == "unknown\n") {
|
||||
global::wifi::isConnected = false;
|
||||
return global::wifi::wifiState::enabled;
|
||||
}
|
||||
else {
|
||||
global::wifi::isConnected = false;
|
||||
return global::wifi::wifiState::disabled;
|
||||
}
|
||||
global::wifi::isConnected = false;
|
||||
return global::wifi::wifiState::disabled;
|
||||
}
|
||||
int testPing() {
|
||||
// For some reason, implementing a non-blocking version of this functions triggers a "terminate called without an active exception" error with a platform plugin compiled with a newer GCC 11 toolchain. The problem has been solved by transplanting this function into the related area which uses it.
|
||||
|
|
|
@ -370,8 +370,8 @@ void connectiondialog::finalConnectWait() {
|
|||
else {
|
||||
string_writeconfig("/opt/ibxd", "connect_to_wifi_network\n");
|
||||
|
||||
// This will be deleted later in MainWindow's icon updater if it failed. It is also deleted in the Wi-Fi stop script
|
||||
log("Writing to config directory with connection information data", className);
|
||||
// This will be deleted later in MainWindow's icon updater if it failed. It is also deleted in the Wi-Fi stop script.
|
||||
log("Writing to configuration directory with connection information data", className);
|
||||
string_writeconfig("/mnt/onboard/.adds/inkbox/.config/17-wifi_connection_information/essid", connectedNetworkData.name.toStdString());
|
||||
string_writeconfig("/mnt/onboard/.adds/inkbox/.config/17-wifi_connection_information/passphrase", passphraseForReconnecting.toStdString());
|
||||
|
||||
|
|
Loading…
Reference in a new issue