summaryrefslogtreecommitdiff
path: root/libopie2
Unidiff
Diffstat (limited to 'libopie2') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opiecore/device/odevice.cpp50
-rw-r--r--libopie2/opiecore/device/odevice.h43
-rw-r--r--libopie2/opiecore/device/odevice_simpad.cpp43
-rw-r--r--libopie2/opiecore/device/odevice_zaurus.cpp43
4 files changed, 94 insertions, 85 deletions
diff --git a/libopie2/opiecore/device/odevice.cpp b/libopie2/opiecore/device/odevice.cpp
index 72b9ac7..7d67efe 100644
--- a/libopie2/opiecore/device/odevice.cpp
+++ b/libopie2/opiecore/device/odevice.cpp
@@ -1,48 +1,48 @@
1/* 1/*
2                 This file is part of the Opie Project 2 This file is part of the Opie Project
3              Copyright (C) The Opie Team <opie-devel@handhelds.org> 3 Copyright (C) The Opie Team <opie-devel@handhelds.org>
4 =. 4 =.
5 .=l. 5 .=l.
6           .>+-= 6 .>+-=
7 _;:,     .>    :=|. This program is free software; you can 7_;:, .> :=|. This program is free software; you can
8.> <`_,   >  .   <= redistribute it and/or modify it under 8.> <`_, > . <= redistribute it and/or modify it under
9:`=1 )Y*s>-.--   : the terms of the GNU Library General Public 9:`=1 )Y*s>-.-- : the terms of the GNU Library General Public
10.="- .-=="i,     .._ License as published by the Free Software 10.="- .-=="i, .._ License as published by the Free Software
11 - .   .-<_>     .<> Foundation; either version 2 of the License, 11- . .-<_> .<> Foundation; either version 2 of the License,
12     ._= =}       : or (at your option) any later version. 12 ._= =} : or (at your option) any later version.
13    .%`+i>       _;_. 13 .%`+i> _;_.
14    .i_,=:_.      -<s. This program is distributed in the hope that 14 .i_,=:_. -<s. This program is distributed in the hope that
15     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY; 15 + . -:. = it will be useful, but WITHOUT ANY WARRANTY;
16    : ..    .:,     . . . without even the implied warranty of 16 : .. .:, . . . without even the implied warranty of
17    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A 17 =_ + =;=|` MERCHANTABILITY or FITNESS FOR A
18  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU 18 _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU
19..}^=.=       =       ; Library General Public License for more 19..}^=.= = ; Library General Public License for more
20++=   -.     .`     .: details. 20++= -. .` .: details.
21 :     =  ...= . :.=- 21: = ...= . :.=-
22 -.   .:....=;==+<; You should have received a copy of the GNU 22-. .:....=;==+<; You should have received a copy of the GNU
23  -_. . .   )=.  = Library General Public License along with 23 -_. . . )=. = Library General Public License along with
24    --        :-=` this library; see the file COPYING.LIB. 24 -- :-=` this library; see the file COPYING.LIB.
25 If not, write to the Free Software Foundation, 25 If not, write to the Free Software Foundation,
26 Inc., 59 Temple Place - Suite 330, 26 Inc., 59 Temple Place - Suite 330,
27 Boston, MA 02111-1307, USA. 27 Boston, MA 02111-1307, USA.
28*/ 28*/
29 29
30#include "odevice_ipaq.h" 30#include "odevice_ipaq.h"
31#include "odevice_jornada.h" 31#include "odevice_jornada.h"
32#include "odevice_ramses.h" 32#include "odevice_ramses.h"
33#include "odevice_simpad.h" 33#include "odevice_simpad.h"
34#include "odevice_yopy.h" 34#include "odevice_yopy.h"
35#include "odevice_zaurus.h" 35#include "odevice_zaurus.h"
36 36
37/* QT */ 37/* QT */
38#include <qapplication.h> 38#include <qapplication.h>
39#include <qfile.h> 39#include <qfile.h>
40#include <qtextstream.h> 40#include <qtextstream.h>
41#include <qwindowsystem_qws.h> 41#include <qwindowsystem_qws.h>
42 42
43/* OPIE */ 43/* OPIE */
44#include <qpe/config.h> 44#include <qpe/config.h>
45#include <qpe/resource.h> 45#include <qpe/resource.h>
46#include <qpe/sound.h> 46#include <qpe/sound.h>
47#include <qpe/qcopenvelope_qws.h> 47#include <qpe/qcopenvelope_qws.h>
48 48
@@ -165,49 +165,50 @@ bool ODevice::setSoftSuspend ( bool /*soft*/ )
165 165
166#define APM_IOC_SUSPEND OD_IO( 'A', 2 ) 166#define APM_IOC_SUSPEND OD_IO( 'A', 2 )
167 167
168/** 168/**
169* This method will try to suspend the device 169* This method will try to suspend the device
170* It only works if the user is the QWS Server and the apm application 170* It only works if the user is the QWS Server and the apm application
171* is installed. 171* is installed.
172* It tries to suspend and then waits some time cause some distributions 172* It tries to suspend and then waits some time cause some distributions
173* do have asynchronus apm implementations. 173* do have asynchronus apm implementations.
174* This method will either fail and return false or it'll suspend the 174* This method will either fail and return false or it'll suspend the
175* device and return once the device got woken up 175* device and return once the device got woken up
176* 176*
177* @return if the device got suspended 177* @return if the device got suspended
178*/ 178*/
179bool ODevice::suspend() 179bool ODevice::suspend()
180{ 180{
181 qDebug("ODevice::suspend"); 181 qDebug("ODevice::suspend");
182 if ( !isQWS( ) ) // only qwsserver is allowed to suspend 182 if ( !isQWS( ) ) // only qwsserver is allowed to suspend
183 return false; 183 return false;
184 184
185 if ( d->m_model == Model_Unknown ) // better don't suspend in qvfb / on unkown devices 185 if ( d->m_model == Model_Unknown ) // better don't suspend in qvfb / on unkown devices
186 return false; 186 return false;
187 187
188 bool res = false; 188 bool res = false;
189 189 ODevice::sendSuspendmsg();
190
190 struct timeval tvs, tvn; 191 struct timeval tvs, tvn;
191 ::gettimeofday ( &tvs, 0 ); 192 ::gettimeofday ( &tvs, 0 );
192 193
193 ::sync(); // flush fs caches 194 ::sync(); // flush fs caches
194 res = ( ::system ( "apm --suspend" ) == 0 ); 195 res = ( ::system ( "apm --suspend" ) == 0 );
195 196
196 // This is needed because the iPAQ apm implementation is asynchronous and we 197 // This is needed because the iPAQ apm implementation is asynchronous and we
197 // can not be sure when exactly the device is really suspended 198 // can not be sure when exactly the device is really suspended
198 // This can be deleted as soon as a stable familiar with a synchronous apm implementation exists. 199 // This can be deleted as soon as a stable familiar with a synchronous apm implementation exists.
199 200
200 if ( res ) { 201 if ( res ) {
201 do { // wait at most 1.5 sec: either suspend didn't work or the device resumed 202 do { // wait at most 1.5 sec: either suspend didn't work or the device resumed
202 ::usleep ( 200 * 1000 ); 203 ::usleep ( 200 * 1000 );
203 ::gettimeofday ( &tvn, 0 ); 204 ::gettimeofday ( &tvn, 0 );
204 } while ((( tvn. tv_sec - tvs. tv_sec ) * 1000 + ( tvn. tv_usec - tvs. tv_usec ) / 1000 ) < 1500 ); 205 } while ((( tvn. tv_sec - tvs. tv_sec ) * 1000 + ( tvn. tv_usec - tvs. tv_usec ) / 1000 ) < 1500 );
205 } 206 }
206 207
207 return res; 208 return res;
208} 209}
209 210
210//#include <linux/fb.h> better not rely on kernel headers in userspace ... 211//#include <linux/fb.h> better not rely on kernel headers in userspace ...
211 212
212#define FBIOBLANK OD_IO( 'F', 0x11 ) // 0x4611 213#define FBIOBLANK OD_IO( 'F', 0x11 ) // 0x4611
213 214
@@ -599,24 +600,29 @@ void ODevice::remapPressedAction ( int button, const OQCopMessage &action )
599} 600}
600 601
601void ODevice::remapHeldAction ( int button, const OQCopMessage &action ) 602void ODevice::remapHeldAction ( int button, const OQCopMessage &action )
602{ 603{
603 initButtons(); 604 initButtons();
604 605
605 if ( button >= (int) d->m_buttons->count()) 606 if ( button >= (int) d->m_buttons->count())
606 return; 607 return;
607 608
608 ODeviceButton &b = ( *d->m_buttons ) [button]; 609 ODeviceButton &b = ( *d->m_buttons ) [button];
609 b. setHeldAction ( action ); 610 b. setHeldAction ( action );
610 611
611 Config buttonFile ( "ButtonSettings" ); 612 Config buttonFile ( "ButtonSettings" );
612 buttonFile. setGroup ( "Button" + QString::number ( button )); 613 buttonFile. setGroup ( "Button" + QString::number ( button ));
613 buttonFile. writeEntry ( "HeldActionChannel", (const char *) b. heldAction(). channel()); 614 buttonFile. writeEntry ( "HeldActionChannel", (const char *) b. heldAction(). channel());
614 buttonFile. writeEntry ( "HeldActionMessage", (const char *) b. heldAction(). message()); 615 buttonFile. writeEntry ( "HeldActionMessage", (const char *) b. heldAction(). message());
615 616
616 //buttonFile. writeEntry ( "HeldActionArgs", decodeBase64 ( b. heldAction(). data())); 617 //buttonFile. writeEntry ( "HeldActionArgs", decodeBase64 ( b. heldAction(). data()));
617 618
618 QCopEnvelope ( "QPE/System", "deviceButtonMappingChanged()" ); 619 QCopEnvelope ( "QPE/System", "deviceButtonMappingChanged()" );
619} 620}
620void ODevice::virtual_hook(int, void* ){ 621void ODevice::virtual_hook(int, void* ){
621 622
622} 623}
624
625void ODevice::sendSuspendmsg()
626{
627 QCopEnvelope ( "QPE/System", "aboutSuspend()" );
628}
diff --git a/libopie2/opiecore/device/odevice.h b/libopie2/opiecore/device/odevice.h
index 791ccb3..bccb449 100644
--- a/libopie2/opiecore/device/odevice.h
+++ b/libopie2/opiecore/device/odevice.h
@@ -1,48 +1,48 @@
1/* 1/*
2                 This file is part of the Opie Project 2 This file is part of the Opie Project
3              Copyright (C) The Opie Team <opie-devel@handhelds.org> 3 Copyright (C) The Opie Team <opie-devel@handhelds.org>
4 =. 4 =.
5 .=l. 5 .=l.
6           .>+-= 6 .>+-=
7 _;:,     .>    :=|. This program is free software; you can 7_;:, .> :=|. This program is free software; you can
8.> <`_,   >  .   <= redistribute it and/or modify it under 8.> <`_, > . <= redistribute it and/or modify it under
9:`=1 )Y*s>-.--   : the terms of the GNU Library General Public 9:`=1 )Y*s>-.-- : the terms of the GNU Library General Public
10.="- .-=="i,     .._ License as published by the Free Software 10.="- .-=="i, .._ License as published by the Free Software
11 - .   .-<_>     .<> Foundation; either version 2 of the License, 11- . .-<_> .<> Foundation; either version 2 of the License,
12     ._= =}       : or (at your option) any later version. 12 ._= =} : or (at your option) any later version.
13    .%`+i>       _;_. 13 .%`+i> _;_.
14    .i_,=:_.      -<s. This program is distributed in the hope that 14 .i_,=:_. -<s. This program is distributed in the hope that
15     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY; 15 + . -:. = it will be useful, but WITHOUT ANY WARRANTY;
16    : ..    .:,     . . . without even the implied warranty of 16 : .. .:, . . . without even the implied warranty of
17    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A 17 =_ + =;=|` MERCHANTABILITY or FITNESS FOR A
18  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU 18 _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU
19..}^=.=       =       ; Library General Public License for more 19..}^=.= = ; Library General Public License for more
20++=   -.     .`     .: details. 20++= -. .` .: details.
21 :     =  ...= . :.=- 21: = ...= . :.=-
22 -.   .:....=;==+<; You should have received a copy of the GNU 22-. .:....=;==+<; You should have received a copy of the GNU
23  -_. . .   )=.  = Library General Public License along with 23 -_. . . )=. = Library General Public License along with
24    --        :-=` this library; see the file COPYING.LIB. 24 -- :-=` this library; see the file COPYING.LIB.
25 If not, write to the Free Software Foundation, 25 If not, write to the Free Software Foundation,
26 Inc., 59 Temple Place - Suite 330, 26 Inc., 59 Temple Place - Suite 330,
27 Boston, MA 02111-1307, USA. 27 Boston, MA 02111-1307, USA.
28*/ 28*/
29 29
30#ifndef ODEVICE_H_ 30#ifndef ODEVICE_H_
31#define ODEVICE_H_ 31#define ODEVICE_H_
32 32
33/* OPIE */ 33/* OPIE */
34#include <opie2/odevicebutton.h> 34#include <opie2/odevicebutton.h>
35#include <qpe/qpeapplication.h> /* for Transformation enum.. */ 35#include <qpe/qpeapplication.h> /* for Transformation enum.. */
36 36
37/* QT */ 37/* QT */
38#include <qnamespace.h> 38#include <qnamespace.h>
39#include <qobject.h> 39#include <qobject.h>
40#include <qstring.h> 40#include <qstring.h>
41#include <qstrlist.h> 41#include <qstrlist.h>
42 42
43namespace Opie 43namespace Opie
44{ 44{
45 class ODeviceData; 45 class ODeviceData;
46/** 46/**
47 * The available devices 47 * The available devices
48 */ 48 */
@@ -160,48 +160,49 @@ enum OHingeStatus {
160}; 160};
161 161
162/** 162/**
163 * A singleton which gives informations about device specefic option 163 * A singleton which gives informations about device specefic option
164 * like the Hardware used, LEDs, the Base Distribution and 164 * like the Hardware used, LEDs, the Base Distribution and
165 * hardware key mappings. 165 * hardware key mappings.
166 * 166 *
167 * @short A small class for device specefic options 167 * @short A small class for device specefic options
168 * @see QObject 168 * @see QObject
169 * @author Robert Griebl 169 * @author Robert Griebl
170 * @version 1.0 170 * @version 1.0
171 */ 171 */
172class ODevice : public QObject 172class ODevice : public QObject
173{ 173{
174 Q_OBJECT 174 Q_OBJECT
175 175
176private: 176private:
177 /* disable copy */ 177 /* disable copy */
178 ODevice ( const ODevice & ); 178 ODevice ( const ODevice & );
179 179
180protected: 180protected:
181 ODevice(); 181 ODevice();
182 virtual void init(); 182 virtual void init();
183 virtual void initButtons(); 183 virtual void initButtons();
184 static void sendSuspendmsg();
184 185
185 ODeviceData *d; 186 ODeviceData *d;
186 187
187public: 188public:
188 // sandman do we want to allow destructions? -zecke? 189 // sandman do we want to allow destructions? -zecke?
189 virtual ~ODevice(); 190 virtual ~ODevice();
190 191
191 static ODevice *inst(); 192 static ODevice *inst();
192 193
193 // information 194 // information
194 195
195 QString modelString() const; 196 QString modelString() const;
196 OModel model() const; 197 OModel model() const;
197 inline OModel series() const { return (OModel) ( model() & Model_Series_Mask ); } 198 inline OModel series() const { return (OModel) ( model() & Model_Series_Mask ); }
198 199
199 QString vendorString() const; 200 QString vendorString() const;
200 OVendor vendor() const; 201 OVendor vendor() const;
201 202
202 QString systemString() const; 203 QString systemString() const;
203 OSystem system() const; 204 OSystem system() const;
204 205
205 QString systemVersionString() const; 206 QString systemVersionString() const;
206 207
207 virtual Transformation rotation() const; 208 virtual Transformation rotation() const;
diff --git a/libopie2/opiecore/device/odevice_simpad.cpp b/libopie2/opiecore/device/odevice_simpad.cpp
index 4397b78..31b9297 100644
--- a/libopie2/opiecore/device/odevice_simpad.cpp
+++ b/libopie2/opiecore/device/odevice_simpad.cpp
@@ -1,48 +1,48 @@
1/* 1/*
2                 This file is part of the Opie Project 2 This file is part of the Opie Project
3              Copyright (C) The Opie Team <opie-devel@handhelds.org> 3 Copyright (C) The Opie Team <opie-devel@handhelds.org>
4 =. 4 =.
5 .=l. 5 .=l.
6           .>+-= 6 .>+-=
7 _;:,     .>    :=|. This program is free software; you can 7_;:, .> :=|. This program is free software; you can
8.> <`_,   >  .   <= redistribute it and/or modify it under 8.> <`_, > . <= redistribute it and/or modify it under
9:`=1 )Y*s>-.--   : the terms of the GNU Library General Public 9:`=1 )Y*s>-.-- : the terms of the GNU Library General Public
10.="- .-=="i,     .._ License as published by the Free Software 10.="- .-=="i, .._ License as published by the Free Software
11 - .   .-<_>     .<> Foundation; either version 2 of the License, 11- . .-<_> .<> Foundation; either version 2 of the License,
12     ._= =}       : or (at your option) any later version. 12 ._= =} : or (at your option) any later version.
13    .%`+i>       _;_. 13 .%`+i> _;_.
14    .i_,=:_.      -<s. This program is distributed in the hope that 14 .i_,=:_. -<s. This program is distributed in the hope that
15     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY; 15 + . -:. = it will be useful, but WITHOUT ANY WARRANTY;
16    : ..    .:,     . . . without even the implied warranty of 16 : .. .:, . . . without even the implied warranty of
17    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A 17 =_ + =;=|` MERCHANTABILITY or FITNESS FOR A
18  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU 18 _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU
19..}^=.=       =       ; Library General Public License for more 19..}^=.= = ; Library General Public License for more
20++=   -.     .`     .: details. 20++= -. .` .: details.
21 :     =  ...= . :.=- 21: = ...= . :.=-
22 -.   .:....=;==+<; You should have received a copy of the GNU 22-. .:....=;==+<; You should have received a copy of the GNU
23  -_. . .   )=.  = Library General Public License along with 23 -_. . . )=. = Library General Public License along with
24    --        :-=` this library; see the file COPYING.LIB. 24 -- :-=` this library; see the file COPYING.LIB.
25 If not, write to the Free Software Foundation, 25 If not, write to the Free Software Foundation,
26 Inc., 59 Temple Place - Suite 330, 26 Inc., 59 Temple Place - Suite 330,
27 Boston, MA 02111-1307, USA. 27 Boston, MA 02111-1307, USA.
28*/ 28*/
29 29
30#include "odevice_simpad.h" 30#include "odevice_simpad.h"
31 31
32/* QT */ 32/* QT */
33#include <qapplication.h> 33#include <qapplication.h>
34#include <qfile.h> 34#include <qfile.h>
35#include <qtextstream.h> 35#include <qtextstream.h>
36#include <qwindowsystem_qws.h> 36#include <qwindowsystem_qws.h>
37 37
38/* OPIE */ 38/* OPIE */
39#include <qpe/config.h> 39#include <qpe/config.h>
40#include <qpe/resource.h> 40#include <qpe/resource.h>
41#include <qpe/sound.h> 41#include <qpe/sound.h>
42#include <qpe/qcopenvelope_qws.h> 42#include <qpe/qcopenvelope_qws.h>
43 43
44/* STD */ 44/* STD */
45#include <fcntl.h> 45#include <fcntl.h>
46#include <math.h> 46#include <math.h>
47#include <stdlib.h> 47#include <stdlib.h>
48#include <signal.h> 48#include <signal.h>
@@ -305,48 +305,49 @@ void SIMpad::playAlarmSound()
305 vol_reset = true; 305 vol_reset = true;
306 } 306 }
307 } 307 }
308 308
309 snd. play(); 309 snd. play();
310 while ( !snd. isFinished()) 310 while ( !snd. isFinished())
311 qApp->processEvents(); 311 qApp->processEvents();
312 312
313 if ( fd >= 0 ) { 313 if ( fd >= 0 ) {
314 if ( vol_reset ) 314 if ( vol_reset )
315 ::ioctl ( fd, MIXER_WRITE( 0 ), &vol ); 315 ::ioctl ( fd, MIXER_WRITE( 0 ), &vol );
316 ::close ( fd ); 316 ::close ( fd );
317 } 317 }
318#endif 318#endif
319} 319}
320 320
321 321
322bool SIMpad::suspend() // Must override because SIMpad does NOT have apm 322bool SIMpad::suspend() // Must override because SIMpad does NOT have apm
323{ 323{
324 qDebug( "ODevice for SIMpad: suspend()" ); 324 qDebug( "ODevice for SIMpad: suspend()" );
325 if ( !isQWS( ) ) // only qwsserver is allowed to suspend 325 if ( !isQWS( ) ) // only qwsserver is allowed to suspend
326 return false; 326 return false;
327 327
328 bool res = false; 328 bool res = false;
329 ODevice::sendSuspendmsg();
329 330
330 struct timeval tvs, tvn; 331 struct timeval tvs, tvn;
331 ::gettimeofday ( &tvs, 0 ); 332 ::gettimeofday ( &tvs, 0 );
332 333
333 ::sync(); // flush fs caches 334 ::sync(); // flush fs caches
334 res = ( ::system ( "cat /dev/fb/0 >/tmp/.buffer; echo > /proc/sys/pm/suspend; cat /tmp/.buffer >/dev/fb/0" ) == 0 ); //TODO make better :) 335 res = ( ::system ( "cat /dev/fb/0 >/tmp/.buffer; echo > /proc/sys/pm/suspend; cat /tmp/.buffer >/dev/fb/0" ) == 0 ); //TODO make better :)
335 336
336 return res; 337 return res;
337} 338}
338 339
339 340
340bool SIMpad::setSoftSuspend ( bool soft ) 341bool SIMpad::setSoftSuspend ( bool soft )
341{ 342{
342 qDebug( "ODevice for SIMpad: UNHANDLED setSoftSuspend(%s)", soft? "on" : "off" ); 343 qDebug( "ODevice for SIMpad: UNHANDLED setSoftSuspend(%s)", soft? "on" : "off" );
343 return false; 344 return false;
344} 345}
345 346
346 347
347bool SIMpad::setDisplayStatus ( bool on ) 348bool SIMpad::setDisplayStatus ( bool on )
348{ 349{
349 qDebug( "ODevice for SIMpad: setDisplayStatus(%s)", on? "on" : "off" ); 350 qDebug( "ODevice for SIMpad: setDisplayStatus(%s)", on? "on" : "off" );
350 351
351 bool res = false; 352 bool res = false;
352 int fd; 353 int fd;
diff --git a/libopie2/opiecore/device/odevice_zaurus.cpp b/libopie2/opiecore/device/odevice_zaurus.cpp
index 8bff770..9d23a12 100644
--- a/libopie2/opiecore/device/odevice_zaurus.cpp
+++ b/libopie2/opiecore/device/odevice_zaurus.cpp
@@ -1,48 +1,48 @@
1/* 1/*
2                 This file is part of the Opie Project 2 This file is part of the Opie Project
3              Copyright (C) The Opie Team <opie-devel@handhelds.org> 3 Copyright (C) The Opie Team <opie-devel@handhelds.org>
4 =. 4 =.
5 .=l. 5 .=l.
6           .>+-= 6 .>+-=
7 _;:,     .>    :=|. This program is free software; you can 7_;:, .> :=|. This program is free software; you can
8.> <`_,   >  .   <= redistribute it and/or modify it under 8.> <`_, > . <= redistribute it and/or modify it under
9:`=1 )Y*s>-.--   : the terms of the GNU Library General Public 9:`=1 )Y*s>-.-- : the terms of the GNU Library General Public
10.="- .-=="i,     .._ License as published by the Free Software 10.="- .-=="i, .._ License as published by the Free Software
11 - .   .-<_>     .<> Foundation; either version 2 of the License, 11- . .-<_> .<> Foundation; either version 2 of the License,
12     ._= =}       : or (at your option) any later version. 12 ._= =} : or (at your option) any later version.
13    .%`+i>       _;_. 13 .%`+i> _;_.
14    .i_,=:_.      -<s. This program is distributed in the hope that 14 .i_,=:_. -<s. This program is distributed in the hope that
15     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY; 15 + . -:. = it will be useful, but WITHOUT ANY WARRANTY;
16    : ..    .:,     . . . without even the implied warranty of 16 : .. .:, . . . without even the implied warranty of
17    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A 17 =_ + =;=|` MERCHANTABILITY or FITNESS FOR A
18  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU 18 _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU
19..}^=.=       =       ; Library General Public License for more 19..}^=.= = ; Library General Public License for more
20++=   -.     .`     .: details. 20++= -. .` .: details.
21 :     =  ...= . :.=- 21: = ...= . :.=-
22 -.   .:....=;==+<; You should have received a copy of the GNU 22-. .:....=;==+<; You should have received a copy of the GNU
23  -_. . .   )=.  = Library General Public License along with 23 -_. . . )=. = Library General Public License along with
24    --        :-=` this library; see the file COPYING.LIB. 24 -- :-=` this library; see the file COPYING.LIB.
25 If not, write to the Free Software Foundation, 25 If not, write to the Free Software Foundation,
26 Inc., 59 Temple Place - Suite 330, 26 Inc., 59 Temple Place - Suite 330,
27 Boston, MA 02111-1307, USA. 27 Boston, MA 02111-1307, USA.
28*/ 28*/
29 29
30#include "odevice_zaurus.h" 30#include "odevice_zaurus.h"
31 31
32/* QT */ 32/* QT */
33#include <qapplication.h> 33#include <qapplication.h>
34#include <qfile.h> 34#include <qfile.h>
35#include <qtextstream.h> 35#include <qtextstream.h>
36#include <qwindowsystem_qws.h> 36#include <qwindowsystem_qws.h>
37 37
38/* OPIE */ 38/* OPIE */
39#include <qpe/config.h> 39#include <qpe/config.h>
40#include <qpe/resource.h> 40#include <qpe/resource.h>
41#include <qpe/sound.h> 41#include <qpe/sound.h>
42#include <qpe/qcopenvelope_qws.h> 42#include <qpe/qcopenvelope_qws.h>
43 43
44/* STD */ 44/* STD */
45#include <fcntl.h> 45#include <fcntl.h>
46#include <math.h> 46#include <math.h>
47#include <stdlib.h> 47#include <stdlib.h>
48#include <signal.h> 48#include <signal.h>
@@ -545,48 +545,49 @@ bool Zaurus::setDisplayBrightness ( int bright )
545 } 545 }
546 } 546 }
547 else 547 else
548 { 548 {
549 // special treatment for the OpenZaurus unified interface 549 // special treatment for the OpenZaurus unified interface
550 #define FB_BACKLIGHT_SET_BRIGHTNESS _IOW('F', 1, u_int) /* set brightness */ 550 #define FB_BACKLIGHT_SET_BRIGHTNESS _IOW('F', 1, u_int) /* set brightness */
551 if (( fd = ::open ( "/dev/fb0", O_WRONLY )) >= 0 ) { 551 if (( fd = ::open ( "/dev/fb0", O_WRONLY )) >= 0 ) {
552 res = ( ::ioctl ( fd , FB_BACKLIGHT_SET_BRIGHTNESS, bright ) == 0 ); 552 res = ( ::ioctl ( fd , FB_BACKLIGHT_SET_BRIGHTNESS, bright ) == 0 );
553 ::close ( fd ); 553 ::close ( fd );
554 } 554 }
555 } 555 }
556 return res; 556 return res;
557} 557}
558 558
559bool Zaurus::suspend() 559bool Zaurus::suspend()
560{ 560{
561 qDebug("ODevice::suspend"); 561 qDebug("ODevice::suspend");
562 if ( !isQWS( ) ) // only qwsserver is allowed to suspend 562 if ( !isQWS( ) ) // only qwsserver is allowed to suspend
563 return false; 563 return false;
564 564
565 if ( d->m_model == Model_Unknown ) // better don't suspend in qvfb / on unkown devices 565 if ( d->m_model == Model_Unknown ) // better don't suspend in qvfb / on unkown devices
566 return false; 566 return false;
567 567
568 bool res = false; 568 bool res = false;
569 ODevice::sendSuspendmsg();
569 570
570 struct timeval tvs, tvn; 571 struct timeval tvs, tvn;
571 ::gettimeofday ( &tvs, 0 ); 572 ::gettimeofday ( &tvs, 0 );
572 573
573 ::sync(); // flush fs caches 574 ::sync(); // flush fs caches
574 res = ( ::system ( "apm --suspend" ) == 0 ); 575 res = ( ::system ( "apm --suspend" ) == 0 );
575 576
576 // This is needed because the iPAQ apm implementation is asynchronous and we 577 // This is needed because the iPAQ apm implementation is asynchronous and we
577 // can not be sure when exactly the device is really suspended 578 // can not be sure when exactly the device is really suspended
578 // This can be deleted as soon as a stable familiar with a synchronous apm implementation exists. 579 // This can be deleted as soon as a stable familiar with a synchronous apm implementation exists.
579 580
580 if ( res ) { 581 if ( res ) {
581 do { // Yes, wait 15 seconds. This APM bug sucks big time. 582 do { // Yes, wait 15 seconds. This APM bug sucks big time.
582 ::usleep ( 200 * 1000 ); 583 ::usleep ( 200 * 1000 );
583 ::gettimeofday ( &tvn, 0 ); 584 ::gettimeofday ( &tvn, 0 );
584 } while ((( tvn. tv_sec - tvs. tv_sec ) * 1000 + ( tvn. tv_usec - tvs. tv_usec ) / 1000 ) < 15000 ); 585 } while ((( tvn. tv_sec - tvs. tv_sec ) * 1000 + ( tvn. tv_usec - tvs. tv_usec ) / 1000 ) < 15000 );
585 } 586 }
586 587
587 QCopEnvelope ( "QPE/Rotation", "rotateDefault()" ); 588 QCopEnvelope ( "QPE/Rotation", "rotateDefault()" );
588 return res; 589 return res;
589} 590}
590 591
591 592
592Transformation Zaurus::rotation() const 593Transformation Zaurus::rotation() const