summaryrefslogtreecommitdiff
authormickeyl <mickeyl>2005-05-25 19:03:26 (UTC)
committer mickeyl <mickeyl>2005-05-25 19:03:26 (UTC)
commit8d2d91b9b6e590e474fe3acd92f71e40779a493b (patch) (unidiff)
tree877bf0b4c6a23892ed0d2d2a0a3e3aa7b82ee2a1
parent5fdc5b4cba7743947a23840ba09fadcc7414309b (diff)
downloadopie-8d2d91b9b6e590e474fe3acd92f71e40779a493b.zip
opie-8d2d91b9b6e590e474fe3acd92f71e40779a493b.tar.gz
opie-8d2d91b9b6e590e474fe3acd92f71e40779a493b.tar.bz2
be nice to gcc 3.3
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opiecore/linux/opcmciasystem.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/libopie2/opiecore/linux/opcmciasystem.cpp b/libopie2/opiecore/linux/opcmciasystem.cpp
index 7bd7178..0f7ff46 100644
--- a/libopie2/opiecore/linux/opcmciasystem.cpp
+++ b/libopie2/opiecore/linux/opcmciasystem.cpp
@@ -129,129 +129,129 @@ void OPcmciaSystem::synchronize()
129int OPcmciaSystem::count() const 129int OPcmciaSystem::count() const
130{ 130{
131 return _interfaces.count(); 131 return _interfaces.count();
132} 132}
133 133
134 134
135int OPcmciaSystem::cardCount() const 135int OPcmciaSystem::cardCount() const
136{ 136{
137 int nonEmpty = 0; 137 int nonEmpty = 0;
138 OPcmciaSystem::CardIterator it = iterator(); 138 OPcmciaSystem::CardIterator it = iterator();
139 while ( it.current() ) 139 while ( it.current() )
140 { 140 {
141 if ( !it.current()->isEmpty() ) nonEmpty++; 141 if ( !it.current()->isEmpty() ) nonEmpty++;
142 ++it; 142 ++it;
143 } 143 }
144 return nonEmpty; 144 return nonEmpty;
145} 145}
146 146
147 147
148OPcmciaSocket* OPcmciaSystem::socket( unsigned int number ) 148OPcmciaSocket* OPcmciaSystem::socket( unsigned int number )
149{ 149{
150 return _interfaces.at( number ); 150 return _interfaces.at( number );
151} 151}
152 152
153 153
154OPcmciaSystem* OPcmciaSystem::instance() 154OPcmciaSystem* OPcmciaSystem::instance()
155{ 155{
156 if ( !_instance ) _instance = new OPcmciaSystem(); 156 if ( !_instance ) _instance = new OPcmciaSystem();
157 return _instance; 157 return _instance;
158} 158}
159 159
160 160
161OPcmciaSystem::CardIterator OPcmciaSystem::iterator() const 161OPcmciaSystem::CardIterator OPcmciaSystem::iterator() const
162{ 162{
163 return OPcmciaSystem::CardIterator( _interfaces ); 163 return OPcmciaSystem::CardIterator( _interfaces );
164} 164}
165 165
166 166
167/*====================================================================================== 167/*======================================================================================
168 * OPcmciaSocket 168 * OPcmciaSocket
169 *======================================================================================*/ 169 *======================================================================================*/
170 170
171OPcmciaSocket::OPcmciaSocket( int major, int socket, QObject* parent, const char* name ) 171OPcmciaSocket::OPcmciaSocket( int major, int socket, QObject* parent, const char* name )
172 :QObject( parent, name ), _major( major ), _socket( socket ) 172 :QObject( parent, name ), _major( major ), _socket( socket )
173{ 173{
174 qDebug( "OPcmciaSocket::OPcmciaSocket()" ); 174 qDebug( "OPcmciaSocket::OPcmciaSocket()" );
175 175
176 init(); 176 init();
177 buildInformation(); 177 buildInformation();
178} 178}
179 179
180 180
181OPcmciaSocket::~OPcmciaSocket() 181OPcmciaSocket::~OPcmciaSocket()
182{ 182{
183 qDebug( "OPcmciaSocket::~OPcmciaSocket()" ); 183 qDebug( "OPcmciaSocket::~OPcmciaSocket()" );
184 cleanup(); 184 cleanup();
185} 185}
186 186
187 187
188/* internal */ void OPcmciaSocket::init() 188/* internal */ void OPcmciaSocket::init()
189{ 189{
190 // open control socket and gather file descriptor 190 // open control socket and gather file descriptor
191 if ( _major ) 191 if ( _major )
192 { 192 {
193 dev_t dev = ::makedev( _major, _socket ); 193 dev_t dev = makedev( _major, _socket );
194 QString filename = QString().sprintf( "/tmp/opcmciasystem-%d", ::getpid() ); 194 QString filename = QString().sprintf( "/tmp/opcmciasystem-%d", ::getpid() );
195 if ( ::mknod( (const char*) filename, ( S_IFCHR|S_IREAD|S_IWRITE ), dev ) == 0 ) 195 if ( ::mknod( (const char*) filename, ( S_IFCHR|S_IREAD|S_IWRITE ), dev ) == 0 )
196 { 196 {
197 _fd = ::open( (const char*) filename, O_RDONLY); 197 _fd = ::open( (const char*) filename, O_RDONLY);
198 if ( !_fd ) 198 if ( !_fd )
199 { 199 {
200 qWarning( "OPcmciaSocket::init() - can't open control socket (%s)", strerror( errno ) ); 200 qWarning( "OPcmciaSocket::init() - can't open control socket (%s)", strerror( errno ) );
201 } 201 }
202 else 202 else
203 { 203 {
204 ::unlink( (const char*) filename ); 204 ::unlink( (const char*) filename );
205 } 205 }
206 } 206 }
207 else 207 else
208 { 208 {
209 qWarning( "OPcmciaSocket::init() - can't create device node (%s)", strerror( errno ) ); 209 qWarning( "OPcmciaSocket::init() - can't create device node (%s)", strerror( errno ) );
210 } 210 }
211 } 211 }
212} 212}
213 213
214/* internal */ void OPcmciaSocket::buildInformation() 214/* internal */ void OPcmciaSocket::buildInformation()
215{ 215{
216 cistpl_vers_1_t *vers = &_ioctlarg.tuple_parse.parse.version_1; 216 cistpl_vers_1_t *vers = &_ioctlarg.tuple_parse.parse.version_1;
217 cistpl_manfid_t *manfid = &_ioctlarg.tuple_parse.parse.manfid; 217 cistpl_manfid_t *manfid = &_ioctlarg.tuple_parse.parse.manfid;
218 cistpl_funcid_t *funcid = &_ioctlarg.tuple_parse.parse.funcid; 218 cistpl_funcid_t *funcid = &_ioctlarg.tuple_parse.parse.funcid;
219 config_info_t config; 219 config_info_t config;
220 220
221 if ( getTuple( CISTPL_VERS_1 ) ) 221 if ( getTuple( CISTPL_VERS_1 ) )
222 { 222 {
223 for ( int i = 0; i < CISTPL_VERS_1_MAX_PROD_STRINGS; ++i ) 223 for ( int i = 0; i < CISTPL_VERS_1_MAX_PROD_STRINGS; ++i )
224 { 224 {
225 qDebug( " PRODID = '%s'", vers->str+vers->ofs[i] ); 225 qDebug( " PRODID = '%s'", vers->str+vers->ofs[i] );
226 _productId += vers->str+vers->ofs[i]; 226 _productId += vers->str+vers->ofs[i];
227 } 227 }
228 } 228 }
229 /* 229 /*
230 for (i = 0; i < 4; i++) 230 for (i = 0; i < 4; i++)
231 printf("PRODID_%d=\"%s\"\n", i+1, 231 printf("PRODID_%d=\"%s\"\n", i+1,
232 (i < vers->ns) ? vers->str+vers->ofs[i] : ""); 232 (i < vers->ns) ? vers->str+vers->ofs[i] : "");
233 *manfid = (cistpl_manfid_t) { 0, 0 }; 233 *manfid = (cistpl_manfid_t) { 0, 0 };
234 get_tuple(fd, CISTPL_MANFID, &arg); 234 get_tuple(fd, CISTPL_MANFID, &arg);
235 printf("MANFID=%04x,%04x\n", manfid->manf, manfid->card); 235 printf("MANFID=%04x,%04x\n", manfid->manf, manfid->card);
236 *funcid = (cistpl_funcid_t) { 0xff, 0xff }; 236 *funcid = (cistpl_funcid_t) { 0xff, 0xff };
237 get_tuple(fd, CISTPL_FUNCID, &arg); 237 get_tuple(fd, CISTPL_FUNCID, &arg);
238 printf("FUNCID=%d\n", funcid->func); 238 printf("FUNCID=%d\n", funcid->func);
239 config.Function = config.ConfigBase = 0; 239 config.Function = config.ConfigBase = 0;
240 */ 240 */
241} 241}
242 242
243/* internal */ void OPcmciaSocket::cleanup() 243/* internal */ void OPcmciaSocket::cleanup()
244{ 244{
245 // close control socket 245 // close control socket
246} 246}
247 247
248/* internal */ bool OPcmciaSocket::getTuple( cisdata_t tuple ) 248/* internal */ bool OPcmciaSocket::getTuple( cisdata_t tuple )
249{ 249{
250 _ioctlarg.tuple.DesiredTuple = tuple; 250 _ioctlarg.tuple.DesiredTuple = tuple;
251 _ioctlarg.tuple.Attributes = TUPLE_RETURN_COMMON; 251 _ioctlarg.tuple.Attributes = TUPLE_RETURN_COMMON;
252 _ioctlarg.tuple.TupleOffset = 0; 252 _ioctlarg.tuple.TupleOffset = 0;
253 253
254 int result; 254 int result;
255 result = ::ioctl(_fd, DS_GET_FIRST_TUPLE, &_ioctlarg); 255 result = ::ioctl(_fd, DS_GET_FIRST_TUPLE, &_ioctlarg);
256 if ( result != 0 ) 256 if ( result != 0 )
257 { 257 {