summaryrefslogtreecommitdiff
path: root/libopie2/opiecore/device/odevice.cpp
Unidiff
Diffstat (limited to 'libopie2/opiecore/device/odevice.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opiecore/device/odevice.cpp48
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
65namespace Opie { 67namespace Opie {
66namespace Core { 68namespace Core {
67 69
68static const char* PATH_PROC_CPUINFO = "/proc/cpuinfo"; 70static 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
219void ODevice::init(const QString&) 221void 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*/
226void ODevice::initButtons() 228void 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
247ODevice::~ODevice() 249ODevice::~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