author | mickeyl <mickeyl> | 2004-02-23 18:37:03 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2004-02-23 18:37:03 (UTC) |
commit | 19b274033fc05d5190cee2fa974c683892173c84 (patch) (unidiff) | |
tree | 2ad0727ba2414c215cb4b55b93f3b610304c1742 /libopie2/opienet/onetwork.cpp | |
parent | ab0203a43a30598774d8d8a1cf32075817d0dceb (diff) | |
download | opie-19b274033fc05d5190cee2fa974c683892173c84.zip opie-19b274033fc05d5190cee2fa974c683892173c84.tar.gz opie-19b274033fc05d5190cee2fa974c683892173c84.tar.bz2 |
The Linux Wireless Extensions V16 introduce some massive changes in the
binary structures. Since we still use V15 on most target platforms I have
to introduce two headers. Define OPIE_WE_VERSION to specify which header to include
-rw-r--r-- | libopie2/opienet/onetwork.cpp | 35 |
1 files changed, 28 insertions, 7 deletions
diff --git a/libopie2/opienet/onetwork.cpp b/libopie2/opienet/onetwork.cpp index 16fa8ae..36f409b 100644 --- a/libopie2/opienet/onetwork.cpp +++ b/libopie2/opienet/onetwork.cpp | |||
@@ -1,10 +1,10 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of the Opie Project | 2 | This file is part of the Opie Project |
3 | Copyright (C) 2003 by Michael 'Mickey' Lauer <mickey@Vanille.de> | 3 | Copyright (C) 2003-2004 by Michael 'Mickey' Lauer |
4 | =. | 4 | =. <mickey@Vanille.de> |
5 | .=l. | 5 | .=l. |
6 | .>+-= | 6 | .>+-= |
7 | _;:, .> :=|. This program is free software; you can | 7 | _;:, .> :=|. This program is free software; you can |
8 | .> <`_, > . <= redistribute it and/or modify it under | 8 | .> <`_, > . <= redistribute it and/or modify it under |
9 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public | 9 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public |
10 | .="- .-=="i, .._ License as published by the Free Software | 10 | .="- .-=="i, .._ License as published by the Free Software |
@@ -579,14 +579,21 @@ void OWirelessNetworkInterface::buildPrivateList() | |||
579 | 579 | ||
580 | 580 | ||
581 | void OWirelessNetworkInterface::dumpInformation() const | 581 | void OWirelessNetworkInterface::dumpInformation() const |
582 | { | 582 | { |
583 | odebug << "OWirelessNetworkInterface::() -------------- dumping information block ----------------" << oendl; | 583 | odebug << "OWirelessNetworkInterface::() -------------- dumping information block ----------------" << oendl; |
584 | 584 | ||
585 | qDebug( " - driver's idea of maximum throughput is %d bps = %d byte/s = %d Kb/s = %f.2 Mb/s", _range.throughput, _range.throughput / 8, _range.throughput / 8 / 1024, float( _range.throughput ) / 8.0 / 1024.0 / 1024.0 ); | 585 | qDebug( " - driver's idea of maximum throughput is %d bps = %d byte/s = %d Kb/s = %f.2 Mb/s", |
586 | qDebug( " - driver for '%s' has been compiled against WE V%d (source=V%d)", name(), _range.we_version_compiled, _range.we_version_source ); | 586 | _range.throughput, _range.throughput / 8, _range.throughput / 8 / 1024, float( _range.throughput ) / 8.0 / 1024.0 / 1024.0 ); |
587 | qDebug( " - driver for '%s' (V%d) has been compiled against WE V%d", | ||
588 | name(), _range.we_version_source, _range.we_version_compiled ); | ||
589 | |||
590 | if ( _range.we_version_compiled != WIRELESS_EXT ) | ||
591 | { | ||
592 | owarn << "Version mismatch! WE_DRIVER = " << _range.we_version_compiled << " and WE_OPIENET = " << WIRELESS_EXT << oendl; | ||
593 | } | ||
587 | 594 | ||
588 | odebug << "OWirelessNetworkInterface::() ---------------------------------------------------------" << oendl; | 595 | odebug << "OWirelessNetworkInterface::() ---------------------------------------------------------" << oendl; |
589 | } | 596 | } |
590 | 597 | ||
591 | 598 | ||
592 | int OWirelessNetworkInterface::channel() const | 599 | int OWirelessNetworkInterface::channel() const |
@@ -963,15 +970,29 @@ OStationList* OWirelessNetworkInterface::scanNetwork() | |||
963 | } | 970 | } |
964 | } | 971 | } |
965 | 972 | ||
966 | 973 | ||
967 | int OWirelessNetworkInterface::signalStrength() const | 974 | int OWirelessNetworkInterface::signalStrength() const |
968 | { | 975 | { |
969 | int max = _range.max_qual.level; | 976 | iw_statistics stat; |
970 | odebug << "signalStrength(): max quality seems to be " << max << "dBM" << oendl; | 977 | ::memset( &stat, 0, sizeof stat ); |
971 | return 50; | 978 | _iwr.u.data.pointer = (char*) &stat; |
979 | _iwr.u.data.flags = 0; | ||
980 | _iwr.u.data.length = sizeof stat; | ||
981 | |||
982 | if ( !wioctl( SIOCGIWSTATS ) ) | ||
983 | { | ||
984 | return -1; | ||
985 | } | ||
986 | |||
987 | int max = _range.max_qual.qual; | ||
988 | int cur = stat.qual.qual; | ||
989 | int lev = stat.qual.level; //FIXME: Do something with them? | ||
990 | int noi = stat.qual.noise; //FIXME: Do something with them? | ||
991 | |||
992 | return cur*100/max; | ||
972 | } | 993 | } |
973 | 994 | ||
974 | 995 | ||
975 | bool OWirelessNetworkInterface::wioctl( int call, struct iwreq& iwreq ) const | 996 | bool OWirelessNetworkInterface::wioctl( int call, struct iwreq& iwreq ) const |
976 | { | 997 | { |
977 | #ifndef NODEBUG | 998 | #ifndef NODEBUG |