summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--examples/opienet/onetworkdemo/onetworkdemo.cpp5
-rw-r--r--libopie2/opienet/onetutils.h26
-rw-r--r--libopie2/opienet/onetwork.cpp31
-rw-r--r--libopie2/opienet/onetwork.h7
-rw-r--r--libopie2/opienet/opienet.pro2
5 files changed, 60 insertions, 11 deletions
diff --git a/examples/opienet/onetworkdemo/onetworkdemo.cpp b/examples/opienet/onetworkdemo/onetworkdemo.cpp
index e0c93a2..b3a1115 100644
--- a/examples/opienet/onetworkdemo/onetworkdemo.cpp
+++ b/examples/opienet/onetworkdemo/onetworkdemo.cpp
@@ -50,2 +50,7 @@ int main( int argc, char** argv )
odebug << "DEMO: ONetwork contains Interface '" << it.current()->name() << "'" << oendl;
+ ONetworkInterfaceDriverInfo info = it.current()->driverInfo();
+ odebug << "DEMO: DriverName reported as '" << info.name() << "'" << oendl;
+ odebug << "DEMO: DriverVersion reported as '" << info.version() << "'" << oendl;
+ odebug << "DEMO: DriverFirmware reported as '" << info.firmware() << "'" << oendl;
+ odebug << "DEMO: DriverBus reported as '" << info.bus() << "'" << oendl;
odebug << "DEMO: Datalink code is '" << it.current()->dataLinkType() << "'" << oendl;
diff --git a/libopie2/opienet/onetutils.h b/libopie2/opienet/onetutils.h
index 32f5355..25c9238 100644
--- a/libopie2/opienet/onetutils.h
+++ b/libopie2/opienet/onetutils.h
@@ -102,2 +102,28 @@ class OHostAddress : public QHostAddress
/*======================================================================================
+ * ONetworkInterfaceDriverInfo
+ *======================================================================================*/
+
+class ONetworkInterfaceDriverInfo
+{
+ public:
+ ONetworkInterfaceDriverInfo( const QString& name = "<unknown>",
+ const QString& version = "<unknown>",
+ const QString& firmware = "<unknown>",
+ const QString& bus = "<unknown>" ) :
+ _name( name ), _version( version ), _firmware( firmware ), _bus( bus ) { };
+ ~ONetworkInterfaceDriverInfo() { };
+
+ QString name() const { return _name; };
+ QString version() const { return _version; };
+ QString firmware() const { return _firmware; };
+ QString bus() const { return _bus; };
+
+ private:
+ const QString _name;
+ const QString _version;
+ const QString _firmware;
+ const QString _bus;
+};
+
+/*======================================================================================
* OPrivateIOCTL
diff --git a/libopie2/opienet/onetwork.cpp b/libopie2/opienet/onetwork.cpp
index 05513f8..1deb051 100644
--- a/libopie2/opienet/onetwork.cpp
+++ b/libopie2/opienet/onetwork.cpp
@@ -31,3 +31,2 @@
/* OPIE */
-
#include <opie2/onetwork.h>
@@ -35,5 +34,5 @@
#include <opie2/odebug.h>
+using namespace Opie::Core;
/* QT */
-
#include <qfile.h>
@@ -42,4 +41,3 @@
-/* UNIX */
-
+/* STD */
#include <assert.h>
@@ -47,2 +45,3 @@
#include <errno.h>
+#include <stdarg.h>
#include <string.h>
@@ -50,2 +49,5 @@
#include <math.h>
+#include <unistd.h>
+#include <net/if_arp.h>
+#include <net/ethernet.h>
#include <sys/ioctl.h>
@@ -53,7 +55,9 @@
#include <sys/types.h>
-#include <unistd.h>
+#include <linux/types.h>
#include <linux/sockios.h>
-#include <net/if_arp.h>
-#include <net/ethernet.h>
-#include <stdarg.h>
+#define u64 __u64
+#define u32 __u32
+#define u16 __u16
+#define u8 __u8
+#include <linux/ethtool.h>
@@ -61,4 +65,2 @@
#include <opie2/odebugmapper.h>
-
-using namespace Opie::Core;
using namespace Opie::Net::Internal;
@@ -383,2 +385,10 @@ bool ONetworkInterface::isWireless() const
+ONetworkInterfaceDriverInfo ONetworkInterface::driverInfo() const
+{
+ struct ethtool_drvinfo info;
+ info.cmd = ETHTOOL_GDRVINFO;
+ _ifr.ifr_data = (caddr_t) &info;
+ return ioctl( SIOCETHTOOL ) ? ONetworkInterfaceDriverInfo( info.driver, info.version, info.fw_version, info.bus_info) : ONetworkInterfaceDriverInfo();
+}
+
/*======================================================================================
@@ -407,2 +417,3 @@ OChannelHopper::OChannelHopper( OWirelessNetworkInterface* iface )
if ( _maxChannel >= 12 ) _channels.append( 12 );
+ //FIXME: Add 802.11a/g channels
_channel = _channels.begin();
diff --git a/libopie2/opienet/onetwork.h b/libopie2/opienet/onetwork.h
index fa9f39f..f0c4450 100644
--- a/libopie2/opienet/onetwork.h
+++ b/libopie2/opienet/onetwork.h
@@ -204,2 +204,3 @@ class ONetworkInterface : public QObject
* @note It can be necessary to shut down the interface prior to calling this method.
+ * @note This operation needs root privileges
* @warning This is not supported by all drivers.
@@ -224,2 +225,8 @@ class ONetworkInterface : public QObject
int dataLinkType() const;
+ /**
+ * @returns a ONetworkInterfaceDriverInfo driver information block
+ * @note This operation needs root privileges
+ * @warning This is not supported by all drivers
+ */
+ ONetworkInterfaceDriverInfo driverInfo() const;
diff --git a/libopie2/opienet/opienet.pro b/libopie2/opienet/opienet.pro
index 460de0a..854e5ff 100644
--- a/libopie2/opienet/opienet.pro
+++ b/libopie2/opienet/opienet.pro
@@ -20,3 +20,3 @@ INTERFACES =
TARGET = opienet2
-VERSION = 1.8.6
+VERSION = 1.8.7
INCLUDEPATH += $(OPIEDIR)/include