author | mickeyl <mickeyl> | 2005-05-16 17:48:03 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2005-05-16 17:48:03 (UTC) |
commit | d2426de3452342ab4af8e95214b9ff408f30744e (patch) (unidiff) | |
tree | 41eb23ab226a83778112aaf6d14ab3e8fc5dc896 /libopie2/opienet/onetwork.cpp | |
parent | a0276f0957bd503491e8d435b7ad1a6479ce24eb (diff) | |
download | opie-d2426de3452342ab4af8e95214b9ff408f30744e.zip opie-d2426de3452342ab4af8e95214b9ff408f30744e.tar.gz opie-d2426de3452342ab4af8e95214b9ff408f30744e.tar.bz2 |
- add ONetworkInterfaceDriverInfo block extracting info using ethtool ioctls
- adjust example
Diffstat (limited to 'libopie2/opienet/onetwork.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | libopie2/opienet/onetwork.cpp | 31 |
1 files changed, 21 insertions, 10 deletions
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 | |||
@@ -29,38 +29,40 @@ | |||
29 | */ | 29 | */ |
30 | 30 | ||
31 | /* OPIE */ | 31 | /* OPIE */ |
32 | |||
33 | #include <opie2/onetwork.h> | 32 | #include <opie2/onetwork.h> |
34 | #include <opie2/ostation.h> | 33 | #include <opie2/ostation.h> |
35 | #include <opie2/odebug.h> | 34 | #include <opie2/odebug.h> |
35 | using namespace Opie::Core; | ||
36 | 36 | ||
37 | /* QT */ | 37 | /* QT */ |
38 | |||
39 | #include <qfile.h> | 38 | #include <qfile.h> |
40 | #include <qtextstream.h> | 39 | #include <qtextstream.h> |
41 | #include <qapplication.h> | 40 | #include <qapplication.h> |
42 | 41 | ||
43 | /* UNIX */ | 42 | /* STD */ |
44 | |||
45 | #include <assert.h> | 43 | #include <assert.h> |
46 | #include <arpa/inet.h> | 44 | #include <arpa/inet.h> |
47 | #include <errno.h> | 45 | #include <errno.h> |
46 | #include <stdarg.h> | ||
48 | #include <string.h> | 47 | #include <string.h> |
49 | #include <stdlib.h> | 48 | #include <stdlib.h> |
50 | #include <math.h> | 49 | #include <math.h> |
50 | #include <unistd.h> | ||
51 | #include <net/if_arp.h> | ||
52 | #include <net/ethernet.h> | ||
51 | #include <sys/ioctl.h> | 53 | #include <sys/ioctl.h> |
52 | #include <sys/socket.h> | 54 | #include <sys/socket.h> |
53 | #include <sys/types.h> | 55 | #include <sys/types.h> |
54 | #include <unistd.h> | 56 | #include <linux/types.h> |
55 | #include <linux/sockios.h> | 57 | #include <linux/sockios.h> |
56 | #include <net/if_arp.h> | 58 | #define u64 __u64 |
57 | #include <net/ethernet.h> | 59 | #define u32 __u32 |
58 | #include <stdarg.h> | 60 | #define u16 __u16 |
61 | #define u8 __u8 | ||
62 | #include <linux/ethtool.h> | ||
59 | 63 | ||
60 | #ifndef NODEBUG | 64 | #ifndef NODEBUG |
61 | #include <opie2/odebugmapper.h> | 65 | #include <opie2/odebugmapper.h> |
62 | |||
63 | using namespace Opie::Core; | ||
64 | using namespace Opie::Net::Internal; | 66 | using namespace Opie::Net::Internal; |
65 | DebugMapper* debugmapper = new DebugMapper(); | 67 | DebugMapper* debugmapper = new DebugMapper(); |
66 | #endif | 68 | #endif |
@@ -381,6 +383,14 @@ bool ONetworkInterface::isWireless() const | |||
381 | } | 383 | } |
382 | 384 | ||
383 | 385 | ||
386 | ONetworkInterfaceDriverInfo ONetworkInterface::driverInfo() const | ||
387 | { | ||
388 | struct ethtool_drvinfo info; | ||
389 | info.cmd = ETHTOOL_GDRVINFO; | ||
390 | _ifr.ifr_data = (caddr_t) &info; | ||
391 | return ioctl( SIOCETHTOOL ) ? ONetworkInterfaceDriverInfo( info.driver, info.version, info.fw_version, info.bus_info) : ONetworkInterfaceDriverInfo(); | ||
392 | } | ||
393 | |||
384 | /*====================================================================================== | 394 | /*====================================================================================== |
385 | * OChannelHopper | 395 | * OChannelHopper |
386 | *======================================================================================*/ | 396 | *======================================================================================*/ |
@@ -405,6 +415,7 @@ OChannelHopper::OChannelHopper( OWirelessNetworkInterface* iface ) | |||
405 | if ( _maxChannel >= 11 ) _channels.append( 11 ); | 415 | if ( _maxChannel >= 11 ) _channels.append( 11 ); |
406 | if ( _maxChannel >= 6 ) _channels.append( 6 ); | 416 | if ( _maxChannel >= 6 ) _channels.append( 6 ); |
407 | if ( _maxChannel >= 12 ) _channels.append( 12 ); | 417 | if ( _maxChannel >= 12 ) _channels.append( 12 ); |
418 | //FIXME: Add 802.11a/g channels | ||
408 | _channel = _channels.begin(); | 419 | _channel = _channels.begin(); |
409 | } | 420 | } |
410 | 421 | ||