[PC-BSD Commits] r19696 - pcbsd/current/src-qt4/libpcbsd

svn at pcbsd.org svn at pcbsd.org
Wed Oct 17 06:30:42 PDT 2012


Author: kris
Date: 2012-10-17 13:30:42 +0000 (Wed, 17 Oct 2012)
New Revision: 19696

Modified:
   pcbsd/current/src-qt4/libpcbsd/netif.cpp
   pcbsd/current/src-qt4/libpcbsd/pcbsd-netif.h
Log:

Add function to netif.cpp



Modified: pcbsd/current/src-qt4/libpcbsd/netif.cpp
===================================================================
--- pcbsd/current/src-qt4/libpcbsd/netif.cpp	2012-10-17 12:31:55 UTC (rev 19695)
+++ pcbsd/current/src-qt4/libpcbsd/netif.cpp	2012-10-17 13:30:42 UTC (rev 19696)
@@ -392,6 +392,35 @@
   return securityType;
 }
 
+QString NetworkInterface::getFirstWiredDevice()
+{
+  QString tmp;
+
+  QStringList ifs = getInterfaces();
+  for ( QStringList::Iterator it = ifs.begin(); it != ifs.end(); ++it )
+  {
+     QString tmpDev = *it;
+     if (tmpDev.indexOf("lo0") == -1
+         && tmpDev.indexOf("lo1") == -1
+         && tmpDev.indexOf("lo2") == -1
+         && tmpDev.indexOf("lo3") == -1
+         && tmpDev.indexOf("fwe") == -1
+         && tmpDev.indexOf("plip") == -1
+         && tmpDev.indexOf("pfsync") == -1
+         && tmpDev.indexOf("pflog") == -1
+         && tmpDev.indexOf("wlan") == -1
+         && tmpDev.indexOf("tun") == -1)
+     {
+        NetworkInterface ifr(tmpDev);
+        if (! ifr.isWireless()) {
+          return tmpDev;
+        }
+     }
+  }
+
+  return tmp;
+}
+
 void NetworkInterface::wifiQuickConnect(QString SSID, QString netKey, QString DeviceName){
   /* 
      This function uses a set of defaults to connect to a wifi access point with a minimum

Modified: pcbsd/current/src-qt4/libpcbsd/pcbsd-netif.h
===================================================================
--- pcbsd/current/src-qt4/libpcbsd/pcbsd-netif.h	2012-10-17 12:31:55 UTC (rev 19695)
+++ pcbsd/current/src-qt4/libpcbsd/pcbsd-netif.h	2012-10-17 13:30:42 UTC (rev 19696)
@@ -55,6 +55,7 @@
    static QString getWifiSecurity(QString SSID,QString deviceName);
    static QString parseWifiSecurity( QString caps, QString etc );
    static void wifiQuickConnect(QString SSID, QString netKey, QString DeviceName);
+   static QString getFirstWiredDevice();
 
 private:
    QString name;



More information about the Commits mailing list