Diffstat (limited to 'libopie2/opiecore/device/odevice.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | libopie2/opiecore/device/odevice.cpp | 48 |
1 files changed, 25 insertions, 23 deletions
diff --git a/libopie2/opiecore/device/odevice.cpp b/libopie2/opiecore/device/odevice.cpp index fcdbf45..dd1e2f3 100644 --- a/libopie2/opiecore/device/odevice.cpp +++ b/libopie2/opiecore/device/odevice.cpp | |||
@@ -1,75 +1,77 @@ | |||
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 | |
4 | Copyright (C)2002-2005 The Opie Team <opie-devel@handhelds.org> | ||
4 | =. | 5 | =. |
5 | .=l. | 6 | .=l. |
6 | .>+-= | 7 | Â Â Â Â Â Â .>+-= |
7 | _;:, .> :=|. This program is free software; you can | 8 | Â _;:, Â Â .> Â Â :=|. This program is free software; you can |
8 | .> <`_, > . <= redistribute it and/or modify it under | 9 | .> <`_, Â > Â . Â <= redistribute it and/or modify it under |
9 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public | 10 | :`=1 )Y*s>-.-- Â : the terms of the GNU Library General Public |
10 | .="- .-=="i, .._ License as published by the Free Software | 11 | .="- .-=="i, Â Â .._ License as published by the Free Software |
11 | - . .-<_> .<> Foundation; either version 2 of the License, | 12 | Â - . Â .-<_> Â Â .<> Foundation; either version 2 of the License, |
12 | ._= =} : or (at your option) any later version. | 13 | Â Â Â ._= =} Â Â Â : or (at your option) any later version. |
13 | .%`+i> _;_. | 14 | Â Â .%`+i> Â Â Â _;_. |
14 | .i_,=:_. -<s. This program is distributed in the hope that | 15 | Â Â .i_,=:_. Â Â Â -<s. This program is distributed in the hope that |
15 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 16 | Â Â Â + Â . Â -:. Â Â Â = it will be useful, but WITHOUT ANY WARRANTY; |
16 | : .. .:, . . . without even the implied warranty of | 17 | : .. Â Â .:, Â Â . . . without even the implied warranty of |
17 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 18 | Â Â =_ Â Â Â Â + Â Â =;=|` MERCHANTABILITY or FITNESS FOR A |
18 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | 19 | Â _.=:. Â Â Â : Â Â :=>`: PARTICULAR PURPOSE. See the GNU |
19 | ..}^=.= = ; Library General Public License for more | 20 | ..}^=.= Â Â Â = Â Â Â ; Library General Public License for more |
20 | ++= -. .` .: details. | 21 | ++= Â -. Â Â .` Â Â .: details. |
21 | : = ...= . :.=- | 22 | : Â Â = Â ...= . :.=- |
22 | -. .:....=;==+<; You should have received a copy of the GNU | 23 | Â -. Â .:....=;==+<; You should have received a copy of the GNU |
23 | -_. . . )=. = Library General Public License along with | 24 | Â -_. . . Â )=. Â = Library General Public License along with |
24 | -- :-=` this library; see the file COPYING.LIB. | 25 | Â Â -- Â Â Â Â :-=` this library; see the file COPYING.LIB. |
25 | If not, write to the Free Software Foundation, | 26 | If not, write to the Free Software Foundation, |
26 | Inc., 59 Temple Place - Suite 330, | 27 | Inc., 59 Temple Place - Suite 330, |
27 | Boston, MA 02111-1307, USA. | 28 | Boston, MA 02111-1307, USA. |
28 | */ | 29 | */ |
29 | 30 | ||
30 | #include "odevice_beagle.h" | 31 | #include "odevice_beagle.h" |
31 | #include "odevice_ipaq.h" | 32 | #include "odevice_ipaq.h" |
32 | #include "odevice_jornada.h" | 33 | #include "odevice_jornada.h" |
33 | #include "odevice_ramses.h" | 34 | #include "odevice_ramses.h" |
34 | #include "odevice_simpad.h" | 35 | #include "odevice_simpad.h" |
35 | #include "odevice_yopy.h" | 36 | #include "odevice_yopy.h" |
36 | #include "odevice_zaurus.h" | 37 | #include "odevice_zaurus.h" |
37 | #include "odevice_genuineintel.h" | 38 | #include "odevice_genuineintel.h" |
38 | 39 | ||
39 | /* QT */ | 40 | /* QT */ |
40 | #include <qapplication.h> | 41 | #include <qapplication.h> |
41 | #include <qfile.h> | 42 | #include <qfile.h> |
42 | #include <qtextstream.h> | 43 | #include <qtextstream.h> |
43 | #include <qwindowsystem_qws.h> | 44 | #include <qwindowsystem_qws.h> |
44 | 45 | ||
45 | /* OPIE */ | 46 | /* OPIE */ |
46 | #include <qpe/config.h> | 47 | #include <qpe/config.h> |
47 | #include <qpe/resource.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 | #include <opie2/okeyfilter.h> | 52 | #include <opie2/okeyfilter.h> |
53 | #include <opie2/oresource.h> | ||
52 | 54 | ||
53 | /* STD */ | 55 | /* STD */ |
54 | #include <fcntl.h> | 56 | #include <fcntl.h> |
55 | #include <math.h> | 57 | #include <math.h> |
56 | #include <stdlib.h> | 58 | #include <stdlib.h> |
57 | #include <signal.h> | 59 | #include <signal.h> |
58 | #include <sys/ioctl.h> | 60 | #include <sys/ioctl.h> |
59 | #include <sys/time.h> | 61 | #include <sys/time.h> |
60 | #include <unistd.h> | 62 | #include <unistd.h> |
61 | #ifndef QT_NO_SOUND | 63 | #ifndef QT_NO_SOUND |
62 | #include <linux/soundcard.h> | 64 | #include <linux/soundcard.h> |
63 | #endif | 65 | #endif |
64 | 66 | ||
65 | namespace Opie { | 67 | namespace Opie { |
66 | namespace Core { | 68 | namespace Core { |
67 | 69 | ||
68 | static const char* PATH_PROC_CPUINFO = "/proc/cpuinfo"; | 70 | static const char* PATH_PROC_CPUINFO = "/proc/cpuinfo"; |
69 | 71 | ||
70 | 72 | ||
71 | /* STATIC and common implementation */ | 73 | /* STATIC and common implementation */ |
72 | /* EXPORT */ ODistribution distributions[] = { | 74 | /* EXPORT */ ODistribution distributions[] = { |
73 | { System_Familiar, "FamiliarLinux", "/etc/familiar-version" }, | 75 | { System_Familiar, "FamiliarLinux", "/etc/familiar-version" }, |
74 | { System_OpenZaurus, "OpenZaurus", "/etc/oz_version" }, | 76 | { System_OpenZaurus, "OpenZaurus", "/etc/oz_version" }, |
75 | { System_OpenEmbedded, "OpenEmbedded", "/etc/oe-version" }, | 77 | { System_OpenEmbedded, "OpenEmbedded", "/etc/oe-version" }, |
@@ -214,49 +216,49 @@ void ODevice::systemMessage( const QCString &msg, const QByteArray & ) | |||
214 | if ( msg == "deviceButtonMappingChanged()" ) { | 216 | if ( msg == "deviceButtonMappingChanged()" ) { |
215 | reloadButtonMapping(); | 217 | reloadButtonMapping(); |
216 | } | 218 | } |
217 | } | 219 | } |
218 | 220 | ||
219 | void ODevice::init(const QString&) | 221 | void ODevice::init(const QString&) |
220 | { | 222 | { |
221 | } | 223 | } |
222 | 224 | ||
223 | /** | 225 | /** |
224 | * This method initialises the button mapping | 226 | * This method initialises the button mapping |
225 | */ | 227 | */ |
226 | void ODevice::initButtons() | 228 | void ODevice::initButtons() |
227 | { | 229 | { |
228 | if ( d->m_buttons ) | 230 | if ( d->m_buttons ) |
229 | return; | 231 | return; |
230 | 232 | ||
231 | qDebug ( "init Buttons" ); | 233 | qDebug ( "init Buttons" ); |
232 | d->m_buttons = new QValueList <ODeviceButton>; | 234 | d->m_buttons = new QValueList <ODeviceButton>; |
233 | 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++ ) { |
234 | default_button *db = default_buttons + i; | 236 | default_button *db = default_buttons + i; |
235 | ODeviceButton b; | 237 | ODeviceButton b; |
236 | b. setKeycode ( db->code ); | 238 | b. setKeycode ( db->code ); |
237 | b. setUserText ( QObject::tr ( "Button", db->utext )); | 239 | b. setUserText ( QObject::tr ( "Button", db->utext )); |
238 | b. setPixmap ( Resource::loadPixmap ( db->pix )); | 240 | b. setPixmap ( OResource::loadPixmap ( db->pix )); |
239 | b. setFactoryPresetPressedAction ( OQCopMessage ( makeChannel ( db->fpressedservice ), db->fpressedaction )); | 241 | b. setFactoryPresetPressedAction ( OQCopMessage ( makeChannel ( db->fpressedservice ), db->fpressedaction )); |
240 | b. setFactoryPresetHeldAction ( OQCopMessage ( makeChannel ( db->fheldservice ), db->fheldaction )); | 242 | b. setFactoryPresetHeldAction ( OQCopMessage ( makeChannel ( db->fheldservice ), db->fheldaction )); |
241 | d->m_buttons->append ( b ); | 243 | d->m_buttons->append ( b ); |
242 | } | 244 | } |
243 | 245 | ||
244 | reloadButtonMapping(); | 246 | reloadButtonMapping(); |
245 | } | 247 | } |
246 | 248 | ||
247 | ODevice::~ODevice() | 249 | ODevice::~ODevice() |
248 | { | 250 | { |
249 | // we leak m_devicebuttons and m_cpu_frequency | 251 | // we leak m_devicebuttons and m_cpu_frequency |
250 | // but it's a singleton and it is not so importantant | 252 | // but it's a singleton and it is not so importantant |
251 | // -zecke | 253 | // -zecke |
252 | delete d; | 254 | delete d; |
253 | } | 255 | } |
254 | 256 | ||
255 | /** | 257 | /** |
256 | * This method will try to suspend the device | 258 | * This method will try to suspend the device |
257 | * 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 |
258 | * is installed. | 260 | * is installed. |
259 | * 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 |
260 | * do have asynchronus apm implementations. | 262 | * do have asynchronus apm implementations. |
261 | * 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 |
262 | * device and return once the device got woken up | 264 | * device and return once the device got woken up |