-rw-r--r-- | libopie2/opiecore/linux/opcmciasystem.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/libopie2/opiecore/linux/opcmciasystem.cpp b/libopie2/opiecore/linux/opcmciasystem.cpp index a924696..34e4477 100644 --- a/libopie2/opiecore/linux/opcmciasystem.cpp +++ b/libopie2/opiecore/linux/opcmciasystem.cpp @@ -49,70 +49,71 @@ using namespace Opie::Core; * OPcmciaSystem *======================================================================================*/ OPcmciaSystem* OPcmciaSystem::_instance = 0; OPcmciaSystem::OPcmciaSystem() { qDebug( "OPcmciaSystem::OPcmciaSystem()" ); synchronize(); } void OPcmciaSystem::synchronize() { qDebug( "OPcmciaSystem::synchronize()" ); _interfaces.clear(); //FIXME: Use cardmgr subsystem ioctls QString fileName; if ( QFile::exists( "/var/run/stab" ) ) { fileName = "/var/run/stab"; } else if ( QFile::exists( "/var/state/pcmcia/stab" ) ) { fileName = "/var/state/pcmcia/stab"; } else { fileName = "/var/lib/pcmcia/stab"; } QFile cardinfofile( fileName ); if ( !cardinfofile.exists() || !cardinfofile.open( IO_ReadOnly ) ) { qWarning( "pcmcia info file not found or unaccessible" ); return; } QTextStream cardinfo( &cardinfofile ); while ( !cardinfo.atEnd() ) { QString line = cardinfo.readLine(); - if ( line.startsWith( "Socket" ) ) + // qDebug( "line = '%s'", (const char*) line ); + if ( line.startsWith( "Socket" ) && ! line.contains( "empty" ) ) { int mid = line.find( ':' ); QString name = line.right( line.length() - mid - 1 ); QString id = line.right( line.length() - mid + 1 ); - if ( mid ) _interfaces.insert( name, new OPcmciaCard( this, (const char*) id ) ); + if ( mid ) _interfaces.insert( name.stripWhiteSpace(), new OPcmciaCard( this, (const char*) id.stripWhiteSpace() ) ); } else { continue; } } } int OPcmciaSystem::count() const { return _interfaces.count(); } OPcmciaCard* OPcmciaSystem::card( const QString& iface ) const { return _interfaces[iface]; } OPcmciaSystem* OPcmciaSystem::instance() { if ( !_instance ) _instance = new OPcmciaSystem(); return _instance; } OPcmciaSystem::CardIterator OPcmciaSystem::iterator() const { return OPcmciaSystem::CardIterator( _interfaces ); } |