-rw-r--r-- | libopie2/opiecore/device/device.pro | 2 | ||||
-rw-r--r-- | libopie2/opiecore/device/odevice.cpp | 14 | ||||
-rw-r--r-- | libopie2/opiecore/device/odevice_abstractmobiledevice.cpp | 119 | ||||
-rw-r--r-- | libopie2/opiecore/device/odevice_abstractmobiledevice.h | 64 | ||||
-rw-r--r-- | libopie2/opiecore/device/odevice_beagle.h | 4 | ||||
-rw-r--r-- | libopie2/opiecore/device/odevice_ipaq.h | 4 | ||||
-rw-r--r-- | libopie2/opiecore/device/odevice_jornada.cpp | 21 | ||||
-rw-r--r-- | libopie2/opiecore/device/odevice_jornada.h | 5 | ||||
-rw-r--r-- | libopie2/opiecore/device/odevice_ramses.h | 2 | ||||
-rw-r--r-- | libopie2/opiecore/device/odevice_simpad.cpp | 2 | ||||
-rw-r--r-- | libopie2/opiecore/device/odevice_simpad.h | 6 | ||||
-rw-r--r-- | libopie2/opiecore/device/odevice_yopy.h | 4 | ||||
-rw-r--r-- | libopie2/opiecore/device/odevice_zaurus.cpp | 36 | ||||
-rw-r--r-- | libopie2/opiecore/device/odevice_zaurus.h | 5 |
14 files changed, 204 insertions, 84 deletions
diff --git a/libopie2/opiecore/device/device.pro b/libopie2/opiecore/device/device.pro index 9a409e1..08bd4e1 100644 --- a/libopie2/opiecore/device/device.pro +++ b/libopie2/opiecore/device/device.pro | |||
@@ -1,5 +1,6 @@ | |||
1 | HEADERS += device/odevice.h \ | 1 | HEADERS += device/odevice.h \ |
2 | device/odevicebutton.h \ | 2 | device/odevicebutton.h \ |
3 | device/odevice_abstractmobiledevice.h \ | ||
3 | device/odevice_beagle.h \ | 4 | device/odevice_beagle.h \ |
4 | device/odevice_ipaq.h \ | 5 | device/odevice_ipaq.h \ |
5 | device/odevice_jornada.h \ | 6 | device/odevice_jornada.h \ |
@@ -11,6 +12,7 @@ HEADERS += device/odevice.h \ | |||
11 | 12 | ||
12 | SOURCES += device/odevice.cpp \ | 13 | SOURCES += device/odevice.cpp \ |
13 | device/odevicebutton.cpp \ | 14 | device/odevicebutton.cpp \ |
15 | device/odevice_abstractmobiledevice.cpp \ | ||
14 | device/odevice_beagle.cpp \ | 16 | device/odevice_beagle.cpp \ |
15 | device/odevice_ipaq.cpp \ | 17 | device/odevice_ipaq.cpp \ |
16 | device/odevice_jornada.cpp\ | 18 | device/odevice_jornada.cpp\ |
diff --git a/libopie2/opiecore/device/odevice.cpp b/libopie2/opiecore/device/odevice.cpp index 2c5190c..ed705a6 100644 --- a/libopie2/opiecore/device/odevice.cpp +++ b/libopie2/opiecore/device/odevice.cpp | |||
@@ -254,10 +254,6 @@ ODevice::~ODevice() | |||
254 | delete d; | 254 | delete d; |
255 | } | 255 | } |
256 | 256 | ||
257 | //#include <linux/apm_bios.h> | ||
258 | |||
259 | #define APM_IOC_SUSPEND OD_IO( 'A', 2 ) | ||
260 | |||
261 | /** | 257 | /** |
262 | * This method will try to suspend the device | 258 | * This method will try to suspend the device |
263 | * 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 |
@@ -274,16 +270,6 @@ bool ODevice::suspend() | |||
274 | return false; // default implementation == unknown device or qvfb | 270 | return false; // default implementation == unknown device or qvfb |
275 | } | 271 | } |
276 | 272 | ||
277 | //#include <linux/fb.h> better not rely on kernel headers in userspace ... | ||
278 | |||
279 | #define FBIOBLANK OD_IO( 'F', 0x11 ) // 0x4611 | ||
280 | |||
281 | /* VESA Blanking Levels */ | ||
282 | #define VESA_NO_BLANKING 0 | ||
283 | #define VESA_VSYNC_SUSPEND 1 | ||
284 | #define VESA_HSYNC_SUSPEND 2 | ||
285 | #define VESA_POWERDOWN 3 | ||
286 | |||
287 | /** | 273 | /** |
288 | * This sets the display on or off | 274 | * This sets the display on or off |
289 | */ | 275 | */ |
diff --git a/libopie2/opiecore/device/odevice_abstractmobiledevice.cpp b/libopie2/opiecore/device/odevice_abstractmobiledevice.cpp new file mode 100644 index 0000000..f3f6af5 --- a/dev/null +++ b/libopie2/opiecore/device/odevice_abstractmobiledevice.cpp | |||
@@ -0,0 +1,119 @@ | |||
1 | /* | ||
2 | This file is part of the Opie Project | ||
3 | Copyright (C) 2004, 2005 Holger Hans Peter Freyther <freyther@handhelds.org> | ||
4 | Copyright (C) 2004, 2005 Michael 'mickey' Lauer <mickeyl@handhelds.org> | ||
5 | Copyright (C) 2002, 2003 Robert Griebl <sandman@handhelds.org> | ||
6 | |||
7 | |||
8 | =. | ||
9 | .=l. | ||
10 | .>+-= | ||
11 | _;:, .> :=|. This program is free software; you can | ||
12 | .> <`_, > . <= redistribute it and/or modify it under | ||
13 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public | ||
14 | .="- .-=="i, .._ License as published by the Free Software | ||
15 | - . .-<_> .<> Foundation; either version 2 of the License, | ||
16 | ._= =} : or (at your option) any later version. | ||
17 | .%`+i> _;_. | ||
18 | .i_,=:_. -<s. This program is distributed in the hope that | ||
19 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | ||
20 | : .. .:, . . . without even the implied warranty of | ||
21 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | ||
22 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | ||
23 | ..}^=.= = ; Library General Public License for more | ||
24 | ++= -. .` .: details. | ||
25 | : = ...= . :.=- | ||
26 | -. .:....=;==+<; You should have received a copy of the GNU | ||
27 | -_. . . )=. = Library General Public License along with | ||
28 | -- :-=` this library; see the file COPYING.LIB. | ||
29 | If not, write to the Free Software Foundation, | ||
30 | Inc., 59 Temple Place - Suite 330, | ||
31 | Boston, MA 02111-1307, USA. | ||
32 | */ | ||
33 | |||
34 | #include "odevice_abstractmobiledevice.h" | ||
35 | |||
36 | #include <sys/time.h> | ||
37 | #include <sys/ioctl.h> | ||
38 | |||
39 | #include <time.h> | ||
40 | #include <fcntl.h> | ||
41 | #include <unistd.h> | ||
42 | #include <stdlib.h> | ||
43 | |||
44 | namespace Opie { | ||
45 | namespace Core { | ||
46 | OAbstractMobileDevice::OAbstractMobileDevice() | ||
47 | : m_timeOut( 1500 ) | ||
48 | {} | ||
49 | |||
50 | /** | ||
51 | * @short Time to wait for the asynchronos APM implementation to suspend | ||
52 | * | ||
53 | * Milli Seconds to wait before returning from the suspend method. | ||
54 | * This is needed due asynchrnonus implementations of the APM bios. | ||
55 | * | ||
56 | */ | ||
57 | void OAbstractMobileDevice::setAPMTimeOut( int time ) { | ||
58 | m_timeOut = time; | ||
59 | } | ||
60 | |||
61 | |||
62 | bool OAbstractMobileDevice::suspend() { | ||
63 | if ( !isQWS( ) ) // only qwsserver is allowed to suspend | ||
64 | return false; | ||
65 | |||
66 | bool res = false; | ||
67 | ODevice::sendSuspendmsg(); | ||
68 | |||
69 | struct timeval tvs, tvn; | ||
70 | ::gettimeofday ( &tvs, 0 ); | ||
71 | |||
72 | ::sync(); // flush fs caches | ||
73 | res = ( ::system ( "apm --suspend" ) == 0 ); | ||
74 | |||
75 | // This is needed because some apm implementations are asynchronous and we | ||
76 | // 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. | ||
78 | |||
79 | if ( res ) { | ||
80 | do { // wait at most 1.5 sec: either suspend didn't work or the device resumed | ||
81 | ::usleep ( 200 * 1000 ); | ||
82 | ::gettimeofday ( &tvn, 0 ); | ||
83 | } while ((( tvn. tv_sec - tvs. tv_sec ) * 1000 + ( tvn. tv_usec - tvs. tv_usec ) / 1000 ) < m_timeOut ); | ||
84 | } | ||
85 | |||
86 | return res; | ||
87 | } | ||
88 | |||
89 | //#include <linux/fb.h> better not rely on kernel headers in userspace ... | ||
90 | |||
91 | // _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_IO(type,number) OD_IOC(0,type,number,0) | ||
94 | |||
95 | #define FBIOBLANK OD_IO( 'F', 0x11 ) // 0x4611 | ||
96 | |||
97 | /* VESA Blanking Levels */ | ||
98 | #define VESA_NO_BLANKING 0 | ||
99 | #define VESA_VSYNC_SUSPEND 1 | ||
100 | #define VESA_HSYNC_SUSPEND 2 | ||
101 | #define VESA_POWERDOWN 3 | ||
102 | |||
103 | bool OAbstractMobileDevice::setDisplayStatus ( bool on ) { | ||
104 | bool res = false; | ||
105 | int fd; | ||
106 | |||
107 | #ifdef QT_QWS_DEVFS | ||
108 | if (( fd = ::open ( "/dev/fb/0", O_RDWR )) >= 0 ) { | ||
109 | #else | ||
110 | if (( fd = ::open ( "/dev/fb0", O_RDWR )) >= 0 ) { | ||
111 | #endif | ||
112 | res = ( ::ioctl ( fd, FBIOBLANK, on ? VESA_NO_BLANKING : VESA_POWERDOWN ) == 0 ); | ||
113 | ::close ( fd ); | ||
114 | } | ||
115 | |||
116 | return res; | ||
117 | } | ||
118 | } | ||
119 | } | ||
diff --git a/libopie2/opiecore/device/odevice_abstractmobiledevice.h b/libopie2/opiecore/device/odevice_abstractmobiledevice.h new file mode 100644 index 0000000..9467e82 --- a/dev/null +++ b/libopie2/opiecore/device/odevice_abstractmobiledevice.h | |||
@@ -0,0 +1,64 @@ | |||
1 | /* | ||
2 | This file is part of the Opie Project | ||
3 | Copyright (C) 2004, 2005 Holger Hans Peter Freyther <freyther@handhelds.org> | ||
4 | Copyright (C) 2004, 2005 Michael 'mickey' Lauer <mickeyl@handhelds.org> | ||
5 | |||
6 | |||
7 | =. | ||
8 | .=l. | ||
9 | .>+-= | ||
10 | _;:, .> :=|. This program is free software; you can | ||
11 | .> <`_, > . <= redistribute it and/or modify it under | ||
12 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public | ||
13 | .="- .-=="i, .._ License as published by the Free Software | ||
14 | - . .-<_> .<> Foundation; either version 2 of the License, | ||
15 | ._= =} : or (at your option) any later version. | ||
16 | .%`+i> _;_. | ||
17 | .i_,=:_. -<s. This program is distributed in the hope that | ||
18 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | ||
19 | : .. .:, . . . without even the implied warranty of | ||
20 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | ||
21 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | ||
22 | ..}^=.= = ; Library General Public License for more | ||
23 | ++= -. .` .: details. | ||
24 | : = ...= . :.=- | ||
25 | -. .:....=;==+<; You should have received a copy of the GNU | ||
26 | -_. . . )=. = Library General Public License along with | ||
27 | -- :-=` this library; see the file COPYING.LIB. | ||
28 | If not, write to the Free Software Foundation, | ||
29 | Inc., 59 Temple Place - Suite 330, | ||
30 | Boston, MA 02111-1307, USA. | ||
31 | */ | ||
32 | |||
33 | #ifndef OPIE_CORE_DEVICE_ABSTRACT_MOBILE_DEVICE | ||
34 | #define OPIE_CORE_DEVICE_ABSTRACT_MOBILE_DEVICE | ||
35 | |||
36 | #include "odevice.h" | ||
37 | |||
38 | namespace Opie { | ||
39 | namespace Core { | ||
40 | /** | ||
41 | * @short Common Implementations for Linux Handheld Devices | ||
42 | * | ||
43 | * Abstract Class with implementation for suspending using | ||
44 | * asynchrnonus apm implementations and displaystatus using | ||
45 | * the Linux Frame Buffer API | ||
46 | * | ||
47 | */ | ||
48 | class OAbstractMobileDevice : public ODevice { | ||
49 | Q_OBJECT | ||
50 | protected: | ||
51 | OAbstractMobileDevice(); | ||
52 | void setAPMTimeOut( int time ); | ||
53 | public: | ||
54 | virtual bool suspend(); | ||
55 | virtual bool setDisplayStatus(bool); | ||
56 | |||
57 | private: | ||
58 | int m_timeOut; | ||
59 | }; | ||
60 | } | ||
61 | } | ||
62 | |||
63 | |||
64 | #endif | ||
diff --git a/libopie2/opiecore/device/odevice_beagle.h b/libopie2/opiecore/device/odevice_beagle.h index 17b040c..697d689 100644 --- a/libopie2/opiecore/device/odevice_beagle.h +++ b/libopie2/opiecore/device/odevice_beagle.h | |||
@@ -30,12 +30,12 @@ | |||
30 | #ifndef OPIE_CORE_DEVICE_BEAGLE_H | 30 | #ifndef OPIE_CORE_DEVICE_BEAGLE_H |
31 | #define OPIE_CORE_DEVICE_BEAGLE_H | 31 | #define OPIE_CORE_DEVICE_BEAGLE_H |
32 | 32 | ||
33 | #include "odevice.h" | 33 | #include "odevice_abstractmobiledevice.h" |
34 | 34 | ||
35 | namespace Opie { | 35 | namespace Opie { |
36 | namespace Core { | 36 | namespace Core { |
37 | namespace Internal { | 37 | namespace Internal { |
38 | class Beagle : public ODevice { | 38 | class Beagle : public OAbstractMobileDevice { |
39 | public: | 39 | public: |
40 | Beagle(); | 40 | Beagle(); |
41 | ~Beagle(); | 41 | ~Beagle(); |
diff --git a/libopie2/opiecore/device/odevice_ipaq.h b/libopie2/opiecore/device/odevice_ipaq.h index b1dac74..1889467 100644 --- a/libopie2/opiecore/device/odevice_ipaq.h +++ b/libopie2/opiecore/device/odevice_ipaq.h | |||
@@ -30,7 +30,7 @@ | |||
30 | #ifndef ODEVICE_IPAQ | 30 | #ifndef ODEVICE_IPAQ |
31 | #define ODEVICE_IPAQ | 31 | #define ODEVICE_IPAQ |
32 | 32 | ||
33 | #include "odevice.h" | 33 | #include "odevice_abstractmobiledevice.h" |
34 | 34 | ||
35 | /* QT */ | 35 | /* QT */ |
36 | #include <qwindowsystem_qws.h> | 36 | #include <qwindowsystem_qws.h> |
@@ -39,7 +39,7 @@ namespace Opie { | |||
39 | namespace Core { | 39 | namespace Core { |
40 | namespace Internal { | 40 | namespace Internal { |
41 | 41 | ||
42 | class iPAQ : public ODevice, public QWSServer::KeyboardFilter | 42 | class iPAQ : public OAbstractMobileDevice, public QWSServer::KeyboardFilter |
43 | { | 43 | { |
44 | 44 | ||
45 | protected: | 45 | protected: |
diff --git a/libopie2/opiecore/device/odevice_jornada.cpp b/libopie2/opiecore/device/odevice_jornada.cpp index 8141f1c..5f95e42 100644 --- a/libopie2/opiecore/device/odevice_jornada.cpp +++ b/libopie2/opiecore/device/odevice_jornada.cpp | |||
@@ -170,27 +170,6 @@ bool Jornada::setDisplayBrightness( int bright ) | |||
170 | } | 170 | } |
171 | 171 | ||
172 | 172 | ||
173 | bool Jornada::suspend( ) | ||
174 | { | ||
175 | qDebug("ODevice::suspend"); | ||
176 | if ( !isQWS( ) ) // only qwsserver is allowed to suspend | ||
177 | return false; | ||
178 | |||
179 | if ( d->m_model == Model_Unknown ) // better don't suspend in qvfb / on unkown devices | ||
180 | return false; | ||
181 | |||
182 | bool res = false; | ||
183 | ODevice::sendSuspendmsg(); | ||
184 | |||
185 | struct timeval tvs; | ||
186 | ::gettimeofday ( &tvs, 0 ); | ||
187 | |||
188 | ::sync(); // flush fs caches | ||
189 | res = ( ::system ( "apm --suspend" ) == 0 ); | ||
190 | |||
191 | return res; | ||
192 | } | ||
193 | |||
194 | bool Jornada::setDisplayStatus ( bool on ) | 173 | bool Jornada::setDisplayStatus ( bool on ) |
195 | { | 174 | { |
196 | bool res = false; | 175 | bool res = false; |
diff --git a/libopie2/opiecore/device/odevice_jornada.h b/libopie2/opiecore/device/odevice_jornada.h index b17fa8b..480efff 100644 --- a/libopie2/opiecore/device/odevice_jornada.h +++ b/libopie2/opiecore/device/odevice_jornada.h | |||
@@ -30,12 +30,12 @@ | |||
30 | #ifndef ODEVICE_JORNADA | 30 | #ifndef ODEVICE_JORNADA |
31 | #define ODEVICE_JORNADA | 31 | #define ODEVICE_JORNADA |
32 | 32 | ||
33 | #include <opie2/odevice.h> | 33 | #include "odevice_abstractmobiledevice.h" |
34 | 34 | ||
35 | namespace Opie { | 35 | namespace Opie { |
36 | namespace Core { | 36 | namespace Core { |
37 | namespace Internal { | 37 | namespace Internal { |
38 | class Jornada : public ODevice | 38 | class Jornada : public OAbstractMobileDevice |
39 | { | 39 | { |
40 | 40 | ||
41 | protected: | 41 | protected: |
@@ -43,7 +43,6 @@ class Jornada : public ODevice | |||
43 | virtual void initButtons(); | 43 | virtual void initButtons(); |
44 | 44 | ||
45 | public: | 45 | public: |
46 | virtual bool suspend ( ); | ||
47 | virtual bool setDisplayBrightness ( int b ); | 46 | virtual bool setDisplayBrightness ( int b ); |
48 | virtual bool setDisplayStatus ( bool on); | 47 | virtual bool setDisplayStatus ( bool on); |
49 | virtual int displayBrightnessResolution() const; | 48 | virtual int displayBrightnessResolution() const; |
diff --git a/libopie2/opiecore/device/odevice_ramses.h b/libopie2/opiecore/device/odevice_ramses.h index bbd3862..50963dc 100644 --- a/libopie2/opiecore/device/odevice_ramses.h +++ b/libopie2/opiecore/device/odevice_ramses.h | |||
@@ -30,7 +30,7 @@ | |||
30 | #ifndef ODEVICE_RAMSES | 30 | #ifndef ODEVICE_RAMSES |
31 | #define ODEVICE_RAMSES | 31 | #define ODEVICE_RAMSES |
32 | 32 | ||
33 | #include <opie2/odevice.h> | 33 | #include "odevice_abstractmobiledevice.h" |
34 | /* QT */ | 34 | /* QT */ |
35 | #include <qwindowsystem_qws.h> | 35 | #include <qwindowsystem_qws.h> |
36 | 36 | ||
diff --git a/libopie2/opiecore/device/odevice_simpad.cpp b/libopie2/opiecore/device/odevice_simpad.cpp index d6c2c80..550da5e 100644 --- a/libopie2/opiecore/device/odevice_simpad.cpp +++ b/libopie2/opiecore/device/odevice_simpad.cpp | |||
@@ -332,7 +332,7 @@ bool SIMpad::suspend() // Must override because SIMpad does NOT have apm | |||
332 | if ( !isQWS( ) ) // only qwsserver is allowed to suspend | 332 | if ( !isQWS( ) ) // only qwsserver is allowed to suspend |
333 | return false; | 333 | return false; |
334 | 334 | ||
335 | bool res = ODevice::suspend(); | 335 | bool res = OAbstractMobileDevice::suspend(); |
336 | 336 | ||
337 | /* | 337 | /* |
338 | * restore the screen content if we really | 338 | * restore the screen content if we really |
diff --git a/libopie2/opiecore/device/odevice_simpad.h b/libopie2/opiecore/device/odevice_simpad.h index 41b94d1..1276603 100644 --- a/libopie2/opiecore/device/odevice_simpad.h +++ b/libopie2/opiecore/device/odevice_simpad.h | |||
@@ -30,7 +30,7 @@ | |||
30 | #ifndef ODEVICE_SIMPAD | 30 | #ifndef ODEVICE_SIMPAD |
31 | #define ODEVICE_SIMPAD | 31 | #define ODEVICE_SIMPAD |
32 | 32 | ||
33 | #include <opie2/odevice.h> | 33 | #include "odevice_abstractmobiledevice.h" |
34 | 34 | ||
35 | /* QT */ | 35 | /* QT */ |
36 | #include <qwindowsystem_qws.h> | 36 | #include <qwindowsystem_qws.h> |
@@ -39,8 +39,8 @@ namespace Opie { | |||
39 | namespace Core { | 39 | namespace Core { |
40 | namespace Internal { | 40 | namespace Internal { |
41 | 41 | ||
42 | class SIMpad : public ODevice | 42 | class SIMpad : public OAbstractMobileDevice |
43 | { | 43 | { |
44 | protected: | 44 | protected: |
45 | virtual void init(const QString&); | 45 | virtual void init(const QString&); |
46 | virtual void initButtons(); | 46 | virtual void initButtons(); |
diff --git a/libopie2/opiecore/device/odevice_yopy.h b/libopie2/opiecore/device/odevice_yopy.h index f6bf061..02a19c9 100644 --- a/libopie2/opiecore/device/odevice_yopy.h +++ b/libopie2/opiecore/device/odevice_yopy.h | |||
@@ -30,12 +30,12 @@ _;:, .> :=|. This program is free software; you can | |||
30 | #ifndef ODEVICE_YOPY | 30 | #ifndef ODEVICE_YOPY |
31 | #define ODEVICE_YOPY | 31 | #define ODEVICE_YOPY |
32 | 32 | ||
33 | #include <opie2/odevice.h> | 33 | #include "odevice_abstractmobiledevice.h" |
34 | 34 | ||
35 | namespace Opie { | 35 | namespace Opie { |
36 | namespace Core { | 36 | namespace Core { |
37 | namespace Internal { | 37 | namespace Internal { |
38 | class Yopy : public ODevice | 38 | class Yopy : public OAbstractMobileDevice |
39 | { | 39 | { |
40 | protected: | 40 | protected: |
41 | 41 | ||
diff --git a/libopie2/opiecore/device/odevice_zaurus.cpp b/libopie2/opiecore/device/odevice_zaurus.cpp index 82e127e..67dfa41 100644 --- a/libopie2/opiecore/device/odevice_zaurus.cpp +++ b/libopie2/opiecore/device/odevice_zaurus.cpp | |||
@@ -132,6 +132,10 @@ struct z_button z_buttons_c700 [] = { | |||
132 | 132 | ||
133 | void Zaurus::init(const QString& cpu_info) | 133 | void Zaurus::init(const QString& cpu_info) |
134 | { | 134 | { |
135 | // Set the time to wait until the system is realy suspended | ||
136 | // the delta between apm --suspend and sleeping | ||
137 | setAPMTimeOut( 15000 ); | ||
138 | |||
135 | // generic distribution code already scanned /etc/issue at that point - | 139 | // generic distribution code already scanned /etc/issue at that point - |
136 | // embedix releases contain "Embedix <version> | Linux for Embedded Devices" | 140 | // embedix releases contain "Embedix <version> | Linux for Embedded Devices" |
137 | if ( d->m_sysverstr.contains( "embedix", false ) ) | 141 | if ( d->m_sysverstr.contains( "embedix", false ) ) |
@@ -482,38 +486,6 @@ bool Zaurus::setDisplayStatus( bool on ) | |||
482 | return res; | 486 | return res; |
483 | } | 487 | } |
484 | 488 | ||
485 | bool Zaurus::suspend() | ||
486 | { | ||
487 | qDebug("ODevice::suspend"); | ||
488 | if ( !isQWS( ) ) // only qwsserver is allowed to suspend | ||
489 | return false; | ||
490 | |||
491 | if ( d->m_model == Model_Unknown ) // better don't suspend on unknown devices | ||
492 | return false; | ||
493 | |||
494 | bool res = false; | ||
495 | ODevice::sendSuspendmsg(); | ||
496 | |||
497 | struct timeval tvs, tvn; | ||
498 | ::gettimeofday ( &tvs, 0 ); | ||
499 | |||
500 | ::sync(); // flush fs caches | ||
501 | res = ( ::system ( "apm --suspend" ) == 0 ); | ||
502 | |||
503 | // This is needed because the apm implementation is asynchronous and we | ||
504 | // can not be sure when exactly the device is really suspended | ||
505 | if ( res ) { | ||
506 | do { // Yes, wait 15 seconds. This APM sucks big time. | ||
507 | ::usleep ( 200 * 1000 ); | ||
508 | ::gettimeofday ( &tvn, 0 ); | ||
509 | } while ((( tvn. tv_sec - tvs. tv_sec ) * 1000 + ( tvn. tv_usec - tvs. tv_usec ) / 1000 ) < 15000 ); | ||
510 | } | ||
511 | |||
512 | QCopEnvelope ( "QPE/Rotation", "rotateDefault()" ); | ||
513 | return res; | ||
514 | } | ||
515 | |||
516 | |||
517 | Transformation Zaurus::rotation() const | 489 | Transformation Zaurus::rotation() const |
518 | { | 490 | { |
519 | qDebug( "Zaurus::rotation()" ); | 491 | qDebug( "Zaurus::rotation()" ); |
diff --git a/libopie2/opiecore/device/odevice_zaurus.h b/libopie2/opiecore/device/odevice_zaurus.h index 80593ce..6e6ca46 100644 --- a/libopie2/opiecore/device/odevice_zaurus.h +++ b/libopie2/opiecore/device/odevice_zaurus.h | |||
@@ -30,7 +30,7 @@ | |||
30 | #ifndef ODEVICE_ZAURUS | 30 | #ifndef ODEVICE_ZAURUS |
31 | #define ODEVICE_ZAURUS | 31 | #define ODEVICE_ZAURUS |
32 | 32 | ||
33 | #include <opie2/odevice.h> | 33 | #include "odevice_abstractmobiledevice.h" |
34 | 34 | ||
35 | #ifndef ARRAY_SIZE | 35 | #ifndef ARRAY_SIZE |
36 | #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) | 36 | #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) |
@@ -91,7 +91,7 @@ namespace Opie { | |||
91 | namespace Core { | 91 | namespace Core { |
92 | namespace Internal { | 92 | namespace Internal { |
93 | 93 | ||
94 | class Zaurus : public ODevice | 94 | class Zaurus : public OAbstractMobileDevice |
95 | { | 95 | { |
96 | protected: | 96 | protected: |
97 | virtual void init(const QString&); | 97 | virtual void init(const QString&); |
@@ -114,7 +114,6 @@ class Zaurus : public ODevice | |||
114 | virtual bool hasHingeSensor() const; | 114 | virtual bool hasHingeSensor() const; |
115 | virtual OHingeStatus readHingeSensor() const; | 115 | virtual OHingeStatus readHingeSensor() const; |
116 | 116 | ||
117 | virtual bool suspend(); | ||
118 | virtual Transformation rotation() const; | 117 | virtual Transformation rotation() const; |
119 | virtual ODirection direction() const; | 118 | virtual ODirection direction() const; |
120 | 119 | ||