-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 | |||
@@ -57,54 +57,55 @@ OPcmciaSystem::OPcmciaSystem() | |||
57 | synchronize(); | 57 | synchronize(); |
58 | } | 58 | } |
59 | 59 | ||
60 | void OPcmciaSystem::synchronize() | 60 | void OPcmciaSystem::synchronize() |
61 | { | 61 | { |
62 | qDebug( "OPcmciaSystem::synchronize()" ); | 62 | qDebug( "OPcmciaSystem::synchronize()" ); |
63 | _interfaces.clear(); | 63 | _interfaces.clear(); |
64 | 64 | ||
65 | //FIXME: Use cardmgr subsystem ioctls | 65 | //FIXME: Use cardmgr subsystem ioctls |
66 | 66 | ||
67 | QString fileName; | 67 | QString fileName; |
68 | if ( QFile::exists( "/var/run/stab" ) ) { fileName = "/var/run/stab"; } | 68 | if ( QFile::exists( "/var/run/stab" ) ) { fileName = "/var/run/stab"; } |
69 | else if ( QFile::exists( "/var/state/pcmcia/stab" ) ) { fileName = "/var/state/pcmcia/stab"; } | 69 | else if ( QFile::exists( "/var/state/pcmcia/stab" ) ) { fileName = "/var/state/pcmcia/stab"; } |
70 | else { fileName = "/var/lib/pcmcia/stab"; } | 70 | else { fileName = "/var/lib/pcmcia/stab"; } |
71 | QFile cardinfofile( fileName ); | 71 | QFile cardinfofile( fileName ); |
72 | if ( !cardinfofile.exists() || !cardinfofile.open( IO_ReadOnly ) ) | 72 | if ( !cardinfofile.exists() || !cardinfofile.open( IO_ReadOnly ) ) |
73 | { | 73 | { |
74 | qWarning( "pcmcia info file not found or unaccessible" ); | 74 | qWarning( "pcmcia info file not found or unaccessible" ); |
75 | return; | 75 | return; |
76 | } | 76 | } |
77 | QTextStream cardinfo( &cardinfofile ); | 77 | QTextStream cardinfo( &cardinfofile ); |
78 | while ( !cardinfo.atEnd() ) | 78 | while ( !cardinfo.atEnd() ) |
79 | { | 79 | { |
80 | QString line = cardinfo.readLine(); | 80 | QString line = cardinfo.readLine(); |
81 | if ( line.startsWith( "Socket" ) ) | 81 | // qDebug( "line = '%s'", (const char*) line ); |
82 | if ( line.startsWith( "Socket" ) && ! line.contains( "empty" ) ) | ||
82 | { | 83 | { |
83 | int mid = line.find( ':' ); | 84 | int mid = line.find( ':' ); |
84 | QString name = line.right( line.length() - mid - 1 ); | 85 | QString name = line.right( line.length() - mid - 1 ); |
85 | QString id = line.right( line.length() - mid + 1 ); | 86 | QString id = line.right( line.length() - mid + 1 ); |
86 | if ( mid ) _interfaces.insert( name, new OPcmciaCard( this, (const char*) id ) ); | 87 | if ( mid ) _interfaces.insert( name.stripWhiteSpace(), new OPcmciaCard( this, (const char*) id.stripWhiteSpace() ) ); |
87 | } | 88 | } |
88 | else | 89 | else |
89 | { | 90 | { |
90 | continue; | 91 | continue; |
91 | } | 92 | } |
92 | } | 93 | } |
93 | } | 94 | } |
94 | 95 | ||
95 | 96 | ||
96 | int OPcmciaSystem::count() const | 97 | int OPcmciaSystem::count() const |
97 | { | 98 | { |
98 | return _interfaces.count(); | 99 | return _interfaces.count(); |
99 | } | 100 | } |
100 | 101 | ||
101 | 102 | ||
102 | OPcmciaCard* OPcmciaSystem::card( const QString& iface ) const | 103 | OPcmciaCard* OPcmciaSystem::card( const QString& iface ) const |
103 | { | 104 | { |
104 | return _interfaces[iface]; | 105 | return _interfaces[iface]; |
105 | } | 106 | } |
106 | 107 | ||
107 | 108 | ||
108 | OPcmciaSystem* OPcmciaSystem::instance() | 109 | OPcmciaSystem* OPcmciaSystem::instance() |
109 | { | 110 | { |
110 | if ( !_instance ) _instance = new OPcmciaSystem(); | 111 | if ( !_instance ) _instance = new OPcmciaSystem(); |