author | zecke <zecke> | 2004-08-15 13:35:35 (UTC) |
---|---|---|
committer | zecke <zecke> | 2004-08-15 13:35:35 (UTC) |
commit | b7b5f68bb0c603a72e0f269215ed92dd89498e0f (patch) (unidiff) | |
tree | e5de7a15ff5e5dd9a19e9d0fd3b3878ac43e1c75 | |
parent | 2fa72eb5697fef6a58b3ff8cec8489d0b870883d (diff) | |
download | opie-b7b5f68bb0c603a72e0f269215ed92dd89498e0f.zip opie-b7b5f68bb0c603a72e0f269215ed92dd89498e0f.tar.gz opie-b7b5f68bb0c603a72e0f269215ed92dd89498e0f.tar.bz2 |
-Use APM for the SIMpad now that it got the APM biosless patch
applied as well
- We save the screen content, call the ODevice implementation
and on wake up we restore the content
-rw-r--r-- | libopie2/opiecore/device/odevice.cpp | 44 | ||||
-rw-r--r-- | libopie2/opiecore/device/odevice_simpad.cpp | 61 |
2 files changed, 55 insertions, 50 deletions
diff --git a/libopie2/opiecore/device/odevice.cpp b/libopie2/opiecore/device/odevice.cpp index cd3a84c..835586e 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 | #include <opie2/okeyfilter.h> | 48 | #include <opie2/okeyfilter.h> |
@@ -126,49 +126,49 @@ ODevice *ODevice::inst() | |||
126 | { | 126 | { |
127 | QTextStream s( &f ); | 127 | QTextStream s( &f ); |
128 | while ( !s.atEnd() ) | 128 | while ( !s.atEnd() ) |
129 | { | 129 | { |
130 | QString line; | 130 | QString line; |
131 | line = s.readLine(); | 131 | line = s.readLine(); |
132 | if ( line.startsWith( "Hardware" ) ) | 132 | if ( line.startsWith( "Hardware" ) ) |
133 | { | 133 | { |
134 | qDebug( "ODevice() - found '%s'", (const char*) line ); | 134 | qDebug( "ODevice() - found '%s'", (const char*) line ); |
135 | cpu_info = line; | 135 | cpu_info = line; |
136 | if ( line.contains( "sharp", false ) ) dev = new Internal::Zaurus(); | 136 | if ( line.contains( "sharp", false ) ) dev = new Internal::Zaurus(); |
137 | else if ( line.contains( "ipaq", false ) ) dev = new Internal::iPAQ(); | 137 | else if ( line.contains( "ipaq", false ) ) dev = new Internal::iPAQ(); |
138 | else if ( line.contains( "simpad", false ) ) dev = new Internal::SIMpad(); | 138 | else if ( line.contains( "simpad", false ) ) dev = new Internal::SIMpad(); |
139 | else if ( line.contains( "jornada", false ) ) dev = new Internal::Jornada(); | 139 | else if ( line.contains( "jornada", false ) ) dev = new Internal::Jornada(); |
140 | else if ( line.contains( "ramses", false ) ) dev = new Internal::Ramses(); | 140 | else if ( line.contains( "ramses", false ) ) dev = new Internal::Ramses(); |
141 | else qWarning( "ODevice() - unknown hardware - using default." ); | 141 | else qWarning( "ODevice() - unknown hardware - using default." ); |
142 | break; | 142 | break; |
143 | } | 143 | } |
144 | } | 144 | } |
145 | } | 145 | } |
146 | else | 146 | else |
147 | { | 147 | { |
148 | qWarning( "ODevice() - can't open '%s' - unknown hardware - using default.", PATH_PROC_CPUINFO ); | 148 | qWarning( "ODevice() - can't open '%s' - unknown hardware - using default.", PATH_PROC_CPUINFO ); |
149 | } | 149 | } |
150 | if ( !dev ) dev = new ODevice(); | 150 | if ( !dev ) dev = new Internal::Zaurus(); |
151 | dev->init(cpu_info); | 151 | dev->init(cpu_info); |
152 | } | 152 | } |
153 | return dev; | 153 | return dev; |
154 | } | 154 | } |
155 | 155 | ||
156 | ODevice::ODevice() | 156 | ODevice::ODevice() |
157 | { | 157 | { |
158 | d = new ODeviceData; | 158 | d = new ODeviceData; |
159 | 159 | ||
160 | d->m_modelstr = "Unknown"; | 160 | d->m_modelstr = "Unknown"; |
161 | d->m_model = Model_Unknown; | 161 | d->m_model = Model_Unknown; |
162 | d->m_vendorstr = "Unknown"; | 162 | d->m_vendorstr = "Unknown"; |
163 | d->m_vendor = Vendor_Unknown; | 163 | d->m_vendor = Vendor_Unknown; |
164 | d->m_systemstr = "Unknown"; | 164 | d->m_systemstr = "Unknown"; |
165 | d->m_system = System_Unknown; | 165 | d->m_system = System_Unknown; |
166 | d->m_sysverstr = "0.0"; | 166 | d->m_sysverstr = "0.0"; |
167 | d->m_rotation = Rot0; | 167 | d->m_rotation = Rot0; |
168 | d->m_direction = CW; | 168 | d->m_direction = CW; |
169 | 169 | ||
170 | d->m_holdtime = 1000; // 1000ms | 170 | d->m_holdtime = 1000; // 1000ms |
171 | d->m_buttons = 0; | 171 | d->m_buttons = 0; |
172 | d->m_cpu_frequencies = new QStrList; | 172 | d->m_cpu_frequencies = new QStrList; |
173 | 173 | ||
174 | // New distribution detection code first checks for legacy distributions, | 174 | // New distribution detection code first checks for legacy distributions, |
diff --git a/libopie2/opiecore/device/odevice_simpad.cpp b/libopie2/opiecore/device/odevice_simpad.cpp index bf46e43..c6de614 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 | #include <opie2/okeyfilter.h> | 43 | #include <opie2/okeyfilter.h> |
44 | 44 | ||
45 | /* STD */ | 45 | /* STD */ |
46 | #include <fcntl.h> | 46 | #include <fcntl.h> |
47 | #include <math.h> | 47 | #include <math.h> |
48 | #include <stdlib.h> | 48 | #include <stdlib.h> |
@@ -285,56 +285,61 @@ void SIMpad::playAlarmSound() | |||
285 | if ( ::ioctl ( fd, MIXER_WRITE( 0 ), &volalarm ) >= 0 ) | 285 | if ( ::ioctl ( fd, MIXER_WRITE( 0 ), &volalarm ) >= 0 ) |
286 | vol_reset = true; | 286 | vol_reset = true; |
287 | } | 287 | } |
288 | } | 288 | } |
289 | 289 | ||
290 | snd. play(); | 290 | snd. play(); |
291 | while ( !snd. isFinished()) | 291 | while ( !snd. isFinished()) |
292 | qApp->processEvents(); | 292 | qApp->processEvents(); |
293 | 293 | ||
294 | if ( fd >= 0 ) { | 294 | if ( fd >= 0 ) { |
295 | if ( vol_reset ) | 295 | if ( vol_reset ) |
296 | ::ioctl ( fd, MIXER_WRITE( 0 ), &vol ); | 296 | ::ioctl ( fd, MIXER_WRITE( 0 ), &vol ); |
297 | ::close ( fd ); | 297 | ::close ( fd ); |
298 | } | 298 | } |
299 | #endif | 299 | #endif |
300 | } | 300 | } |
301 | 301 | ||
302 | 302 | ||
303 | bool SIMpad::suspend() // Must override because SIMpad does NOT have apm | 303 | bool SIMpad::suspend() // Must override because SIMpad does NOT have apm |
304 | { | 304 | { |
305 | qDebug( "ODevice for SIMpad: suspend()" ); | 305 | qDebug( "ODevice for SIMpad: suspend()" ); |
306 | if ( !isQWS( ) ) // only qwsserver is allowed to suspend | 306 | if ( !isQWS( ) ) // only qwsserver is allowed to suspend |
307 | return false; | 307 | return false; |
308 | 308 | ||
309 | bool res = false; | 309 | /* |
310 | ODevice::sendSuspendmsg(); | 310 | * we need to save the screen content |
311 | 311 | * then go to suspend using ODevice::suspend | |
312 | struct timeval tvs, tvn; | 312 | * and finally restore the screen content |
313 | ::gettimeofday ( &tvs, 0 ); | 313 | */ |
314 | (void)::system( "cat /dev/fb/0 > /tmp/.buffer" ); | ||
315 | bool res = ODevice::suspend(); | ||
314 | 316 | ||
315 | ::sync(); // flush fs caches | 317 | /* |
316 | res = ( ::system ( "cat /dev/fb/0 >/tmp/.buffer; echo > /proc/sys/pm/suspend; cat /tmp/.buffer >/dev/fb/0" ) == 0 ); //TODO make better :) | 318 | * restore |
319 | */ | ||
320 | if ( res ) | ||
321 | ::system( "cat /tmp/.buffer > /dev/fb/0" ); | ||
317 | 322 | ||
318 | return res; | 323 | return res; |
319 | } | 324 | } |
320 | 325 | ||
321 | 326 | ||
322 | bool SIMpad::setSoftSuspend ( bool soft ) | 327 | bool SIMpad::setSoftSuspend ( bool soft ) |
323 | { | 328 | { |
324 | qDebug( "ODevice for SIMpad: UNHANDLED setSoftSuspend(%s)", soft? "on" : "off" ); | 329 | qDebug( "ODevice for SIMpad: UNHANDLED setSoftSuspend(%s)", soft? "on" : "off" ); |
325 | return false; | 330 | return false; |
326 | } | 331 | } |
327 | 332 | ||
328 | 333 | ||
329 | bool SIMpad::setDisplayStatus ( bool on ) | 334 | bool SIMpad::setDisplayStatus ( bool on ) |
330 | { | 335 | { |
331 | qDebug( "ODevice for SIMpad: setDisplayStatus(%s)", on? "on" : "off" ); | 336 | qDebug( "ODevice for SIMpad: setDisplayStatus(%s)", on? "on" : "off" ); |
332 | 337 | ||
333 | bool res = false; | 338 | bool res = false; |
334 | int fd; | 339 | int fd; |
335 | 340 | ||
336 | QString cmdline = QString().sprintf( "echo %s > /proc/cs3", on ? "0xd41a" : "0xd40a" ); //TODO make better :) | 341 | QString cmdline = QString().sprintf( "echo %s > /proc/cs3", on ? "0xd41a" : "0xd40a" ); //TODO make better :) |
337 | 342 | ||
338 | res = ( ::system( (const char*) cmdline ) == 0 ); | 343 | res = ( ::system( (const char*) cmdline ) == 0 ); |
339 | 344 | ||
340 | return res; | 345 | return res; |