summaryrefslogtreecommitdiff
path: root/libopie2/opienet
authormickeyl <mickeyl>2005-05-06 09:27:12 (UTC)
committer mickeyl <mickeyl>2005-05-06 09:27:12 (UTC)
commit543d9d7c58c9601dba6f47b3a4011313d1d75499 (patch) (side-by-side diff)
tree6b9d259a91b220264c961d542e25b69fe070320f /libopie2/opienet
parentc199fa0b0ef971c3a121af6c31a9a9822561a1be (diff)
downloadopie-543d9d7c58c9601dba6f47b3a4011313d1d75499.zip
opie-543d9d7c58c9601dba6f47b3a4011313d1d75499.tar.gz
opie-543d9d7c58c9601dba6f47b3a4011313d1d75499.tar.bz2
- OManufacturerDB: check if there is a QApplication before calling Global::statusMessage or qApp->processEvents()
- ONetwork: skip hostap control interfaces 'wifi*' - OWirelessNetworkInterface: set \0 in SSID() and nickName() to work around (buggy) drivers not returning a zero-terminated string
Diffstat (limited to 'libopie2/opienet') (more/less context) (show whitespace changes)
-rw-r--r--libopie2/opienet/omanufacturerdb.cpp17
-rw-r--r--libopie2/opienet/onetwork.cpp9
-rw-r--r--libopie2/opienet/opienet.pro2
3 files changed, 13 insertions, 15 deletions
diff --git a/libopie2/opienet/omanufacturerdb.cpp b/libopie2/opienet/omanufacturerdb.cpp
index 123aee8..3af3d4c 100644
--- a/libopie2/opienet/omanufacturerdb.cpp
+++ b/libopie2/opienet/omanufacturerdb.cpp
@@ -25,14 +25,12 @@
Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#include "omanufacturerdb.h"
-#define OPIE_IMPROVE_GUI_LATENCY 1
-
/* OPIE */
#include <opie2/odebug.h>
#include <qpe/qpeapplication.h>
#ifdef OPIE_IMPROVE_GUI_LATENCY
#include <qpe/global.h>
#endif
@@ -60,15 +58,13 @@ OManufacturerDB* OManufacturerDB::instance()
return _instance;
}
OManufacturerDB::OManufacturerDB()
{
- #ifdef OPIE_IMPROVE_GUI_LATENCY
- Global::statusMessage( "Reading Manufacturers..." );
- #endif
+ if ( qApp ) Global::statusMessage( "Reading Manufacturers..." );
QString filename( "/etc/manufacturers" );
odebug << "OManufacturerDB: trying to read " << filename << oendl;
if ( !QFile::exists( filename ) )
{
filename = QPEApplication::qpeDir()+"etc/manufacturers";
odebug << "OManufacturerDB: trying to read " << filename << oendl;
@@ -89,37 +85,32 @@ OManufacturerDB::OManufacturerDB()
{
odebug << "OManufacturerDB: found manufacturer list in " << filename << oendl;
QTextStream s( &file );
QString addr;
QString manu;
QString extManu;
- #ifdef OPIE_IMPROVE_GUI_LATENCY
int counter = 0;
- #endif
+
while (!s.atEnd())
{
s >> addr;
s >> manu;
s >> extManu;
manufacturers.insert( addr, manu );
manufacturersExt.insert( addr, extManu );
// odebug << "OmanufacturerDB: parse '" << addr << "' as '" << manu << "' (" << extManu << ")" << oendl;
- #ifdef OPIE_IMPROVE_GUI_LATENCY
counter++;
if ( counter == 50 )
{
- qApp->processEvents();
+ if ( qApp ) qApp->processEvents();
counter = 0;
}
- #endif
}
odebug << "OManufacturerDB: manufacturer list completed." << oendl;
- #ifdef OPIE_IMPROVE_GUI_LATENCY
- Global::statusMessage( "Manufacturers Complete..." );
- #endif
+ if ( qApp ) Global::statusMessage( "Manufacturers Complete..." );
}
}
OManufacturerDB::~OManufacturerDB()
{
diff --git a/libopie2/opienet/onetwork.cpp b/libopie2/opienet/onetwork.cpp
index 0a74019..f4bdbe0 100644
--- a/libopie2/opienet/onetwork.cpp
+++ b/libopie2/opienet/onetwork.cpp
@@ -101,12 +101,18 @@ void ONetwork::synchronize()
s.readLine();
while ( !s.atEnd() )
{
s >> str;
str.truncate( str.find( ':' ) );
odebug << "ONetwork: found interface '" << str << "'" << oendl;
+ if ( str.startsWith( "wifi" ) )
+ {
+ odebug << "ONetwork: ignoring hostap control interface" << oendl;
+ s.readLine();
+ continue;
+ }
ONetworkInterface* iface = 0;
if ( isWirelessInterface( str ) )
{
iface = new OWirelessNetworkInterface( this, (const char*) str );
odebug << "ONetwork: interface '" << str << "' has Wireless Extensions" << oendl;
}
@@ -805,13 +811,13 @@ QString OWirelessNetworkInterface::nickName() const
if ( !wioctl( SIOCGIWNICKN ) )
{
return "<unknown>";
}
else
{
- str[_iwr.u.data.length] = 0x0; // some drivers (e.g. wlan-ng) don't zero-terminate the string
+ str[_iwr.u.data.length] = '\0'; // some drivers don't zero-terminate the string
return str;
}
}
void OWirelessNetworkInterface::setPrivate( const QString& call, int numargs, ... )
@@ -863,12 +869,13 @@ QString OWirelessNetworkInterface::SSID() const
if ( !wioctl( SIOCGIWESSID ) )
{
return "<unknown>";
}
else
{
+ str[_iwr.u.essid.length] = '\0'; // some drivers don't zero-terminate the string
return str;
}
}
void OWirelessNetworkInterface::setSSID( const QString& ssid )
diff --git a/libopie2/opienet/opienet.pro b/libopie2/opienet/opienet.pro
index a10a949..460de0a 100644
--- a/libopie2/opienet/opienet.pro
+++ b/libopie2/opienet/opienet.pro
@@ -15,13 +15,13 @@ SOURCES = odebugmapper.cpp \
onetutils.cpp \
onetwork.cpp \
opcap.cpp \
ostation.cpp
INTERFACES =
TARGET = opienet2
-VERSION = 1.8.5
+VERSION = 1.8.6
INCLUDEPATH += $(OPIEDIR)/include
DEPENDPATH += $(OPIEDIR)/include
LIBS += -lpcap
!contains( platform, x11 ) {