summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opiecore/device/odevice.cpp48
-rw-r--r--libopie2/opiecore/device/odevice_abstractmobiledevice.cpp21
-rw-r--r--libopie2/opiecore/linux/linux.pro1
-rw-r--r--libopie2/opiecore/linux/opcmciasystem.cpp2
4 files changed, 36 insertions, 36 deletions
diff --git a/libopie2/opiecore/device/odevice.cpp b/libopie2/opiecore/device/odevice.cpp
index dd1e2f3..5e91d8b 100644
--- a/libopie2/opiecore/device/odevice.cpp
+++ b/libopie2/opiecore/device/odevice.cpp
@@ -1,286 +1,286 @@
1/* 1/*
2                 This file is part of the Opie Project 2                 This file is part of the Opie Project
3 3 =. (C) 2002-2005 The Opie Team <opie-devel@handhelds.org>
4 Copyright (C)2002-2005 The Opie Team <opie-devel@handhelds.org>
5 =.
6 .=l. 4 .=l.
7           .>+-= 5           .>+-=
8 _;:,     .>    :=|. This program is free software; you can 6 _;:,     .>    :=|. This program is free software; you can
9.> <`_,   >  .   <= redistribute it and/or modify it under 7.> <`_,   >  .   <= redistribute it and/or modify it under
10:`=1 )Y*s>-.--   : the terms of the GNU Library General Public 8:`=1 )Y*s>-.--   : the terms of the GNU Library General Public
11.="- .-=="i,     .._ License as published by the Free Software 9.="- .-=="i,     .._ License as published by the Free Software
12 - .   .-<_>     .<> Foundation; either version 2 of the License, 10 - .   .-<_>     .<> Foundation; version 2 of the License.
13     ._= =}       : or (at your option) any later version. 11     ._= =}       :
14    .%`+i>       _;_. 12    .%`+i>       _;_.
15    .i_,=:_.      -<s. This program is distributed in the hope that 13    .i_,=:_.      -<s. This program is distributed in the hope that
16     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY; 14     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
17 : ..    .:,     . . . without even the implied warranty of 15    : ..    .:,     . . . without even the implied warranty of
18    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A 16    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
19  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU 17  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
20..}^=.=       =       ; Library General Public License for more 18..}^=.=       =       ; Library General Public License for more
21++=   -.     .`     .: details. 19++=   -.     .`     .: details.
22:     =  ...= . :.=- 20 :     =  ...= . :.=-
23 -.   .:....=;==+<; You should have received a copy of the GNU 21 -.   .:....=;==+<; You should have received a copy of the GNU
24  -_. . .   )=.  = Library General Public License along with 22  -_. . .   )=.  = Library General Public License along with
25    --        :-=` this library; see the file COPYING.LIB. 23    --        :-=` this library; see the file COPYING.LIB.
26 If not, write to the Free Software Foundation, 24 If not, write to the Free Software Foundation,
27 Inc., 59 Temple Place - Suite 330, 25 Inc., 59 Temple Place - Suite 330,
28 Boston, MA 02111-1307, USA. 26 Boston, MA 02111-1307, USA.
27
29*/ 28*/
30 29
30
31#include "odevice_beagle.h" 31#include "odevice_beagle.h"
32#include "odevice_ipaq.h" 32#include "odevice_ipaq.h"
33#include "odevice_jornada.h" 33#include "odevice_jornada.h"
34#include "odevice_ramses.h" 34#include "odevice_ramses.h"
35#include "odevice_simpad.h" 35#include "odevice_simpad.h"
36#include "odevice_yopy.h" 36#include "odevice_yopy.h"
37#include "odevice_zaurus.h" 37#include "odevice_zaurus.h"
38#include "odevice_genuineintel.h" 38#include "odevice_genuineintel.h"
39 39
40/* QT */ 40/* QT */
41#include <qapplication.h> 41#include <qapplication.h>
42#include <qfile.h> 42#include <qfile.h>
43#include <qtextstream.h> 43#include <qtextstream.h>
44#include <qwindowsystem_qws.h> 44#include <qwindowsystem_qws.h>
45 45
46/* OPIE */ 46/* OPIE */
47#include <qpe/config.h> 47#include <qpe/config.h>
48#include <qpe/sound.h> 48#include <qpe/sound.h>
49#include <qpe/qcopenvelope_qws.h> 49#include <qpe/qcopenvelope_qws.h>
50#include <qpe/sound.h> 50#include <qpe/sound.h>
51 51
52#include <opie2/okeyfilter.h> 52#include <opie2/okeyfilter.h>
53#include <opie2/oresource.h> 53#include <opie2/oresource.h>
54 54
55/* STD */ 55/* STD */
56#include <fcntl.h> 56#include <fcntl.h>
57#include <math.h> 57#include <math.h>
58#include <stdlib.h> 58#include <stdlib.h>
59#include <signal.h> 59#include <signal.h>
60#include <sys/ioctl.h> 60#include <sys/ioctl.h>
61#include <sys/time.h> 61#include <sys/time.h>
62#include <unistd.h> 62#include <unistd.h>
63#ifndef QT_NO_SOUND 63#ifndef QT_NO_SOUND
64#include <linux/soundcard.h> 64#include <linux/soundcard.h>
65#endif 65#endif
66 66
67namespace Opie { 67namespace Opie {
68namespace Core { 68namespace Core {
69 69
70static const char* PATH_PROC_CPUINFO = "/proc/cpuinfo"; 70static const char* PATH_PROC_CPUINFO = "/proc/cpuinfo";
71 71
72 72
73/* STATIC and common implementation */ 73/* STATIC and common implementation */
74/* EXPORT */ ODistribution distributions[] = { 74/* EXPORT */ ODistribution distributions[] = {
75 { System_Familiar, "FamiliarLinux", "/etc/familiar-version" }, 75 { System_Familiar, "FamiliarLinux", "/etc/familiar-version" },
76 { System_OpenZaurus, "OpenZaurus", "/etc/oz_version" }, 76 { System_OpenZaurus, "OpenZaurus", "/etc/oz_version" },
77 { System_OpenEmbedded, "OpenEmbedded", "/etc/oe-version" }, 77 { System_OpenEmbedded, "OpenEmbedded", "/etc/oe-version" },
78 { System_Unknown, "Linux", "/etc/issue" }, 78 { System_Unknown, "Linux", "/etc/issue" },
79}; 79};
80 80
81 81
82/* EXPORT */ bool isQWS(){ 82/* EXPORT */ bool isQWS(){
83 return qApp ? ( qApp->type() == QApplication::GuiServer ) : false; 83 return qApp ? ( qApp->type() == QApplication::GuiServer ) : false;
84} 84}
85 85
86/* EXPORT */ QCString makeChannel ( const char *str ){ 86/* EXPORT */ QCString makeChannel ( const char *str ){
87 if ( str && !::strchr ( str, '/' )) 87 if ( str && !::strchr ( str, '/' ))
88 return QCString ( "QPE/Application/" ) + str; 88 return QCString ( "QPE/Application/" ) + str;
89 else 89 else
90 return str; 90 return str;
91} 91}
92 92
93 93
94 94
95/* Now the default implementation of ODevice */ 95/* Now the default implementation of ODevice */
96 96
97struct default_button default_buttons [] = { 97struct default_button default_buttons [] = {
98 { Qt::Key_F9, QT_TRANSLATE_NOOP("Button", "Calendar Button"), 98 { Qt::Key_F9, QT_TRANSLATE_NOOP("Button", "Calendar Button"),
99 "devicebuttons/z_calendar", 99 "devicebuttons/z_calendar",
100 "datebook", "nextView()", 100 "datebook", "nextView()",
101 "today", "raise()" }, 101 "today", "raise()" },
102 { Qt::Key_F10, QT_TRANSLATE_NOOP("Button", "Contacts Button"), 102 { Qt::Key_F10, QT_TRANSLATE_NOOP("Button", "Contacts Button"),
103 "devicebuttons/z_contact", 103 "devicebuttons/z_contact",
104 "addressbook", "raise()", 104 "addressbook", "raise()",
105 "addressbook", "beamBusinessCard()" }, 105 "addressbook", "beamBusinessCard()" },
106 { Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Home Button"), 106 { Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Home Button"),
107 "devicebuttons/z_home", 107 "devicebuttons/z_home",
108 "QPE/Launcher", "home()", 108 "QPE/Launcher", "home()",
109 "buttonsettings", "raise()" }, 109 "buttonsettings", "raise()" },
110 { Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Menu Button"), 110 { Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Menu Button"),
111 "devicebuttons/z_menu", 111 "devicebuttons/z_menu",
112 "QPE/TaskBar", "toggleMenu()", 112 "QPE/TaskBar", "toggleMenu()",
113 "QPE/TaskBar", "toggleStartMenu()" }, 113 "QPE/TaskBar", "toggleStartMenu()" },
114 { Qt::Key_F13, QT_TRANSLATE_NOOP("Button", "Mail Button"), 114 { Qt::Key_F13, QT_TRANSLATE_NOOP("Button", "Mail Button"),
115 "devicebuttons/z_mail", 115 "devicebuttons/z_mail",
116 "opiemail", "raise()", 116 "opiemail", "raise()",
117 "opiemail", "newMail()" }, 117 "opiemail", "newMail()" },
118}; 118};
119 119
120ODevice *ODevice::inst() 120ODevice *ODevice::inst()
121{ 121{
122 static ODevice *dev = 0; 122 static ODevice *dev = 0;
123 QString cpu_info; 123 QString cpu_info;
124 124
125 if ( !dev ) 125 if ( !dev )
126 { 126 {
127 QFile f( PATH_PROC_CPUINFO ); 127 QFile f( PATH_PROC_CPUINFO );
128 if ( f.open( IO_ReadOnly ) ) 128 if ( f.open( IO_ReadOnly ) )
129 { 129 {
130 QTextStream s( &f ); 130 QTextStream s( &f );
131 while ( !s.atEnd() ) 131 while ( !s.atEnd() )
132 { 132 {
133 QString line; 133 QString line;
134 line = s.readLine(); 134 line = s.readLine();
135 if ( line.startsWith( "Hardware" ) ) 135 if ( line.startsWith( "Hardware" ) )
136 { 136 {
137 qDebug( "ODevice() - found '%s'", (const char*) line ); 137 qDebug( "ODevice() - found '%s'", (const char*) line );
138 cpu_info = line; 138 cpu_info = line;
139 if ( line.contains( "sharp", false ) ) dev = new Internal::Zaurus(); 139 if ( line.contains( "sharp", false ) ) dev = new Internal::Zaurus();
140 else if ( line.contains( "ipaq", false ) ) dev = new Internal::iPAQ(); 140 else if ( line.contains( "ipaq", false ) ) dev = new Internal::iPAQ();
141 else if ( line.contains( "simpad", false ) ) dev = new Internal::SIMpad(); 141 else if ( line.contains( "simpad", false ) ) dev = new Internal::SIMpad();
142 else if ( line.contains( "jornada", false ) ) dev = new Internal::Jornada(); 142 else if ( line.contains( "jornada", false ) ) dev = new Internal::Jornada();
143 else if ( line.contains( "ramses", false ) ) dev = new Internal::Ramses(); 143 else if ( line.contains( "ramses", false ) ) dev = new Internal::Ramses();
144 else if ( line.contains( "Tradesquare.NL", false ) ) dev = new Internal::Beagle(); 144 else if ( line.contains( "Tradesquare.NL", false ) ) dev = new Internal::Beagle();
145 else qWarning( "ODevice() - unknown hardware - using default." ); 145 else qWarning( "ODevice() - unknown hardware - using default." );
146 break; 146 break;
147 } else if ( line.startsWith( "vendor_id" ) ) { 147 } else if ( line.startsWith( "vendor_id" ) ) {
148 qDebug( "ODevice() - found '%s'", (const char*) line ); 148 qDebug( "ODevice() - found '%s'", (const char*) line );
149 cpu_info = line; 149 cpu_info = line;
150 if( line.contains( "genuineintel", false ) ) { 150 if( line.contains( "genuineintel", false ) ) {
151 dev = new Internal::GenuineIntel(); 151 dev = new Internal::GenuineIntel();
152 break; 152 break;
153 } 153 }
154 } 154 }
155 } 155 }
156 } 156 }
157 else 157 else
158 { 158 {
159 qWarning( "ODevice() - can't open '%s' - unknown hardware - using default.", PATH_PROC_CPUINFO ); 159 qWarning( "ODevice() - can't open '%s' - unknown hardware - using default.", PATH_PROC_CPUINFO );
160 } 160 }
161 if ( !dev ) dev = new ODevice(); 161 if ( !dev ) dev = new ODevice();
162 dev->init(cpu_info); 162 dev->init(cpu_info);
163 } 163 }
164 return dev; 164 return dev;
165} 165}
166 166
167ODevice::ODevice() 167ODevice::ODevice()
168{ 168{
169 d = new ODeviceData; 169 d = new ODeviceData;
170 170
171 d->m_modelstr = "Unknown"; 171 d->m_modelstr = "Unknown";
172 d->m_model = Model_Unknown; 172 d->m_model = Model_Unknown;
173 d->m_vendorstr = "Unknown"; 173 d->m_vendorstr = "Unknown";
174 d->m_vendor = Vendor_Unknown; 174 d->m_vendor = Vendor_Unknown;
175 d->m_systemstr = "Unknown"; 175 d->m_systemstr = "Unknown";
176 d->m_system = System_Unknown; 176 d->m_system = System_Unknown;
177 d->m_sysverstr = "0.0"; 177 d->m_sysverstr = "0.0";
178 d->m_rotation = Rot0; 178 d->m_rotation = Rot0;
179 d->m_direction = CW; 179 d->m_direction = CW;
180 180
181 d->m_holdtime = 1000; // 1000ms 181 d->m_holdtime = 1000; // 1000ms
182 d->m_buttons = 0; 182 d->m_buttons = 0;
183 d->m_cpu_frequencies = new QStrList; 183 d->m_cpu_frequencies = new QStrList;
184 184
185 185
186 /* mixer */ 186 /* mixer */
187 d->m_sound = d->m_vol = d->m_mixer = -1; 187 d->m_sound = d->m_vol = d->m_mixer = -1;
188 188
189 /* System QCopChannel created */ 189 /* System QCopChannel created */
190 d->m_initializedButtonQcop = false; 190 d->m_initializedButtonQcop = false;
191 191
192 // New distribution detection code first checks for legacy distributions, 192 // New distribution detection code first checks for legacy distributions,
193 // identified by /etc/familiar-version or /etc/oz_version. 193 // identified by /etc/familiar-version or /etc/oz_version.
194 // Then check for OpenEmbedded and lastly, read /etc/issue 194 // Then check for OpenEmbedded and lastly, read /etc/issue
195 195
196 for ( unsigned int i = 0; i < sizeof(distributions)/sizeof(ODistribution); ++i ) 196 for ( unsigned int i = 0; i < sizeof(distributions)/sizeof(ODistribution); ++i )
197 { 197 {
198 if ( QFile::exists( distributions[i].sysvfile ) ) 198 if ( QFile::exists( distributions[i].sysvfile ) )
199 { 199 {
200 d->m_systemstr = distributions[i].sysstr; 200 d->m_systemstr = distributions[i].sysstr;
201 d->m_system = distributions[i].system; 201 d->m_system = distributions[i].system;
202 d->m_sysverstr = "<Unknown>"; 202 d->m_sysverstr = "<Unknown>";
203 QFile f( distributions[i].sysvfile ); 203 QFile f( distributions[i].sysvfile );
204 if ( f.open( IO_ReadOnly ) ) 204 if ( f.open( IO_ReadOnly ) )
205 { 205 {
206 QTextStream ts( &f ); 206 QTextStream ts( &f );
207 d->m_sysverstr = ts.readLine().replace( QRegExp( "\\\\." ), "" ); 207 d->m_sysverstr = ts.readLine().replace( QRegExp( "\\\\." ), "" );
208 } 208 }
209 break; 209 break;
210 } 210 }
211 } 211 }
212} 212}
213 213
214void ODevice::systemMessage( const QCString &msg, const QByteArray & ) 214void ODevice::systemMessage( const QCString &msg, const QByteArray & )
215{ 215{
216 if ( msg == "deviceButtonMappingChanged()" ) { 216 if ( msg == "deviceButtonMappingChanged()" ) {
217 reloadButtonMapping(); 217 reloadButtonMapping();
218 } 218 }
219} 219}
220 220
221void ODevice::init(const QString&) 221void ODevice::init(const QString&)
222{ 222{
223} 223}
224 224
225/** 225/**
226* This method initialises the button mapping 226* This method initialises the button mapping
227*/ 227*/
228void ODevice::initButtons() 228void ODevice::initButtons()
229{ 229{
230 if ( d->m_buttons ) 230 if ( d->m_buttons )
231 return; 231 return;
232 232
233 qDebug ( "init Buttons" ); 233 qDebug ( "init Buttons" );
234 d->m_buttons = new QValueList <ODeviceButton>; 234 d->m_buttons = new QValueList <ODeviceButton>;
235 for ( uint i = 0; i < ( sizeof( default_buttons ) / sizeof( default_button )); i++ ) { 235 for ( uint i = 0; i < ( sizeof( default_buttons ) / sizeof( default_button )); i++ ) {
236 default_button *db = default_buttons + i; 236 default_button *db = default_buttons + i;
237 ODeviceButton b; 237 ODeviceButton b;
238 b. setKeycode ( db->code ); 238 b. setKeycode ( db->code );
239 b. setUserText ( QObject::tr ( "Button", db->utext )); 239 b. setUserText ( QObject::tr ( "Button", db->utext ));
240 b. setPixmap ( OResource::loadPixmap ( db->pix )); 240 b. setPixmap ( OResource::loadPixmap ( db->pix ));
241 b. setFactoryPresetPressedAction ( OQCopMessage ( makeChannel ( db->fpressedservice ), db->fpressedaction )); 241 b. setFactoryPresetPressedAction ( OQCopMessage ( makeChannel ( db->fpressedservice ), db->fpressedaction ));
242 b. setFactoryPresetHeldAction ( OQCopMessage ( makeChannel ( db->fheldservice ), db->fheldaction )); 242 b. setFactoryPresetHeldAction ( OQCopMessage ( makeChannel ( db->fheldservice ), db->fheldaction ));
243 d->m_buttons->append ( b ); 243 d->m_buttons->append ( b );
244 } 244 }
245 245
246 reloadButtonMapping(); 246 reloadButtonMapping();
247} 247}
248 248
249ODevice::~ODevice() 249ODevice::~ODevice()
250{ 250{
251// we leak m_devicebuttons and m_cpu_frequency 251// we leak m_devicebuttons and m_cpu_frequency
252// but it's a singleton and it is not so importantant 252// but it's a singleton and it is not so importantant
253// -zecke 253// -zecke
254 delete d; 254 delete d;
255} 255}
256 256
257/** 257/**
258* This method will try to suspend the device 258* This method will try to suspend the device
259* It only works if the user is the QWS Server and the apm application 259* It only works if the user is the QWS Server and the apm application
260* is installed. 260* is installed.
261* It tries to suspend and then waits some time cause some distributions 261* It tries to suspend and then waits some time cause some distributions
262* do have asynchronus apm implementations. 262* do have asynchronus apm implementations.
263* This method will either fail and return false or it'll suspend the 263* This method will either fail and return false or it'll suspend the
264* device and return once the device got woken up 264* device and return once the device got woken up
265* 265*
266* @return if the device got suspended 266* @return if the device got suspended
267*/ 267*/
268bool ODevice::suspend() 268bool ODevice::suspend()
269{ 269{
270 return false; // default implementation == unknown device or qvfb 270 return false; // default implementation == unknown device or qvfb
271} 271}
272 272
273/** 273/**
274* This sets the display on or off 274* This sets the display on or off
275*/ 275*/
276bool ODevice::setDisplayStatus( bool on ) 276bool ODevice::setDisplayStatus( bool on )
277{ 277{
278 qDebug( "ODevice::setDisplayStatus( %d ) - please override me.", on ); 278 qDebug( "ODevice::setDisplayStatus( %d ) - please override me.", on );
279 return false; // don't do anything for unknown models 279 return false; // don't do anything for unknown models
280} 280}
281 281
282/** 282/**
283* This sets the display brightness 283* This sets the display brightness
284* 284*
285* @param b The brightness to be set on a scale from 0 to 255 285* @param b The brightness to be set on a scale from 0 to 255
286* @return success or failure 286* @return success or failure
@@ -441,369 +441,369 @@ void ODevice::playTouchSound()
441#endif 441#endif
442} 442}
443 443
444/** 444/**
445* This method will return a list of leds 445* This method will return a list of leds
446* available on this device 446* available on this device
447* @return a list of LEDs. 447* @return a list of LEDs.
448*/ 448*/
449QValueList <OLed> ODevice::ledList() const 449QValueList <OLed> ODevice::ledList() const
450{ 450{
451 return QValueList <OLed>(); 451 return QValueList <OLed>();
452} 452}
453 453
454/** 454/**
455* This does return the state of the LEDs 455* This does return the state of the LEDs
456*/ 456*/
457QValueList <OLedState> ODevice::ledStateList ( OLed /*which*/ ) const 457QValueList <OLedState> ODevice::ledStateList ( OLed /*which*/ ) const
458{ 458{
459 return QValueList <OLedState>(); 459 return QValueList <OLedState>();
460} 460}
461 461
462/** 462/**
463* @return the state for a given OLed 463* @return the state for a given OLed
464*/ 464*/
465OLedState ODevice::ledState ( OLed /*which*/ ) const 465OLedState ODevice::ledState ( OLed /*which*/ ) const
466{ 466{
467 return Led_Off; 467 return Led_Off;
468} 468}
469 469
470/** 470/**
471* Set the state for a LED 471* Set the state for a LED
472* @param which Which OLed to use 472* @param which Which OLed to use
473* @param st The state to set 473* @param st The state to set
474* @return success or failure 474* @return success or failure
475*/ 475*/
476bool ODevice::setLedState ( OLed which, OLedState st ) 476bool ODevice::setLedState ( OLed which, OLedState st )
477{ 477{
478 Q_UNUSED( which ) 478 Q_UNUSED( which )
479 Q_UNUSED( st ) 479 Q_UNUSED( st )
480 return false; 480 return false;
481} 481}
482 482
483/** 483/**
484* @return if the device has a light sensor 484* @return if the device has a light sensor
485*/ 485*/
486bool ODevice::hasLightSensor() const 486bool ODevice::hasLightSensor() const
487{ 487{
488 return false; 488 return false;
489} 489}
490 490
491/** 491/**
492* @return a value from the light sensor 492* @return a value from the light sensor
493*/ 493*/
494int ODevice::readLightSensor() 494int ODevice::readLightSensor()
495{ 495{
496 return -1; 496 return -1;
497} 497}
498 498
499/** 499/**
500* @return the light sensor resolution 500* @return the light sensor resolution
501*/ 501*/
502int ODevice::lightSensorResolution() const 502int ODevice::lightSensorResolution() const
503{ 503{
504 return 0; 504 return 0;
505} 505}
506 506
507/** 507/**
508* @return if the device has a hinge sensor 508* @return if the device has a hinge sensor
509*/ 509*/
510bool ODevice::hasHingeSensor() const 510bool ODevice::hasHingeSensor() const
511{ 511{
512 return false; 512 return false;
513} 513}
514 514
515/** 515/**
516* @return a value from the hinge sensor 516* @return a value from the hinge sensor
517*/ 517*/
518OHingeStatus ODevice::readHingeSensor()const 518OHingeStatus ODevice::readHingeSensor()const
519{ 519{
520 return CASE_UNKNOWN; 520 return CASE_UNKNOWN;
521} 521}
522 522
523/** 523/**
524* @return a list with CPU frequencies supported by the hardware 524* @return a list with CPU frequencies supported by the hardware
525*/ 525*/
526const QStrList &ODevice::allowedCpuFrequencies() const 526const QStrList &ODevice::allowedCpuFrequencies() const
527{ 527{
528 return *d->m_cpu_frequencies; 528 return *d->m_cpu_frequencies;
529} 529}
530 530
531 531
532/** 532/**
533* Set desired CPU frequency 533* Set desired CPU frequency
534* 534*
535* @param index index into d->m_cpu_frequencies of the frequency to be set 535* @param index index into d->m_cpu_frequencies of the frequency to be set
536*/ 536*/
537bool ODevice::setCurrentCpuFrequency(uint index) 537bool ODevice::setCurrentCpuFrequency(uint index)
538{ 538{
539 if (index >= d->m_cpu_frequencies->count()) 539 if (index >= d->m_cpu_frequencies->count())
540 return false; 540 return false;
541 541
542 char *freq = d->m_cpu_frequencies->at(index); 542 char *freq = d->m_cpu_frequencies->at(index);
543 qWarning("set freq to %s", freq); 543 qWarning("set freq to %s", freq);
544 544
545 int fd; 545 int fd;
546 546
547 if ((fd = ::open("/proc/sys/cpu/0/speed", O_WRONLY)) >= 0) { 547 if ((fd = ::open("/proc/sys/cpu/0/speed", O_WRONLY)) >= 0) {
548 char writeCommand[50]; 548 char writeCommand[50];
549 const int count = sprintf(writeCommand, "%s\n", freq); 549 const int count = sprintf(writeCommand, "%s\n", freq);
550 int res = (::write(fd, writeCommand, count) != -1); 550 int res = (::write(fd, writeCommand, count) != -1);
551 ::close(fd); 551 ::close(fd);
552 return res; 552 return res;
553 } 553 }
554 554
555 return false; 555 return false;
556} 556}
557 557
558 558
559/** 559/**
560* @return a list of hardware buttons 560* @return a list of hardware buttons
561*/ 561*/
562const QValueList <ODeviceButton> &ODevice::buttons() 562const QValueList <ODeviceButton> &ODevice::buttons()
563{ 563{
564 initButtons(); 564 initButtons();
565 565
566 return *d->m_buttons; 566 return *d->m_buttons;
567} 567}
568 568
569/** 569/**
570* @return The amount of time that would count as a hold 570* @return The amount of time that would count as a hold
571*/ 571*/
572uint ODevice::buttonHoldTime() const 572uint ODevice::buttonHoldTime() const
573{ 573{
574 return d->m_holdtime; 574 return d->m_holdtime;
575} 575}
576 576
577/** 577/**
578* This method return a ODeviceButton for a key code 578* This method return a ODeviceButton for a key code
579* or 0 if no special hardware button is available for the device 579* or 0 if no special hardware button is available for the device
580* 580*
581* @return The devicebutton or 0l 581* @return The devicebutton or 0l
582* @see ODeviceButton 582* @see ODeviceButton
583*/ 583*/
584const ODeviceButton *ODevice::buttonForKeycode ( ushort code ) 584const ODeviceButton *ODevice::buttonForKeycode ( ushort code )
585{ 585{
586 initButtons(); 586 initButtons();
587 587
588 for ( QValueListConstIterator<ODeviceButton> it = d->m_buttons->begin(); it != d->m_buttons->end(); ++it ) { 588 for ( QValueListConstIterator<ODeviceButton> it = d->m_buttons->begin(); it != d->m_buttons->end(); ++it ) {
589 if ( (*it).keycode() == code ) 589 if ( (*it).keycode() == code )
590 return &(*it); 590 return &(*it);
591 } 591 }
592 return 0; 592 return 0;
593} 593}
594 594
595void ODevice::reloadButtonMapping() 595void ODevice::reloadButtonMapping()
596{ 596{
597 if(!d->m_buttons) 597 if(!d->m_buttons)
598 initButtons(); 598 initButtons();
599 599
600 if(!d->m_initializedButtonQcop) { 600 if(!d->m_initializedButtonQcop) {
601 QCopChannel *chan = new QCopChannel("QPE/System", this, "ODevice button channel"); 601 QCopChannel *chan = new QCopChannel("QPE/System", this, "ODevice button channel");
602 connect(chan,SIGNAL(received(const QCString&,const QByteArray&)), 602 connect(chan,SIGNAL(received(const QCString&,const QByteArray&)),
603 this,SLOT(systemMessage(const QCString&,const QByteArray&))); 603 this,SLOT(systemMessage(const QCString&,const QByteArray&)));
604 d->m_initializedButtonQcop = true; 604 d->m_initializedButtonQcop = true;
605 } 605 }
606 606
607 Config cfg ( "ButtonSettings" ); 607 Config cfg ( "ButtonSettings" );
608 608
609 for ( uint i = 0; i < d->m_buttons->count(); i++ ) { 609 for ( uint i = 0; i < d->m_buttons->count(); i++ ) {
610 ODeviceButton &b = ( *d->m_buttons ) [i]; 610 ODeviceButton &b = ( *d->m_buttons ) [i];
611 QString group = "Button" + QString::number ( i ); 611 QString group = "Button" + QString::number ( i );
612 612
613 QCString pch, hch; 613 QCString pch, hch;
614 QCString pm, hm; 614 QCString pm, hm;
615 QByteArray pdata, hdata; 615 QByteArray pdata, hdata;
616 616
617 if ( cfg. hasGroup ( group )) { 617 if ( cfg. hasGroup ( group )) {
618 cfg. setGroup ( group ); 618 cfg. setGroup ( group );
619 pch = cfg. readEntry ( "PressedActionChannel" ). latin1(); 619 pch = cfg. readEntry ( "PressedActionChannel" ). latin1();
620 pm = cfg. readEntry ( "PressedActionMessage" ). latin1(); 620 pm = cfg. readEntry ( "PressedActionMessage" ). latin1();
621 // pdata = decodeBase64 ( buttonFile. readEntry ( "PressedActionArgs" )); 621 // pdata = decodeBase64 ( buttonFile. readEntry ( "PressedActionArgs" ));
622 622
623 hch = cfg. readEntry ( "HeldActionChannel" ). latin1(); 623 hch = cfg. readEntry ( "HeldActionChannel" ). latin1();
624 hm = cfg. readEntry ( "HeldActionMessage" ). latin1(); 624 hm = cfg. readEntry ( "HeldActionMessage" ). latin1();
625 // hdata = decodeBase64 ( buttonFile. readEntry ( "HeldActionArgs" )); 625 // hdata = decodeBase64 ( buttonFile. readEntry ( "HeldActionArgs" ));
626 } 626 }
627 627
628 b. setPressedAction ( OQCopMessage ( pch, pm, pdata )); 628 b. setPressedAction ( OQCopMessage ( pch, pm, pdata ));
629 b. setHeldAction ( OQCopMessage ( hch, hm, hdata )); 629 b. setHeldAction ( OQCopMessage ( hch, hm, hdata ));
630 } 630 }
631} 631}
632 632
633void ODevice::remapPressedAction ( int button, const OQCopMessage &action ) 633void ODevice::remapPressedAction ( int button, const OQCopMessage &action )
634{ 634{
635 initButtons(); 635 initButtons();
636 636
637 QString mb_chan; 637 QString mb_chan;
638 638
639 if ( button >= (int) d->m_buttons->count()) 639 if ( button >= (int) d->m_buttons->count())
640 return; 640 return;
641 641
642 ODeviceButton &b = ( *d->m_buttons ) [button]; 642 ODeviceButton &b = ( *d->m_buttons ) [button];
643 b. setPressedAction ( action ); 643 b. setPressedAction ( action );
644 644
645 mb_chan=b. pressedAction(). channel(); 645 mb_chan=b. pressedAction(). channel();
646 646
647 Config buttonFile ( "ButtonSettings" ); 647 Config buttonFile ( "ButtonSettings" );
648 buttonFile. setGroup ( "Button" + QString::number ( button )); 648 buttonFile. setGroup ( "Button" + QString::number ( button ));
649 buttonFile. writeEntry ( "PressedActionChannel", (const char*) mb_chan); 649 buttonFile. writeEntry ( "PressedActionChannel", (const char*) mb_chan);
650 buttonFile. writeEntry ( "PressedActionMessage", (const char*) b. pressedAction(). message()); 650 buttonFile. writeEntry ( "PressedActionMessage", (const char*) b. pressedAction(). message());
651 651
652// buttonFile. writeEntry ( "PressedActionArgs", encodeBase64 ( b. pressedAction(). data())); 652// buttonFile. writeEntry ( "PressedActionArgs", encodeBase64 ( b. pressedAction(). data()));
653 653
654 QCopEnvelope ( "QPE/System", "deviceButtonMappingChanged()" ); 654 QCopEnvelope ( "QPE/System", "deviceButtonMappingChanged()" );
655} 655}
656 656
657void ODevice::remapHeldAction ( int button, const OQCopMessage &action ) 657void ODevice::remapHeldAction ( int button, const OQCopMessage &action )
658{ 658{
659 initButtons(); 659 initButtons();
660 660
661 if ( button >= (int) d->m_buttons->count()) 661 if ( button >= (int) d->m_buttons->count())
662 return; 662 return;
663 663
664 ODeviceButton &b = ( *d->m_buttons ) [button]; 664 ODeviceButton &b = ( *d->m_buttons ) [button];
665 b. setHeldAction ( action ); 665 b. setHeldAction ( action );
666 666
667 Config buttonFile ( "ButtonSettings" ); 667 Config buttonFile ( "ButtonSettings" );
668 buttonFile. setGroup ( "Button" + QString::number ( button )); 668 buttonFile. setGroup ( "Button" + QString::number ( button ));
669 buttonFile. writeEntry ( "HeldActionChannel", (const char *) b. heldAction(). channel()); 669 buttonFile. writeEntry ( "HeldActionChannel", (const char *) b. heldAction(). channel());
670 buttonFile. writeEntry ( "HeldActionMessage", (const char *) b. heldAction(). message()); 670 buttonFile. writeEntry ( "HeldActionMessage", (const char *) b. heldAction(). message());
671 671
672// buttonFile. writeEntry ( "HeldActionArgs", decodeBase64 ( b. heldAction(). data())); 672// buttonFile. writeEntry ( "HeldActionArgs", decodeBase64 ( b. heldAction(). data()));
673 673
674 QCopEnvelope ( "QPE/System", "deviceButtonMappingChanged()" ); 674 QCopEnvelope ( "QPE/System", "deviceButtonMappingChanged()" );
675} 675}
676 676
677/** 677/**
678 * @internal 678 * @internal
679 */ 679 */
680void ODevice::virtual_hook(int, void* ){ 680void ODevice::virtual_hook(int, void* ){
681 681
682} 682}
683 683
684/** 684/**
685 * \brief Send a QCOP Message before suspending 685 * \brief Send a QCOP Message before suspending
686 * 686 *
687 * Sends a QCOP message to channel QPE/System 687 * Sends a QCOP message to channel QPE/System
688 * with the message "aboutToSuspend()" if this 688 * with the message "aboutToSuspend()" if this
689 * is the windowing server. 689 * is the windowing server.
690 * 690 *
691 * Call this in your custom \sa suspend() Method 691 * Call this in your custom \sa suspend() Method
692 * before going to suspend. 692 * before going to suspend.
693 * 693 *
694 */ 694 */
695void ODevice::sendSuspendmsg() 695void ODevice::sendSuspendmsg()
696{ 696{
697 if ( isQWS() ) 697 if ( !isQWS() )
698 return; 698 return;
699 699
700 QCopEnvelope ( "QPE/System", "aboutToSuspend()" ); 700 QCopEnvelope ( "QPE/System", "aboutToSuspend()" );
701} 701}
702 702
703/** 703/**
704 * \brief Prepend the QWSServer::KeyboardFilter to the list of installed KeyFilters 704 * \brief Prepend the QWSServer::KeyboardFilter to the list of installed KeyFilters
705 * 705 *
706 * Prepend a QWSServer::KeyboardFilter to the List of Keyboard 706 * Prepend a QWSServer::KeyboardFilter to the List of Keyboard
707 * Filters. This function is the only way to prepend a KeyFilter. 707 * Filters. This function is the only way to prepend a KeyFilter.
708 * 708 *
709 * @param aFilter The KeyFilter to be prepended to the list of filters 709 * @param aFilter The KeyFilter to be prepended to the list of filters
710 * 710 *
711 * @see Opie::Core::OKeyFilter 711 * @see Opie::Core::OKeyFilter
712 * @see Opie::Core::OKeyFilter::inst() 712 * @see Opie::Core::OKeyFilter::inst()
713 */ 713 */
714void ODevice::addPreHandler(QWSServer::KeyboardFilter*aFilter) 714void ODevice::addPreHandler(QWSServer::KeyboardFilter*aFilter)
715{ 715{
716 Opie::Core::OKeyFilter::inst()->addPreHandler(aFilter); 716 Opie::Core::OKeyFilter::inst()->addPreHandler(aFilter);
717} 717}
718 718
719/** 719/**
720 * \brief Remove the QWSServer::KeyboardFilter in the param from the list 720 * \brief Remove the QWSServer::KeyboardFilter in the param from the list
721 * 721 *
722 * Remove the QWSServer::KeyboardFilter \par aFilter from the List 722 * Remove the QWSServer::KeyboardFilter \par aFilter from the List
723 * of Keyfilters. Call this when you delete the KeyFilter! 723 * of Keyfilters. Call this when you delete the KeyFilter!
724 * 724 *
725 * @param aFilter The filter to be removed from the Opie::Core::OKeyFilter 725 * @param aFilter The filter to be removed from the Opie::Core::OKeyFilter
726 * @see Opie::Core::ODevice::addPreHandler 726 * @see Opie::Core::ODevice::addPreHandler
727 */ 727 */
728void ODevice::remPreHandler(QWSServer::KeyboardFilter*aFilter) 728void ODevice::remPreHandler(QWSServer::KeyboardFilter*aFilter)
729{ 729{
730 Opie::Core::OKeyFilter::inst()->remPreHandler(aFilter); 730 Opie::Core::OKeyFilter::inst()->remPreHandler(aFilter);
731} 731}
732 732
733 733
734/** 734/**
735 * @internal 735 * @internal
736 * 736 *
737 * @see changeMixerForAlarm 737 * @see changeMixerForAlarm
738 */ 738 */
739void ODevice::playingStopped() { 739void ODevice::playingStopped() {
740 if ( sender() ) 740 if ( sender() )
741 const_cast<QObject*>(sender())->disconnect( this ); 741 const_cast<QObject*>(sender())->disconnect( this );
742 742
743#ifndef QT_NO_SOUND 743#ifndef QT_NO_SOUND
744 if ( d->m_sound >= 0 ) { 744 if ( d->m_sound >= 0 ) {
745 ::ioctl ( d->m_sound, MIXER_WRITE( d->m_mixer ), &d->m_vol ); 745 ::ioctl ( d->m_sound, MIXER_WRITE( d->m_mixer ), &d->m_vol );
746 ::close ( d->m_sound ); 746 ::close ( d->m_sound );
747 } 747 }
748#endif 748#endif
749} 749}
750 750
751 751
752/** 752/**
753 * \brief Change the Volume for the Alarm and set it back after playing is finished 753 * \brief Change the Volume for the Alarm and set it back after playing is finished
754 * 754 *
755 * If you play an Alarm Sound you might want to change the Mixer to 755 * If you play an Alarm Sound you might want to change the Mixer to
756 * full volume and ignore the user setting. After it \sa Sound::isFinished 756 * full volume and ignore the user setting. After it \sa Sound::isFinished
757 * you would turn the volume back to the user preference. 757 * you would turn the volume back to the user preference.
758 * The problem is that we used to enter the event loop while waiting 758 * The problem is that we used to enter the event loop while waiting
759 * for the sound to be finished triggering all kind of reentrance 759 * for the sound to be finished triggering all kind of reentrance
760 * problems what a library shouldn't introduce. 760 * problems what a library shouldn't introduce.
761 * Instead of manually waiting for the sound to be finished use 761 * Instead of manually waiting for the sound to be finished use
762 * this Method and it will automatically restore the Mixer to 762 * this Method and it will automatically restore the Mixer to
763 * the user configuration after the sound finished playing. 763 * the user configuration after the sound finished playing.
764 * 764 *
765 * Note: The onwership of \param snd is not transfered and playing 765 * Note: The onwership of \param snd is not transfered and playing
766 * is not started in this method. If 'snd' gets deleted before 766 * is not started in this method. If 'snd' gets deleted before
767 * playing is finished the volume doesn't get set back to 767 * playing is finished the volume doesn't get set back to
768 * the user preference! 768 * the user preference!
769 * 769 *
770 * \code 770 * \code
771 * static Sound snd("alarm"); 771 * static Sound snd("alarm");
772 * if(!snd.isFinished()) 772 * if(!snd.isFinished())
773 * return; 773 * return;
774 * 774 *
775 * changeMixerForAlarm( my_channel, "/dev/mixer", &snd ); 775 * changeMixerForAlarm( my_channel, "/dev/mixer", &snd );
776 * snd.play() 776 * snd.play()
777 * \endcode 777 * \endcode
778 * 778 *
779 * 779 *
780 * 780 *
781 * @param mixer The mixer number/channel to use 781 * @param mixer The mixer number/channel to use
782 * @param file The file name. If you convert from QString use QFile::encodeName 782 * @param file The file name. If you convert from QString use QFile::encodeName
783 * @param snd The sound to wait for finishing 783 * @param snd The sound to wait for finishing
784 * 784 *
785 */ 785 */
786void ODevice::changeMixerForAlarm( int mixer, const char* file, Sound *snd ) { 786void ODevice::changeMixerForAlarm( int mixer, const char* file, Sound *snd ) {
787#ifndef QT_NO_SOUND 787#ifndef QT_NO_SOUND
788 if (( d->m_sound = ::open ( file, O_RDWR )) >= 0 ) { 788 if (( d->m_sound = ::open ( file, O_RDWR )) >= 0 ) {
789 if ( ::ioctl ( d->m_sound, MIXER_READ( mixer ), &d->m_vol ) >= 0 ) { 789 if ( ::ioctl ( d->m_sound, MIXER_READ( mixer ), &d->m_vol ) >= 0 ) {
790 Config cfg ( "qpe" ); 790 Config cfg ( "qpe" );
791 cfg. setGroup ( "Volume" ); 791 cfg. setGroup ( "Volume" );
792 792
793 int volalarm = cfg. readNumEntry ( "AlarmPercent", 50 ); 793 int volalarm = cfg. readNumEntry ( "AlarmPercent", 50 );
794 if ( volalarm < 0 ) 794 if ( volalarm < 0 )
795 volalarm = 0; 795 volalarm = 0;
796 else if ( volalarm > 100 ) 796 else if ( volalarm > 100 )
797 volalarm = 100; 797 volalarm = 100;
798 volalarm |= ( volalarm << 8 ); 798 volalarm |= ( volalarm << 8 );
799 799
800 if ( ::ioctl ( d->m_sound, MIXER_WRITE( mixer ), &volalarm ) >= 0 ) 800 if ( ::ioctl ( d->m_sound, MIXER_WRITE( mixer ), &volalarm ) >= 0 )
801 register_qpe_sound_finished(snd, this, SLOT(playingStopped())); 801 register_qpe_sound_finished(snd, this, SLOT(playingStopped()));
802 } 802 }
803 d->m_mixer = mixer; 803 d->m_mixer = mixer;
804 } 804 }
805#endif 805#endif
806} 806}
807 807
808} 808}
809} 809}
diff --git a/libopie2/opiecore/device/odevice_abstractmobiledevice.cpp b/libopie2/opiecore/device/odevice_abstractmobiledevice.cpp
index f3f6af5..fe5864b 100644
--- a/libopie2/opiecore/device/odevice_abstractmobiledevice.cpp
+++ b/libopie2/opiecore/device/odevice_abstractmobiledevice.cpp
@@ -1,119 +1,120 @@
1/* 1/*
2                 This file is part of the Opie Project 2                 This file is part of the Opie Project
3              Copyright (C) 2004, 2005 Holger Hans Peter Freyther <freyther@handhelds.org> 3 Copyright (C) 2004, 2005 Holger Hans Peter Freyther <freyther@handhelds.org>
4 Copyright (C) 2004, 2005 Michael 'mickey' Lauer <mickeyl@handhelds.org> 4 =. Copyright (C) 2004, 2005 Michael 'Mickey' Lauer <mickey@Vanille.de>
5 Copyright (C) 2002, 2003 Robert Griebl <sandman@handhelds.org> 5 .=l. Copyright (C) 2002, 2003 Robert Griebl <sandman@handhelds.org>
6
7
8 =.
9 .=l.
10           .>+-= 6           .>+-=
11 _;:,     .>    :=|. This program is free software; you can 7 _;:,     .>    :=|. This program is free software; you can
12.> <`_,   >  .   <= redistribute it and/or modify it under 8.> <`_,   >  .   <= redistribute it and/or modify it under
13:`=1 )Y*s>-.--   : the terms of the GNU Library General Public 9:`=1 )Y*s>-.--   : the terms of the GNU Library General Public
14.="- .-=="i,     .._ License as published by the Free Software 10.="- .-=="i,     .._ License as published by the Free Software
15 - .   .-<_>     .<> Foundation; either version 2 of the License, 11 - .   .-<_>     .<> Foundation; version 2 of the License.
16     ._= =}       : or (at your option) any later version. 12     ._= =}       :
17    .%`+i>       _;_. 13    .%`+i>       _;_.
18    .i_,=:_.      -<s. This program is distributed in the hope that 14    .i_,=:_.      -<s. This program is distributed in the hope that
19     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY; 15     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
20    : ..    .:,     . . . without even the implied warranty of 16    : ..    .:,     . . . without even the implied warranty of
21    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A 17    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
22  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU 18  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
23..}^=.=       =       ; Library General Public License for more 19..}^=.=       =       ; Library General Public License for more
24++=   -.     .`     .: details. 20++=   -.     .`     .: details.
25 :     =  ...= . :.=- 21 :     =  ...= . :.=-
26 -.   .:....=;==+<; You should have received a copy of the GNU 22 -.   .:....=;==+<; You should have received a copy of the GNU
27  -_. . .   )=.  = Library General Public License along with 23  -_. . .   )=.  = Library General Public License along with
28    --        :-=` this library; see the file COPYING.LIB. 24    --        :-=` this library; see the file COPYING.LIB.
29 If not, write to the Free Software Foundation, 25 If not, write to the Free Software Foundation,
30 Inc., 59 Temple Place - Suite 330, 26 Inc., 59 Temple Place - Suite 330,
31 Boston, MA 02111-1307, USA. 27 Boston, MA 02111-1307, USA.
32*/ 28*/
33 29
34#include "odevice_abstractmobiledevice.h" 30#include "odevice_abstractmobiledevice.h"
35 31
32#include <qpe/qcopenvelope_qws.h>
33
36#include <sys/time.h> 34#include <sys/time.h>
37#include <sys/ioctl.h> 35#include <sys/ioctl.h>
38 36
39#include <time.h> 37#include <time.h>
40#include <fcntl.h> 38#include <fcntl.h>
41#include <unistd.h> 39#include <unistd.h>
42#include <stdlib.h> 40#include <stdlib.h>
43 41
44namespace Opie { 42namespace Opie {
45namespace Core { 43namespace Core {
46OAbstractMobileDevice::OAbstractMobileDevice() 44OAbstractMobileDevice::OAbstractMobileDevice()
47 : m_timeOut( 1500 ) 45 : m_timeOut( 1500 )
48{} 46{}
49 47
50/** 48/**
51 * @short Time to wait for the asynchronos APM implementation to suspend 49 * @short Time to wait for the asynchronos APM implementation to suspend
52 * 50 *
53 * Milli Seconds to wait before returning from the suspend method. 51 * Milli Seconds to wait before returning from the suspend method.
54 * This is needed due asynchrnonus implementations of the APM bios. 52 * This is needed due asynchrnonus implementations of the APM bios.
55 * 53 *
56 */ 54 */
57void OAbstractMobileDevice::setAPMTimeOut( int time ) { 55void OAbstractMobileDevice::setAPMTimeOut( int time ) {
58 m_timeOut = time; 56 m_timeOut = time;
59} 57}
60 58
61 59
62bool OAbstractMobileDevice::suspend() { 60bool OAbstractMobileDevice::suspend() {
63 if ( !isQWS( ) ) // only qwsserver is allowed to suspend 61 if ( !isQWS( ) ) // only qwsserver is allowed to suspend
64 return false; 62 return false;
65 63
66 bool res = false; 64 bool res = false;
67 ODevice::sendSuspendmsg(); 65
66 QCopEnvelope( "QPE/System", "aboutToSuspend()" );
68 67
69 struct timeval tvs, tvn; 68 struct timeval tvs, tvn;
70 ::gettimeofday ( &tvs, 0 ); 69 ::gettimeofday ( &tvs, 0 );
71 70
72 ::sync(); // flush fs caches 71 ::sync(); // flush fs caches
73 res = ( ::system ( "apm --suspend" ) == 0 ); 72 res = ( ::system ( "apm --suspend" ) == 0 );
74 73
75 // This is needed because some apm implementations are asynchronous and we 74 // This is needed because some apm implementations are asynchronous and we
76 // can not be sure when exactly the device is really suspended 75 // can not be sure when exactly the device is really suspended
77 // This can be deleted as soon as a stable familiar with a synchronous apm implementation exists. 76 // This can be deleted as soon as a stable familiar with a synchronous apm implementation exists.
78 77
79 if ( res ) { 78 if ( res ) {
80 do { // wait at most 1.5 sec: either suspend didn't work or the device resumed 79 do { // wait at most 1.5 sec: either suspend didn't work or the device resumed
81 ::usleep ( 200 * 1000 ); 80 ::usleep ( 200 * 1000 );
82 ::gettimeofday ( &tvn, 0 ); 81 ::gettimeofday ( &tvn, 0 );
83 } while ((( tvn. tv_sec - tvs. tv_sec ) * 1000 + ( tvn. tv_usec - tvs. tv_usec ) / 1000 ) < m_timeOut ); 82 } while ((( tvn. tv_sec - tvs. tv_sec ) * 1000 + ( tvn. tv_usec - tvs. tv_usec ) / 1000 ) < m_timeOut );
84 } 83 }
85 84
86 return res; 85 return res;
86
87 QCopEnvelope( "QPE/System", "returnFromSuspend()" );
87} 88}
88 89
89//#include <linux/fb.h> better not rely on kernel headers in userspace ... 90//#include <linux/fb.h> better not rely on kernel headers in userspace ...
90 91
91// _IO and friends are only defined in kernel headers ... 92// _IO and friends are only defined in kernel headers ...
92#define OD_IOC(dir,type,number,size) (( dir << 30 ) | ( type << 8 ) | ( number ) | ( size << 16 )) 93#define OD_IOC(dir,type,number,size) (( dir << 30 ) | ( type << 8 ) | ( number ) | ( size << 16 ))
93#define OD_IO(type,number) OD_IOC(0,type,number,0) 94#define OD_IO(type,number) OD_IOC(0,type,number,0)
94 95
95#define FBIOBLANK OD_IO( 'F', 0x11 ) // 0x4611 96#define FBIOBLANK OD_IO( 'F', 0x11 ) // 0x4611
96 97
97/* VESA Blanking Levels */ 98/* VESA Blanking Levels */
98#define VESA_NO_BLANKING 0 99#define VESA_NO_BLANKING 0
99#define VESA_VSYNC_SUSPEND 1 100#define VESA_VSYNC_SUSPEND 1
100#define VESA_HSYNC_SUSPEND 2 101#define VESA_HSYNC_SUSPEND 2
101#define VESA_POWERDOWN 3 102#define VESA_POWERDOWN 3
102 103
103bool OAbstractMobileDevice::setDisplayStatus ( bool on ) { 104bool OAbstractMobileDevice::setDisplayStatus ( bool on ) {
104 bool res = false; 105 bool res = false;
105 int fd; 106 int fd;
106 107
107#ifdef QT_QWS_DEVFS 108#ifdef QT_QWS_DEVFS
108 if (( fd = ::open ( "/dev/fb/0", O_RDWR )) >= 0 ) { 109 if (( fd = ::open ( "/dev/fb/0", O_RDWR )) >= 0 ) {
109#else 110#else
110 if (( fd = ::open ( "/dev/fb0", O_RDWR )) >= 0 ) { 111 if (( fd = ::open ( "/dev/fb0", O_RDWR )) >= 0 ) {
111#endif 112#endif
112 res = ( ::ioctl ( fd, FBIOBLANK, on ? VESA_NO_BLANKING : VESA_POWERDOWN ) == 0 ); 113 res = ( ::ioctl ( fd, FBIOBLANK, on ? VESA_NO_BLANKING : VESA_POWERDOWN ) == 0 );
113 ::close ( fd ); 114 ::close ( fd );
114 } 115 }
115 116
116 return res; 117 return res;
117} 118}
118} 119}
119} 120}
diff --git a/libopie2/opiecore/linux/linux.pro b/libopie2/opiecore/linux/linux.pro
index c396e59..c0c4f7f 100644
--- a/libopie2/opiecore/linux/linux.pro
+++ b/libopie2/opiecore/linux/linux.pro
@@ -1,10 +1,11 @@
1HEADERS += \ 1HEADERS += \
2 linux/ofilenotify.h \ 2 linux/ofilenotify.h \
3 linux/oinputsystem.h \ 3 linux/oinputsystem.h \
4 linux/opcmciasystem.h 4 linux/opcmciasystem.h
5 5
6SOURCES += \ 6SOURCES += \
7 linux/ofilenotify.cpp \ 7 linux/ofilenotify.cpp \
8 linux/oinputsystem.cpp \ 8 linux/oinputsystem.cpp \
9 linux/opcmciasystem.cpp 9 linux/opcmciasystem.cpp
10 10
11DEFINES += OPCMCIA_DEBUG=1
diff --git a/libopie2/opiecore/linux/opcmciasystem.cpp b/libopie2/opiecore/linux/opcmciasystem.cpp
index eae356e..445d903 100644
--- a/libopie2/opiecore/linux/opcmciasystem.cpp
+++ b/libopie2/opiecore/linux/opcmciasystem.cpp
@@ -1,309 +1,307 @@
1/* 1/*
2                 This file is part of the Opie Project 2                 This file is part of the Opie Project
3 =. (C) 2005 Michael 'Mickey' Lauer <mickey@Vanille.de> 3 =. (C) 2005 Michael 'Mickey' Lauer <mickey@Vanille.de>
4 .=l. 4 .=l.
5           .>+-= 5           .>+-=
6 _;:,     .>    :=|. This program is free software; you can 6 _;:,     .>    :=|. This program is free software; you can
7.> <`_,   >  .   <= redistribute it and/or modify it under 7.> <`_,   >  .   <= redistribute it and/or modify it under
8:`=1 )Y*s>-.--   : the terms of the GNU Library General Public 8:`=1 )Y*s>-.--   : the terms of the GNU Library General Public
9.="- .-=="i,     .._ License as published by the Free Software 9.="- .-=="i,     .._ License as published by the Free Software
10 - .   .-<_>     .<> Foundation; version 2 of the License. 10 - .   .-<_>     .<> Foundation; version 2 of the License.
11     ._= =}       : 11     ._= =}       :
12    .%`+i>       _;_. 12    .%`+i>       _;_.
13    .i_,=:_.      -<s. This program is distributed in the hope that 13    .i_,=:_.      -<s. This program is distributed in the hope that
14     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY; 14     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
15    : ..    .:,     . . . without even the implied warranty of 15    : ..    .:,     . . . without even the implied warranty of
16    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A 16    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
17  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU 17  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
18..}^=.=       =       ; Library General Public License for more 18..}^=.=       =       ; Library General Public License for more
19++=   -.     .`     .: details. 19++=   -.     .`     .: details.
20 :     =  ...= . :.=- 20 :     =  ...= . :.=-
21 -.   .:....=;==+<; You should have received a copy of the GNU 21 -.   .:....=;==+<; You should have received a copy of the GNU
22  -_. . .   )=.  = Library General Public License along with 22  -_. . .   )=.  = Library General Public License along with
23    --        :-=` this library; see the file COPYING.LIB. 23    --        :-=` this library; see the file COPYING.LIB.
24 If not, write to the Free Software Foundation, 24 If not, write to the Free Software Foundation,
25 Inc., 59 Temple Place - Suite 330, 25 Inc., 59 Temple Place - Suite 330,
26 Boston, MA 02111-1307, USA. 26 Boston, MA 02111-1307, USA.
27 27
28*/ 28*/
29 29
30#include "opcmciasystem.h" 30#include "opcmciasystem.h"
31using namespace Opie::Core; 31using namespace Opie::Core;
32 32
33/* OPIE */ 33/* OPIE */
34#include <opie2/odebug.h> 34#include <opie2/odebug.h>
35 35
36/* QT */ 36/* QT */
37#include <qfile.h> 37#include <qfile.h>
38#include <qtextstream.h> 38#include <qtextstream.h>
39 39
40/* STD */ 40/* STD */
41#include <errno.h> 41#include <errno.h>
42#include <fcntl.h> 42#include <fcntl.h>
43#include <string.h> 43#include <string.h>
44#include <stdlib.h> 44#include <stdlib.h>
45#include <sys/ioctl.h> 45#include <sys/ioctl.h>
46#include <sys/types.h> 46#include <sys/types.h>
47#include <sys/stat.h> 47#include <sys/stat.h>
48#include <unistd.h> 48#include <unistd.h>
49 49
50#define PROC_DEVICES "/proc/devices" 50#define PROC_DEVICES "/proc/devices"
51 51
52// #define OPCMCIA_DEBUG 1
53
54/*====================================================================================== 52/*======================================================================================
55 * OPcmciaSystem 53 * OPcmciaSystem
56 *======================================================================================*/ 54 *======================================================================================*/
57 55
58OPcmciaSystem* OPcmciaSystem::_instance = 0; 56OPcmciaSystem* OPcmciaSystem::_instance = 0;
59 57
60OPcmciaSystem::OPcmciaSystem() 58OPcmciaSystem::OPcmciaSystem()
61 :_major( 0 ) 59 :_major( 0 )
62{ 60{
63 qDebug( "OPcmciaSystem::OPcmciaSystem()" ); 61 qDebug( "OPcmciaSystem::OPcmciaSystem()" );
64 62
65 // get major node number out of /proc/devices 63 // get major node number out of /proc/devices
66 QFile procfile( PROC_DEVICES ); 64 QFile procfile( PROC_DEVICES );
67 if ( procfile.exists() && procfile.open( IO_ReadOnly ) ) 65 if ( procfile.exists() && procfile.open( IO_ReadOnly ) )
68 { 66 {
69 QTextStream devstream( &procfile ); 67 QTextStream devstream( &procfile );
70 devstream.readLine(); // skip header 68 devstream.readLine(); // skip header
71 while ( !devstream.atEnd() && !_major ) 69 while ( !devstream.atEnd() && !_major )
72 { 70 {
73 int nodenumber; 71 int nodenumber;
74 QString driver; 72 QString driver;
75 devstream >> nodenumber >> driver; 73 devstream >> nodenumber >> driver;
76 if ( driver == "pcmcia" ) 74 if ( driver == "pcmcia" )
77 { 75 {
78 qDebug( "OPcmciaSystem::OPcmciaSystem(): gotcha! pcmcia node number = %d", nodenumber ); 76 qDebug( "OPcmciaSystem::OPcmciaSystem(): gotcha! pcmcia node number = %d", nodenumber );
79 _major = nodenumber; 77 _major = nodenumber;
80 break; 78 break;
81 } 79 }
82 } 80 }
83 } 81 }
84 else 82 else
85 { 83 {
86 qWarning( "OPcmciaSystem::OPcmciaSystem() - can't open /proc/devices - continuing with limited functionality." ); 84 qWarning( "OPcmciaSystem::OPcmciaSystem() - can't open /proc/devices - continuing with limited functionality." );
87 } 85 }
88 86
89 synchronize(); 87 synchronize();
90} 88}
91 89
92void OPcmciaSystem::synchronize() 90void OPcmciaSystem::synchronize()
93{ 91{
94 qDebug( "OPcmciaSystem::synchronize()" ); 92 qDebug( "OPcmciaSystem::synchronize()" );
95 _interfaces.clear(); 93 _interfaces.clear();
96 94
97 //NOTE: We _could_ use ioctl's here as well, however we want to know if 95 //NOTE: We _could_ use ioctl's here as well, however we want to know if
98 // the card is recognized by the cardmgr (hence has a valid binding) 96 // the card is recognized by the cardmgr (hence has a valid binding)
99 // If it is not recognized yet, userland may want to provide a configuration dialog 97 // If it is not recognized yet, userland may want to provide a configuration dialog
100 //TODO: Revise for pcmciautils 98 //TODO: Revise for pcmciautils
101 99
102 QString fileName; 100 QString fileName;
103 if ( QFile::exists( "/var/run/stab" ) ) { fileName = "/var/run/stab"; } 101 if ( QFile::exists( "/var/run/stab" ) ) { fileName = "/var/run/stab"; }
104 else if ( QFile::exists( "/var/state/pcmcia/stab" ) ) { fileName = "/var/state/pcmcia/stab"; } 102 else if ( QFile::exists( "/var/state/pcmcia/stab" ) ) { fileName = "/var/state/pcmcia/stab"; }
105 else { fileName = "/var/lib/pcmcia/stab"; } 103 else { fileName = "/var/lib/pcmcia/stab"; }
106 QFile cardinfofile( fileName ); 104 QFile cardinfofile( fileName );
107 if ( !cardinfofile.exists() || !cardinfofile.open( IO_ReadOnly ) ) 105 if ( !cardinfofile.exists() || !cardinfofile.open( IO_ReadOnly ) )
108 { 106 {
109 qWarning( "pcmcia info file not found or unaccessible" ); 107 qWarning( "pcmcia info file not found or unaccessible" );
110 return; 108 return;
111 } 109 }
112 QTextStream cardinfo( &cardinfofile ); 110 QTextStream cardinfo( &cardinfofile );
113 while ( !cardinfo.atEnd() ) 111 while ( !cardinfo.atEnd() )
114 { 112 {
115 QString strSocket; 113 QString strSocket;
116 int numSocket; 114 int numSocket;
117 char colon; 115 char colon;
118 QString cardName; 116 QString cardName;
119 cardinfo >> strSocket >> numSocket >> colon; 117 cardinfo >> strSocket >> numSocket >> colon;
120 cardName = cardinfo.readLine().stripWhiteSpace(); 118 cardName = cardinfo.readLine().stripWhiteSpace();
121 qDebug( "strSocket = '%s', numSocket = '%d', colon = '%c', cardName = '%s'", (const char*) strSocket, numSocket, colon, ( const char*) cardName ); 119 qDebug( "strSocket = '%s', numSocket = '%d', colon = '%c', cardName = '%s'", (const char*) strSocket, numSocket, colon, ( const char*) cardName );
122 if ( strSocket == "Socket" && colon == ':' ) 120 if ( strSocket == "Socket" && colon == ':' )
123 { 121 {
124 _interfaces.append( new OPcmciaSocket( _major, numSocket, this, (const char*) cardName ) ); 122 _interfaces.append( new OPcmciaSocket( _major, numSocket, this, (const char*) cardName ) );
125 } 123 }
126 else 124 else
127 { 125 {
128 continue; 126 continue;
129 } 127 }
130 } 128 }
131} 129}
132 130
133 131
134int OPcmciaSystem::count() const 132int OPcmciaSystem::count() const
135{ 133{
136 return _interfaces.count(); 134 return _interfaces.count();
137} 135}
138 136
139 137
140int OPcmciaSystem::cardCount() const 138int OPcmciaSystem::cardCount() const
141{ 139{
142 int nonEmpty = 0; 140 int nonEmpty = 0;
143 OPcmciaSystem::CardIterator it = iterator(); 141 OPcmciaSystem::CardIterator it = iterator();
144 while ( it.current() ) 142 while ( it.current() )
145 { 143 {
146 if ( !it.current()->isEmpty() ) nonEmpty++; 144 if ( !it.current()->isEmpty() ) nonEmpty++;
147 ++it; 145 ++it;
148 } 146 }
149 return nonEmpty; 147 return nonEmpty;
150} 148}
151 149
152 150
153OPcmciaSocket* OPcmciaSystem::socket( unsigned int number ) 151OPcmciaSocket* OPcmciaSystem::socket( unsigned int number )
154{ 152{
155 return _interfaces.at( number ); 153 return _interfaces.at( number );
156} 154}
157 155
158 156
159OPcmciaSystem* OPcmciaSystem::instance() 157OPcmciaSystem* OPcmciaSystem::instance()
160{ 158{
161 if ( !_instance ) _instance = new OPcmciaSystem(); 159 if ( !_instance ) _instance = new OPcmciaSystem();
162 return _instance; 160 return _instance;
163} 161}
164 162
165 163
166OPcmciaSystem::CardIterator OPcmciaSystem::iterator() const 164OPcmciaSystem::CardIterator OPcmciaSystem::iterator() const
167{ 165{
168 return OPcmciaSystem::CardIterator( _interfaces ); 166 return OPcmciaSystem::CardIterator( _interfaces );
169} 167}
170 168
171 169
172/*====================================================================================== 170/*======================================================================================
173 * OPcmciaSocket 171 * OPcmciaSocket
174 *======================================================================================*/ 172 *======================================================================================*/
175 173
176OPcmciaSocket::OPcmciaSocket( int major, int socket, QObject* parent, const char* name ) 174OPcmciaSocket::OPcmciaSocket( int major, int socket, QObject* parent, const char* name )
177 :QObject( parent, name ), _major( major ), _socket( socket ) 175 :QObject( parent, name ), _major( major ), _socket( socket )
178{ 176{
179 qDebug( "OPcmciaSocket::OPcmciaSocket()" ); 177 qDebug( "OPcmciaSocket::OPcmciaSocket()" );
180 init(); 178 init();
181} 179}
182 180
183 181
184OPcmciaSocket::~OPcmciaSocket() 182OPcmciaSocket::~OPcmciaSocket()
185{ 183{
186 qDebug( "OPcmciaSocket::~OPcmciaSocket()" ); 184 qDebug( "OPcmciaSocket::~OPcmciaSocket()" );
187 cleanup(); 185 cleanup();
188} 186}
189 187
190 188
191/* internal */ void OPcmciaSocket::init() 189/* internal */ void OPcmciaSocket::init()
192{ 190{
193 // open control socket and gather file descriptor 191 // open control socket and gather file descriptor
194 if ( _major ) 192 if ( _major )
195 { 193 {
196 dev_t dev = makedev( _major, _socket ); 194 dev_t dev = makedev( _major, _socket );
197 195
198#ifdef OPCMCIA_DEBUG 196#ifdef OPCMCIA_DEBUG
199 QString filename = "/tmp/opcmciasystem-debug"; 197 QString filename = "/tmp/opcmciasystem-debug";
200 if ( QFile::exists( filename ) ) 198 if ( QFile::exists( filename ) )
201#else 199#else
202 QString filename = QString().sprintf( "/tmp/opcmciasystem-%d", ::getpid() ); 200 QString filename = QString().sprintf( "/tmp/opcmciasystem-%d", ::getpid() );
203 if ( ::mknod( (const char*) filename, ( S_IFCHR|S_IREAD|S_IWRITE ), dev ) == 0 ) 201 if ( ::mknod( (const char*) filename, ( S_IFCHR|S_IREAD|S_IWRITE ), dev ) == 0 )
204#endif 202#endif
205 { 203 {
206 _fd = ::open( (const char*) filename, O_RDONLY); 204 _fd = ::open( (const char*) filename, O_RDONLY);
207 if ( !_fd ) 205 if ( !_fd )
208 { 206 {
209 qWarning( "OPcmciaSocket::init() - can't open control socket (%s)", strerror( errno ) ); 207 qWarning( "OPcmciaSocket::init() - can't open control socket (%s)", strerror( errno ) );
210 } 208 }
211 else 209 else
212 { 210 {
213 ::unlink( (const char*) filename ); 211 ::unlink( (const char*) filename );
214 } 212 }
215 } 213 }
216 else 214 else
217 { 215 {
218 qWarning( "OPcmciaSocket::init() - can't create device node '%s' (%s)", (const char*) filename, strerror( errno ) ); 216 qWarning( "OPcmciaSocket::init() - can't create device node '%s' (%s)", (const char*) filename, strerror( errno ) );
219 } 217 }
220 } 218 }
221} 219}
222 220
223/* internal */ void OPcmciaSocket::cleanup() 221/* internal */ void OPcmciaSocket::cleanup()
224{ 222{
225 // close control socket 223 // close control socket
226} 224}
227 225
228/* internal */ bool OPcmciaSocket::getTuple( cisdata_t tuple ) const 226/* internal */ bool OPcmciaSocket::getTuple( cisdata_t tuple ) const
229{ 227{
230 _ioctlarg.tuple.DesiredTuple = tuple; 228 _ioctlarg.tuple.DesiredTuple = tuple;
231 _ioctlarg.tuple.Attributes = TUPLE_RETURN_COMMON; 229 _ioctlarg.tuple.Attributes = TUPLE_RETURN_COMMON;
232 _ioctlarg.tuple.TupleOffset = 0; 230 _ioctlarg.tuple.TupleOffset = 0;
233 231
234 int result; 232 int result;
235 result = ::ioctl(_fd, DS_GET_FIRST_TUPLE, &_ioctlarg); 233 result = ::ioctl(_fd, DS_GET_FIRST_TUPLE, &_ioctlarg);
236 if ( result != 0 ) 234 if ( result != 0 )
237 { 235 {
238 qWarning( "OPcmciaSocket::getTuple() - DS_GET_FIRST_TUPLE failed (%s)", strerror( errno ) ); 236 qWarning( "OPcmciaSocket::getTuple() - DS_GET_FIRST_TUPLE failed (%s)", strerror( errno ) );
239 return false; 237 return false;
240 } 238 }
241 239
242 result = ::ioctl(_fd, DS_GET_TUPLE_DATA, &_ioctlarg); 240 result = ::ioctl(_fd, DS_GET_TUPLE_DATA, &_ioctlarg);
243 if ( result != 0 ) 241 if ( result != 0 )
244 { 242 {
245 qWarning( "OPcmciaSocket::getTuple() - DS_GET_TUPLE_DATA failed (%s)", strerror( errno ) ); 243 qWarning( "OPcmciaSocket::getTuple() - DS_GET_TUPLE_DATA failed (%s)", strerror( errno ) );
246 return false; 244 return false;
247 } 245 }
248 246
249 result = ::ioctl( _fd, DS_PARSE_TUPLE, &_ioctlarg ); 247 result = ::ioctl( _fd, DS_PARSE_TUPLE, &_ioctlarg );
250 if ( result != 0 ) 248 if ( result != 0 )
251 { 249 {
252 qWarning( "OPcmciaSocket::getTuple() - DS_PARSE_TUPLE failed (%s)", strerror( errno ) ); 250 qWarning( "OPcmciaSocket::getTuple() - DS_PARSE_TUPLE failed (%s)", strerror( errno ) );
253 return false; 251 return false;
254 } 252 }
255 253
256 return true; 254 return true;
257} 255}
258 256
259 257
260int OPcmciaSocket::number() const 258int OPcmciaSocket::number() const
261{ 259{
262 return _socket; 260 return _socket;
263} 261}
264 262
265 263
266QString OPcmciaSocket::identity() const 264QString OPcmciaSocket::identity() const
267{ 265{
268 return ( strcmp( name(), "empty" ) == 0 ) ? "<Empty Socket>" : name(); 266 return ( strcmp( name(), "empty" ) == 0 ) ? "<Empty Socket>" : name();
269} 267}
270 268
271 269
272const OPcmciaSocket::OPcmciaSocketCardStatus OPcmciaSocket::status() const 270const OPcmciaSocket::OPcmciaSocketCardStatus OPcmciaSocket::status() const
273{ 271{
274 cs_status_t cs_status; 272 cs_status_t cs_status;
275 cs_status.Function = 0; 273 cs_status.Function = 0;
276 int result = ::ioctl( _fd, DS_GET_STATUS, &cs_status ); 274 int result = ::ioctl( _fd, DS_GET_STATUS, &cs_status );
277 if ( result != 0 ) 275 if ( result != 0 )
278 { 276 {
279 qWarning( "OPcmciaSocket::status() - DS_GET_STATUS failed (%s)", strerror( errno ) ); 277 qWarning( "OPcmciaSocket::status() - DS_GET_STATUS failed (%s)", strerror( errno ) );
280 return Unknown; 278 return Unknown;
281 } 279 }
282 else 280 else
283 { 281 {
284 qDebug( " card status = 0x%08x", cs_status.CardState ); 282 qDebug( " card status = 0x%08x", cs_status.CardState );
285 qDebug( " socket status = 0x%08x", cs_status.SocketState ); 283 qDebug( " socket status = 0x%08x", cs_status.SocketState );
286 return (OPcmciaSocket::OPcmciaSocketCardStatus) (cs_status.CardState + cs_status.SocketState); 284 return (OPcmciaSocket::OPcmciaSocketCardStatus) (cs_status.CardState + cs_status.SocketState);
287 } 285 }
288} 286}
289 287
290 288
291bool OPcmciaSocket::isUnsupported() const 289bool OPcmciaSocket::isUnsupported() const
292{ 290{
293 return ( strcmp( name(), "unsupported card" ) == 0 ); 291 return ( strcmp( name(), "unsupported card" ) == 0 );
294} 292}
295 293
296 294
297bool OPcmciaSocket::isEmpty() const 295bool OPcmciaSocket::isEmpty() const
298{ 296{
299 return ! status() && ( Occupied || OccupiedCardBus ); 297 return ! status() && ( Occupied || OccupiedCardBus );
300} 298}
301 299
302 300
303bool OPcmciaSocket::isSuspended() const 301bool OPcmciaSocket::isSuspended() const
304{ 302{
305 return status() && Suspended; 303 return status() && Suspended;
306} 304}
307 305
308 306
309bool OPcmciaSocket::eject() 307bool OPcmciaSocket::eject()