diff --git a/buildroot/.config b/buildroot/.config index a5d1cfa2..e67ee5c3 100644 --- a/buildroot/.config +++ b/buildroot/.config @@ -1,6 +1,6 @@ # # Automatically generated file; DO NOT EDIT. -# Buildroot 2015.02-git-00009-g86ba8d2-dirty Configuration +# Buildroot 2015.02-git-00002-g7ee9400-dirty Configuration # BR2_HAVE_DOT_CONFIG=y @@ -758,7 +758,58 @@ BR2_PACKAGE_QJSON=y # # BR2_PACKAGE_AM33X_CM3 is not set # BR2_PACKAGE_B43_FIRMWARE is not set -# BR2_PACKAGE_LINUX_FIRMWARE is not set +BR2_PACKAGE_LINUX_FIRMWARE=y + +# +# Audio firmware +# +# BR2_PACKAGE_LINUX_FIRMWARE_INTEL_SST_DSP is not set + +# +# WiFi firmware +# +# BR2_PACKAGE_LINUX_FIRMWARE_ATHEROS_6002 is not set +# BR2_PACKAGE_LINUX_FIRMWARE_ATHEROS_6003 is not set +# BR2_PACKAGE_LINUX_FIRMWARE_ATHEROS_6004 is not set +# BR2_PACKAGE_LINUX_FIRMWARE_ATHEROS_7010 is not set +# BR2_PACKAGE_LINUX_FIRMWARE_ATHEROS_9170 is not set +# BR2_PACKAGE_LINUX_FIRMWARE_ATHEROS_9271 is not set +# BR2_PACKAGE_LINUX_FIRMWARE_BRCM_BCM43XX is not set +# BR2_PACKAGE_LINUX_FIRMWARE_BRCM_BCM43XXX is not set +# BR2_PACKAGE_LINUX_FIRMWARE_IWLWIFI_3160 is not set +# BR2_PACKAGE_LINUX_FIRMWARE_IWLWIFI_5000 is not set +# BR2_PACKAGE_LINUX_FIRMWARE_IWLWIFI_7260 is not set +# BR2_PACKAGE_LINUX_FIRMWARE_IWLWIFI_7265 is not set +# BR2_PACKAGE_LINUX_FIRMWARE_LIBERTAS_SD8686_V8 is not set +# BR2_PACKAGE_LINUX_FIRMWARE_LIBERTAS_SD8686_V9 is not set +# BR2_PACKAGE_LINUX_FIRMWARE_LIBERTAS_SD8688 is not set +# BR2_PACKAGE_LINUX_FIRMWARE_MWIFIEX_SD8787 is not set +# BR2_PACKAGE_LINUX_FIRMWARE_RALINK_RT61 is not set +# BR2_PACKAGE_LINUX_FIRMWARE_RALINK_RT73 is not set +BR2_PACKAGE_LINUX_FIRMWARE_RALINK_RT2XX=y +# BR2_PACKAGE_LINUX_FIRMWARE_RTL_81XX is not set +# BR2_PACKAGE_LINUX_FIRMWARE_RTL_87XX is not set +# BR2_PACKAGE_LINUX_FIRMWARE_RTL_88XX is not set +# BR2_PACKAGE_LINUX_FIRMWARE_TI_WL127X is not set +# BR2_PACKAGE_LINUX_FIRMWARE_TI_WL128X is not set +# BR2_PACKAGE_LINUX_FIRMWARE_TI_WL18XX is not set + +# +# Ethernet firmware +# +# BR2_PACKAGE_LINUX_FIRMWARE_BNX2X is not set +# BR2_PACKAGE_LINUX_FIRMWARE_CXGB4_T4 is not set +# BR2_PACKAGE_LINUX_FIRMWARE_CXGB4_T5 is not set +# BR2_PACKAGE_LINUX_FIRMWARE_RTL_8169 is not set + +# +# DVB firmware +# +# BR2_PACKAGE_LINUX_FIRMWARE_AS102 is not set +# BR2_PACKAGE_LINUX_FIRMWARE_DIB0700 is not set +# BR2_PACKAGE_LINUX_FIRMWARE_ITETECH_IT9135 is not set +# BR2_PACKAGE_LINUX_FIRMWARE_H5_DRXK is not set +# BR2_PACKAGE_LINUX_FIRMWARE_XCx000 is not set BR2_PACKAGE_RPI_FIRMWARE=y # BR2_PACKAGE_RPI_FIRMWARE_DEFAULT is not set # BR2_PACKAGE_RPI_FIRMWARE_X is not set @@ -1261,7 +1312,8 @@ BR2_PACKAGE_CANFESTIVAL_ARCH_SUPPORTS=y # # libnftnl needs a toolchain w/ IPv6, largefile # -# BR2_PACKAGE_LIBNL is not set +BR2_PACKAGE_LIBNL=y +# BR2_PACKAGE_LIBNL_TOOLS is not set # BR2_PACKAGE_LIBOAUTH is not set # @@ -1553,7 +1605,7 @@ BR2_PACKAGE_LIBICONV=y # iptraf-ng needs a toolchain w/ IPv6 # # BR2_PACKAGE_IPUTILS is not set -# BR2_PACKAGE_IW is not set +BR2_PACKAGE_IW=y # BR2_PACKAGE_JANUS_GATEWAY is not set # BR2_PACKAGE_KISMET is not set # BR2_PACKAGE_KNOCK is not set @@ -1719,9 +1771,17 @@ BR2_PACKAGE_LIBICONV=y BR2_PACKAGE_WGET=y # BR2_PACKAGE_WHOIS is not set # BR2_PACKAGE_WIRELESS_REGDB is not set -# BR2_PACKAGE_WIRELESS_TOOLS is not set +BR2_PACKAGE_WIRELESS_TOOLS=y +# BR2_PACKAGE_WIRELESS_TOOLS_LIB is not set # BR2_PACKAGE_WIRESHARK is not set -# BR2_PACKAGE_WPA_SUPPLICANT is not set +BR2_PACKAGE_WPA_SUPPLICANT=y +BR2_PACKAGE_WPA_SUPPLICANT_AP_SUPPORT=y +BR2_PACKAGE_WPA_SUPPLICANT_EAP=y +BR2_PACKAGE_WPA_SUPPLICANT_HOTSPOT=y +# BR2_PACKAGE_WPA_SUPPLICANT_DEBUG_SYSLOG is not set +BR2_PACKAGE_WPA_SUPPLICANT_WPS=y +BR2_PACKAGE_WPA_SUPPLICANT_CLI=y +BR2_PACKAGE_WPA_SUPPLICANT_PASSPHRASE=y # BR2_PACKAGE_WVDIAL is not set # BR2_PACKAGE_XINETD is not set # BR2_PACKAGE_XL2TP is not set diff --git a/buildroot/kernelconfig-recovery.armv6 b/buildroot/kernelconfig-recovery.armv6 index c4124727..7b5f5875 100644 --- a/buildroot/kernelconfig-recovery.armv6 +++ b/buildroot/kernelconfig-recovery.armv6 @@ -42,7 +42,9 @@ CONFIG_SYN_COOKIES=y # CONFIG_INET_XFRM_MODE_BEET is not set # CONFIG_INET_DIAG is not set # CONFIG_IPV6 is not set -# CONFIG_WIRELESS is not set +CONFIG_CFG80211=y +CONFIG_MAC80211=y +CONFIG_MAC80211_MESH=y CONFIG_UEVENT_HELPER_PATH="/sbin/mdev" CONFIG_DEVTMPFS=y CONFIG_DEVTMPFS_MOUNT=y @@ -61,7 +63,14 @@ CONFIG_USB_NET_SMSC95XX=y # CONFIG_USB_NET_NET1080 is not set # CONFIG_USB_NET_CDC_SUBSET is not set # CONFIG_USB_NET_ZAURUS is not set -# CONFIG_WLAN is not set +CONFIG_RT2X00=y +CONFIG_RT2500USB=y +CONFIG_RT73USB=y +CONFIG_RT2800USB=y +CONFIG_RT2800USB_RT3573=y +CONFIG_RT2800USB_RT53XX=y +CONFIG_RT2800USB_RT55XX=y +CONFIG_RT2800USB_UNKNOWN=y # CONFIG_INPUT_MOUSEDEV_PSAUX is not set CONFIG_INPUT_EVDEV=y # CONFIG_INPUT_KEYBOARD is not set diff --git a/buildroot/kernelconfig-recovery.armv7 b/buildroot/kernelconfig-recovery.armv7 index fc712950..1bd7a4e7 100644 --- a/buildroot/kernelconfig-recovery.armv7 +++ b/buildroot/kernelconfig-recovery.armv7 @@ -47,7 +47,10 @@ CONFIG_SYN_COOKIES=y # CONFIG_INET_XFRM_MODE_BEET is not set # CONFIG_INET_DIAG is not set # CONFIG_IPV6 is not set -# CONFIG_WIRELESS is not set +CONFIG_CFG80211=y +CONFIG_CFG80211_WEXT=y +CONFIG_MAC80211=y +CONFIG_MAC80211_MESH=y CONFIG_UEVENT_HELPER_PATH="/sbin/mdev" CONFIG_DEVTMPFS=y CONFIG_DEVTMPFS_MOUNT=y @@ -66,7 +69,14 @@ CONFIG_USB_NET_SMSC95XX=y # CONFIG_USB_NET_NET1080 is not set # CONFIG_USB_NET_CDC_SUBSET is not set # CONFIG_USB_NET_ZAURUS is not set -# CONFIG_WLAN is not set +CONFIG_RT2X00=y +CONFIG_RT2500USB=y +CONFIG_RT73USB=y +CONFIG_RT2800USB=y +CONFIG_RT2800USB_RT3573=y +CONFIG_RT2800USB_RT53XX=y +CONFIG_RT2800USB_RT55XX=y +CONFIG_RT2800USB_UNKNOWN=y # CONFIG_INPUT_MOUSEDEV_PSAUX is not set CONFIG_INPUT_EVDEV=y # CONFIG_INPUT_KEYBOARD is not set diff --git a/buildroot/package/wpa_supplicant/wpa_supplicant.conf b/buildroot/package/wpa_supplicant/wpa_supplicant.conf index 1994a6c7..c5189f81 100644 --- a/buildroot/package/wpa_supplicant/wpa_supplicant.conf +++ b/buildroot/package/wpa_supplicant/wpa_supplicant.conf @@ -1,6 +1,7 @@ ctrl_interface=/var/run/wpa_supplicant ap_scan=1 +update_config=1 -network={ - key_mgmt=NONE -} +# network={ +# key_mgmt=NONE +# } diff --git a/recovery/config.h b/recovery/config.h index 47519960..45c7dc24 100644 --- a/recovery/config.h +++ b/recovery/config.h @@ -2,7 +2,7 @@ #define CONFIG_H /* Version number displayed in the title bar */ -#define VERSION_NUMBER "1.4" +#define VERSION_NUMBER "1.4W" /* Color of the background */ // #define BACKGROUND_COLOR Qt::white diff --git a/recovery/mainwindow.cpp b/recovery/mainwindow.cpp index babbf287..be4c2f44 100644 --- a/recovery/mainwindow.cpp +++ b/recovery/mainwindow.cpp @@ -29,6 +29,8 @@ #include #include #include +#include +#include #include #include @@ -66,7 +68,8 @@ MainWindow::MainWindow(const QString &defaultDisplay, QSplashScreen *splash, QWi ui(new Ui::MainWindow), _qpd(NULL), _kcpos(0), _defaultDisplay(defaultDisplay), _silent(false), _allowSilent(false), _splash(splash), _settings(NULL), - _activatedEth(false), _numInstalledOS(0), _netaccess(NULL), _displayModeBox(NULL) + _activatedEth(false), _numInstalledOS(0), _netaccess(NULL), _displayModeBox(NULL), _carrierCount(0), + _wifiSSID(""), _wifiEnc(""), _wifiPass(""), _wifiDialog(NULL) { ui->setupUi(this); setWindowFlags(Qt::Window | Qt::CustomizeWindowHint | Qt::WindowTitleHint); @@ -141,7 +144,7 @@ void MainWindow::populate() _qpd = new QProgressDialog(tr("Please wait while NOOBS initialises"), QString(), 0, 0, this); _qpd->setWindowFlags(Qt::Window | Qt::CustomizeWindowHint | Qt::WindowTitleHint); _qpd->show(); - QTimer::singleShot(2000, this, SLOT(hideDialogIfNoNetwork())); + /* QTimer::singleShot(2000, this, SLOT(hideDialogIfNoNetwork())); */ } if (QFile::exists(SETTINGS_PARTITION)) @@ -857,7 +860,7 @@ bool MainWindow::requireNetwork() { QMessageBox::critical(this, tr("No network access"), - tr("Wired network access is required for this feature. Please insert a network cable into the network port."), + tr("Network access is required for this feature. Please insert a network cable into the network port or select a Wifi Network."), QMessageBox::Close); return false; } @@ -890,31 +893,183 @@ void MainWindow::on_list_doubleClicked(const QModelIndex &index) void MainWindow::startNetworking() { - if (!QFile::exists("/sys/class/net/eth0")) + + QNetworkConfiguration cfg; + QNetworkConfigurationManager ncm; + QList nc = ncm.allConfigurations(); + QString inf = "eth0"; + QStringList accpts, accptsenc, accptsint; + QRegExp essid("^.*\t.*\t.*\t(.*)\t(.*)$"); + QByteArray carrier = ""; + + /* Bring up all interfaces */ + + if (!_activatedEth) { + for (int i = 0; i< nc.size(); i++) + { + cfg = nc.at(i); + QProcess::execute("/sbin/ifconfig " + cfg.name() + " up"); + if (QDir("/sys/class/net/" + cfg.name() + "/wireless").exists()) + { + QProcess::execute("/usr/sbin/wpa_supplicant -D nl80211,wext -i " + cfg.name() + + " -c /etc/wpa_supplicant.conf -B"); + QProcess::execute("/usr/sbin/wpa_cli -i " + cfg.name() + " scan"); + } + } + _activatedEth = true; + } + + /* work out whether any of the interfaces are live */ + + for (int i = 0; i< nc.size(); i++) + { + cfg = nc.at(i); + inf = cfg.name(); + carrier = getFileContents("/sys/class/net/" + inf + "/carrier").trimmed(); + qDebug()<<"Interface:" << inf << "Carrier:"<< carrier; + + if (carrier == "1") + { + break; + } + } + + if ((carrier != "1") && (_carrierCount < 40)) { - /* eth0 not available yet, check back in a tenth of a second */ + /* cable not detected yet, check back in a tenth of a second */ + _carrierCount ++; QTimer::singleShot(100, this, SLOT(startNetworking())); return; } - QByteArray carrier = getFileContents("/sys/class/net/eth0/carrier").trimmed(); - if (carrier.isEmpty() && !_activatedEth) + /* if there is no carrier at this point let's try to see if we can scan for wifi networks */ + + if ((carrier != "1") && (_carrierCount < 41)) { - QProcess::execute("/sbin/ifconfig eth0 up"); - _activatedEth = true; + for(int i = 0; i < nc.size(); i++) + { + cfg = nc.at(i); + if (QDir("/sys/class/net/" + cfg.name() + "/wireless").exists()) + { + QProcess *proc = new QProcess(this); + proc->start("/usr/sbin/wpa_cli -i " + cfg.name() + " scan_results"); + proc->waitForFinished(); + + QTextStream stream(proc); + while (!stream.atEnd()) { + if (essid.indexIn(stream.readLine(), 0) != -1) { + QString flags, auth; + flags = essid.cap(1); + + /* ignoring EAP as this feels a bit to structured for NOOBS */ + auth = ""; + + if (flags.indexOf("[WPA2-EAP") >= 0) + auth = ""; + else if (flags.indexOf("[WPA-EAP") >= 0) + auth = ""; + else if (flags.indexOf("[WPA-PSK") >= 0) + auth = "WPA-PSK"; + else if (flags.indexOf("[WPA2-PSK") >= 0) + auth = "WPA2-PSK"; + else + auth = "NONE"; + if ((flags.indexOf("WEP") >= 0)&&(auth == "NONE")) + auth = "WEP"; + if (auth != "") + { + accpts << essid.cap(2); + accptsenc << auth; + accptsint << cfg.name(); + } + } + } + } + } + + /* OK so we have some access points to choose from let's display then and get the passphase */ + + if ((accpts.size() > 0)&&(_wifiDialog == NULL)) + { + int ret; + + inf = ""; + _wifiDialog = new WifiSelection(this); + _wifiDialog->setAccPts(accpts, accptsenc, accptsint); + + ret = _wifiDialog->exec(); + + /* wireless network selected */ + + if ((ret == QDialog::Accepted) && (_wifiDialog->getAP() != "")) + { + _wifiSSID = _wifiDialog->getAP(); + _wifiEnc = _wifiDialog->getEnc(); + _wifiPass = _wifiDialog->getPass(); + inf = _wifiDialog->getInt(); + } + + _wifiDialog->deleteLater(); + _wifiDialog = NULL; + + /* start the network using the wpa_cli command line interface */ + + if (inf != "") + { + QProcess::execute("/usr/sbin/wpa_cli -i " + inf + " add_network"); + QStringList ss; + ss << "-i" << inf << "set_network" << "0" << "ssid" << "\"" + _wifiSSID + "\""; + QProcess::execute("/usr/sbin/wpa_cli", ss); + qDebug() << ss; + QStringList pa; + if (_wifiEnc == "NONE") + { + pa << "-i" << inf << "set_network" << "0" << "key_mgmt" << "NONE"; + } + else if(_wifiEnc == "WEP") + { + QProcess::execute("/usr/sbin/wpa_cli -i " + inf + " key_mgmt NONE"); + pa << "-i" << inf << "set_network" << "0" << "wep_key0" << "\"" + _wifiPass + "\""; + } + else + { + QProcess::execute("/usr/sbin/wpa_cli -i " + inf + " key_mgmt WPA-PSK"); + pa << "-i" << inf << "set_network" << "0" << "psk" << "\"" + _wifiPass + "\""; + } + + QProcess::execute("/usr/sbin/wpa_cli", pa); + qDebug() << pa; + QProcess::execute("/usr/sbin/wpa_cli -i " + inf + " enable_network 0"); + + /* give the network time to come up */ + _carrierCount = 50; + } + + } + } + /* Catch all keep going until we have an SSID, encryption and passphrase or the wired network is plugged in */ + if (carrier != "1") { - /* cable not detected yet, check back in a tenth of a second */ + /* go round again - waiting for the carrier or disable if no network activated */ + if ((_carrierCount > 200) && (_wifiDialog == NULL)) + { + QTimer::singleShot(1000, this, SLOT(hideDialogIfNoNetwork())); + } + _carrierCount ++; QTimer::singleShot(100, this, SLOT(startNetworking())); return; } QProcess *proc = new QProcess(this); connect(proc, SIGNAL(finished(int)), this, SLOT(ifupFinished(int))); - /* Try enabling interface twice as sometimes it times out before getting a DHCP lease */ - proc->start("sh -c \"ifup eth0 || ifup eth0\""); + + /* Explicitly try and get a DCHP lease - note this used to be enacted twice using ifup that does not like wlan interfaces */ + + qDebug() <<"/sbin/udhcpc -i " + inf; + proc->start("/sbin/udhcpc -i " + inf); } void MainWindow::ifupFinished(int) @@ -1452,7 +1607,23 @@ void MainWindow::hideDialogIfNoNetwork() { if (_qpd) { - QByteArray carrier = getFileContents("/sys/class/net/eth0/carrier").trimmed(); + QNetworkConfiguration cfg; + QNetworkConfigurationManager ncm; + QList nc = ncm.allConfigurations(); + QByteArray carrier = ""; + + for (int i = 0; i< nc.size(); i++) + { + cfg = nc.at(i); + carrier = getFileContents("/sys/class/net/" + cfg.name() + "/carrier").trimmed(); + qDebug()<<"Dialog Interface:" << cfg.name() << "Carrier:"<< carrier; + + if (carrier == "1") + { + break; + } + } + if (carrier != "1") { /* No network cable inserted */ @@ -1465,7 +1636,7 @@ void MainWindow::hideDialogIfNoNetwork() /* No local images either */ QMessageBox::critical(this, tr("No network access"), - tr("Wired network access is required to use NOOBS without local images. Please insert a network cable into the network port."), + tr("Network access is required to use NOOBS without local images. Please insert a network cable into the network port or connect to a Wifi access point."), QMessageBox::Close); } } diff --git a/recovery/mainwindow.h b/recovery/mainwindow.h index da1e17d7..bb2b4522 100644 --- a/recovery/mainwindow.h +++ b/recovery/mainwindow.h @@ -11,6 +11,7 @@ */ #include "languagedialog.h" +#include "wifiselection.h" #include #include #include @@ -49,6 +50,11 @@ class MainWindow : public QMainWindow QNetworkAccessManager *_netaccess; int _neededMB, _availableMB, _numMetaFilesToDownload, _numIconsToDownload; QMessageBox *_displayModeBox; + int _carrierCount; + QString _wifiSSID; + QString _wifiEnc; + QString _wifiPass; + WifiSelection *_wifiDialog; QMap listImages(); virtual void changeEvent(QEvent * event); diff --git a/recovery/recovery.pro b/recovery/recovery.pro index cac1c724..56c81d26 100644 --- a/recovery/recovery.pro +++ b/recovery/recovery.pro @@ -27,7 +27,8 @@ SOURCES += main.cpp\ multiimagewritethread.cpp \ util.cpp \ twoiconsdelegate.cpp \ - bootselectiondialog.cpp + bootselectiondialog.cpp \ + wifiselection.cpp HEADERS += mainwindow.h \ languagedialog.h \ @@ -43,13 +44,15 @@ HEADERS += mainwindow.h \ multiimagewritethread.h \ util.h \ twoiconsdelegate.h \ - bootselectiondialog.h + bootselectiondialog.h \ + wifiselection.h FORMS += mainwindow.ui \ languagedialog.ui \ progressslideshowdialog.ui \ confeditdialog.ui \ - bootselectiondialog.ui + bootselectiondialog.ui \ + wifiselection.ui RESOURCES += \ icons.qrc diff --git a/recovery/updateqm.sh b/recovery/updateqm.sh index ed9d2081..cee484bf 100755 --- a/recovery/updateqm.sh +++ b/recovery/updateqm.sh @@ -1,4 +1,4 @@ #!/bin/sh -lupdate -no-obsolete recovery.pro -lrelease recovery.pro +lupdate -qt=4 -no-obsolete recovery.pro +lrelease -qt=4 recovery.pro diff --git a/recovery/wifiselection.cpp b/recovery/wifiselection.cpp new file mode 100644 index 00000000..da751b1b --- /dev/null +++ b/recovery/wifiselection.cpp @@ -0,0 +1,136 @@ +#include "wifiselection.h" +#include "ui_wifiselection.h" +#include +#include + +/* Dialog to allow the selection of a wifi network + * + * Takes a number of stringlists that contain the interface + * SSID list and encryption type + * + * Provides a number of helper methods to get the selected + * information back along with the pass code if required + */ + +WifiSelection::WifiSelection(QWidget *parent) : + QDialog(parent), + _apSSID(NULL), + _apEnc(NULL), + _apInt(NULL), + _apInd(-1), + ui(new Ui::WifiSelection) +{ + ui->setupUi(this); + ui->passPhraseLabel->hide(); + ui->passPhraseLineEdit->hide(); + connect(ui->wifiListWidget, SIGNAL(itemSelectionChanged()), this, SLOT(listSelectionChanged())); +} + +void WifiSelection::setAccPts(QStringList &ac, QStringList &enc, QStringList &inter) +{ + _apSSID = ac; + _apEnc = enc; + _apInt = inter; + ui->wifiListWidget->addItems(ac); + ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(false); +} + +void WifiSelection::listSelectionChanged() +{ + QList s; + QListWidgetItem *it; + int i; + + s = ui->wifiListWidget->selectedItems(); + + if (s.size() > 0) + { + it = s.at(0); + i = _apSSID.indexOf(it->text()); + + /* prompt for a passcode if required */ + + if ((i != -1) && (_apEnc.at(i) != "NONE")) { + ui->passPhraseLabel->show(); + ui->passPhraseLineEdit->show(); + ui->passPhraseLineEdit->setFocus(); + } + else + { + ui->passPhraseLabel->hide(); + ui->passPhraseLineEdit->hide(); + } + + ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(true); + } +} + +void WifiSelection::accept() +{ + QList s; + QListWidgetItem *it; + int i; + s = ui->wifiListWidget->selectedItems(); + if (s.size() > 0) + { + it = s.at(0); + i = _apSSID.indexOf(it->text()); + if (i != -1) + { + qDebug() << "OK pressed .. AP:" << _apSSID.at(i); + _apInd = i; + } + } + QDialog::accept(); +} + +/* Get selected access point */ + +QString WifiSelection::getAP() +{ + QString ret = ""; + if ((_apInd >= 0) && (_apInd < _apSSID.size())) + { + ret = _apSSID.at(_apInd); + } + return ret; +} + +/* Get AP encryption */ + +QString WifiSelection::getEnc() +{ + QString ret = ""; + if ((_apInd >= 0) && (_apInd < _apEnc.size())) + { + ret = _apEnc.at(_apInd); + } + return ret; +} + +/* Get AP pass phrase */ + +QString WifiSelection::getPass() +{ + QString ret; + ret = ui->passPhraseLineEdit->text(); + return ret; +} + +/* Get the interface associated with the wifi access point */ + +QString WifiSelection::getInt() +{ + QString ret = ""; + if ((_apInd >= 0) && (_apInd < _apInt.size())) + { + ret = _apInt.at(_apInd); + } + return ret; +} + + +WifiSelection::~WifiSelection() +{ + delete ui; +} diff --git a/recovery/wifiselection.h b/recovery/wifiselection.h new file mode 100644 index 00000000..cfba5715 --- /dev/null +++ b/recovery/wifiselection.h @@ -0,0 +1,40 @@ +#ifndef WIFISELECTION_H +#define WIFISELECTION_H + +#include +#include +#include + +namespace Ui { +class WifiSelection; +} + +class WifiSelection : public QDialog +{ + Q_OBJECT + +public: + explicit WifiSelection(QWidget *parent = 0); + void setAccPts(QStringList &ac, QStringList &enc, QStringList &inter); + QString getAP(); + QString getEnc(); + QString getPass(); + QString getInt(); + ~WifiSelection(); + +protected: + QStringList _apSSID; + QStringList _apEnc; + QStringList _apInt; + int _apInd; + void accept(); + + +public slots: + void listSelectionChanged(); + +private: + Ui::WifiSelection *ui; +}; + +#endif // WIFISELECTION_H diff --git a/recovery/wifiselection.ui b/recovery/wifiselection.ui new file mode 100644 index 00000000..f79bdbcb --- /dev/null +++ b/recovery/wifiselection.ui @@ -0,0 +1,113 @@ + + + WifiSelection + + + Qt::WindowModal + + + + 0 + 0 + 371 + 346 + + + + Wifi Network Selection + + + true + + + + + 20 + 300 + 331 + 32 + + + + Qt::Horizontal + + + QDialogButtonBox::Close|QDialogButtonBox::Ok + + + + + + 20 + 10 + 331 + 221 + + + + wifilist + + + List of Wifi Access Points + + + + + + 20 + 260 + 331 + 27 + + + + + + + 20 + 240 + 331 + 21 + + + + Pass Phrase + + + + + + + buttonBox + accepted() + WifiSelection + accept() + + + 248 + 254 + + + 157 + 274 + + + + + buttonBox + rejected() + WifiSelection + reject() + + + 316 + 260 + + + 286 + 274 + + + + +