summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opiecore/device/device.pro2
-rw-r--r--libopie2/opiecore/device/odevice.cpp8
-rw-r--r--libopie2/opiecore/device/odevice.h4
-rw-r--r--libopie2/opiecore/device/odevice_genuineintel.cpp193
-rw-r--r--libopie2/opiecore/device/odevice_genuineintel.h84
5 files changed, 291 insertions, 0 deletions
diff --git a/libopie2/opiecore/device/device.pro b/libopie2/opiecore/device/device.pro
index 2c9e770..9a409e1 100644
--- a/libopie2/opiecore/device/device.pro
+++ b/libopie2/opiecore/device/device.pro
@@ -6,6 +6,7 @@ HEADERS += device/odevice.h \
6 device/odevice_ramses.h \ 6 device/odevice_ramses.h \
7 device/odevice_simpad.h \ 7 device/odevice_simpad.h \
8 device/odevice_zaurus.h \ 8 device/odevice_zaurus.h \
9 device/odevice_genuineintel.h \
9 device/odevice_yopy.h 10 device/odevice_yopy.h
10 11
11SOURCES += device/odevice.cpp \ 12SOURCES += device/odevice.cpp \
@@ -16,5 +17,6 @@ SOURCES += device/odevice.cpp \
16 device/odevice_ramses.cpp \ 17 device/odevice_ramses.cpp \
17 device/odevice_simpad.cpp \ 18 device/odevice_simpad.cpp \
18 device/odevice_zaurus.cpp \ 19 device/odevice_zaurus.cpp \
20 device/odevice_genuineintel.cpp \
19 device/odevice_yopy.cpp 21 device/odevice_yopy.cpp
20 22
diff --git a/libopie2/opiecore/device/odevice.cpp b/libopie2/opiecore/device/odevice.cpp
index 39b37cd..a824392 100644
--- a/libopie2/opiecore/device/odevice.cpp
+++ b/libopie2/opiecore/device/odevice.cpp
@@ -34,6 +34,7 @@
34#include "odevice_simpad.h" 34#include "odevice_simpad.h"
35#include "odevice_yopy.h" 35#include "odevice_yopy.h"
36#include "odevice_zaurus.h" 36#include "odevice_zaurus.h"
37#include "odevice_genuineintel.h"
37 38
38/* QT */ 39/* QT */
39#include <qapplication.h> 40#include <qapplication.h>
@@ -143,6 +144,13 @@ ODevice *ODevice::inst()
143 else if ( line.contains( "Tradesquare.NL", false ) ) dev = new Internal::Beagle(); 144 else if ( line.contains( "Tradesquare.NL", false ) ) dev = new Internal::Beagle();
144 else qWarning( "ODevice() - unknown hardware - using default." ); 145 else qWarning( "ODevice() - unknown hardware - using default." );
145 break; 146 break;
147 } else if ( line.startsWith( "vendor_id" ) ) {
148 qDebug( "ODevice() - found '%s'", (const char*) line );
149 cpu_info = line;
150 if( line.contains( "genuineintel", false ) ) {
151 dev = new Internal::GenuineIntel();
152 break;
153 }
146 } 154 }
147 } 155 }
148 } 156 }
diff --git a/libopie2/opiecore/device/odevice.h b/libopie2/opiecore/device/odevice.h
index 21fcc3f..93d7d22 100644
--- a/libopie2/opiecore/device/odevice.h
+++ b/libopie2/opiecore/device/odevice.h
@@ -107,6 +107,8 @@ enum OModel {
107 Model_Beagle_All = ( Model_Beagle | 0xffffff ), 107 Model_Beagle_All = ( Model_Beagle | 0xffffff ),
108 Model_Beagle_PA100 = ( Model_Beagle | 0x000001 ), 108 Model_Beagle_PA100 = ( Model_Beagle | 0x000001 ),
109 109
110 Model_GenuineIntel = ( 7 << 24 )
111
110}; 112};
111 113
112/** 114/**
@@ -121,6 +123,7 @@ enum OVendor {
121 Vendor_MundN, 123 Vendor_MundN,
122 Vendor_GMate, 124 Vendor_GMate,
123 Vendor_MasterIA, 125 Vendor_MasterIA,
126 Vendor_GenuineIntel
124}; 127};
125 128
126/** 129/**
@@ -134,6 +137,7 @@ enum OSystem {
134 System_OpenZaurus, 137 System_OpenZaurus,
135 System_Linupy, 138 System_Linupy,
136 System_OpenEmbedded, 139 System_OpenEmbedded,
140 System_PC
137}; 141};
138 142
139typedef struct { 143typedef struct {
diff --git a/libopie2/opiecore/device/odevice_genuineintel.cpp b/libopie2/opiecore/device/odevice_genuineintel.cpp
new file mode 100644
index 0000000..61ba052
--- a/dev/null
+++ b/libopie2/opiecore/device/odevice_genuineintel.cpp
@@ -0,0 +1,193 @@
1/*
2                 This file is part of the Opie Project
3              Copyright (C) 2002,2003,2004 The Opie Team <opie-devel@handhelds.org>
4 =.
5 .=l.
6           .>+-=
7 _;:,     .>    :=|. This program is free software; you can
8.> <`_,   >  .   <= redistribute it and/or modify it under
9:`=1 )Y*s>-.--   : the terms of the GNU Library General Public
10.="- .-=="i,     .._ License as published by the Free Software
11 - .   .-<_>     .<> Foundation; either version 2 of the License,
12     ._= =}       : or (at your option) any later version.
13    .%`+i>       _;_.
14    .i_,=:_.      -<s. This program is distributed in the hope that
15     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
16    : ..    .:,     . . . without even the implied warranty of
17    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
18  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
19..}^=.=       =       ; Library General Public License for more
20++=   -.     .`     .: details.
21 :     =  ...= . :.=-
22 -.   .:....=;==+<; You should have received a copy of the GNU
23  -_. . .   )=.  = Library General Public License along with
24    --        :-=` this library; see the file COPYING.LIB.
25 If not, write to the Free Software Foundation,
26 Inc., 59 Temple Place - Suite 330,
27 Boston, MA 02111-1307, USA.
28*/
29
30#include "odevice_genuineintel.h"
31
32/* QT */
33#include <qapplication.h>
34#include <qfile.h>
35#include <qtextstream.h>
36#include <qwindowsystem_qws.h>
37
38/* OPIE */
39#include <qpe/config.h>
40#include <qpe/resource.h>
41#include <qpe/sound.h>
42#include <qpe/qcopenvelope_qws.h>
43#include <opie2/okeyfilter.h>
44
45#ifndef QT_NO_SOUND
46#include <linux/soundcard.h>
47#endif
48
49using namespace Opie::Core;
50using namespace Opie::Core::Internal;
51
52struct gi_button genuineintel_buttons [] = {
53 {
54 Qt::Key_F1, QT_TRANSLATE_NOOP("Button", "Calendar Button"),
55 "devicebuttons/ipaq_calendar",
56 "datebook", "nextView()",
57 "today", "raise()" },
58 {
59 Qt::Key_F2, QT_TRANSLATE_NOOP("Button", "Contacts Button"),
60 "devicebuttons/ipaq_contact",
61 "addressbook", "raise()",
62 "addressbook", "beamBusinessCard()" },
63 {
64 Qt::Key_F3, QT_TRANSLATE_NOOP("Button", "Menu Button"),
65 "devicebuttons/ipaq_menu",
66 "QPE/TaskBar", "toggleMenu()",
67 "QPE/TaskBar", "toggleStartMenu()" },
68 {
69 Qt::Key_F4, QT_TRANSLATE_NOOP("Button", "Mail Button"),
70 "devicebuttons/ipaq_mail",
71 "opiemail", "raise()",
72 "opiemail", "newMail()" },
73 {
74 Qt::Key_F5, QT_TRANSLATE_NOOP("Button", "Home Button"),
75 "devicebuttons/ipaq_home",
76 "QPE/Launcher", "home()",
77 "buttonsettings", "raise()" },
78 {
79 Qt::Key_F6, QT_TRANSLATE_NOOP("Button", "Record Button"),
80 "devicebuttons/ipaq_record",
81 "QPE/VMemo", "toggleRecord()",
82 "sound", "raise()" },
83};
84
85void GenuineIntel::init(const QString& model)
86{
87 d->m_vendorstr = "Intel";
88 d->m_vendor = Vendor_GenuineIntel;
89
90 QStringList SL = QStringList::split( " ", model );
91
92 d->m_model = Model_GenuineIntel;
93 d->m_rotation = Rot0;
94}
95
96void GenuineIntel::initButtons()
97{
98 if ( d->m_buttons )
99 return;
100
101 if ( isQWS( ) ) {
102 addPreHandler(this);
103 }
104
105 d->m_buttons = new QValueList <ODeviceButton>;
106
107 for ( uint i = 0; i < ( sizeof( genuineintel_buttons ) / sizeof( gi_button )); i++ ) {
108 gi_button *ib = genuineintel_buttons + i;
109 ODeviceButton b;
110
111 b. setKeycode ( ib->code );
112 b. setUserText ( QObject::tr ( "Button", ib->utext ));
113 b. setPixmap ( Resource::loadPixmap ( ib->pix ));
114 b. setFactoryPresetPressedAction ( OQCopMessage ( makeChannel ( ib->fpressedservice ), ib->fpressedaction ));
115 b. setFactoryPresetHeldAction ( OQCopMessage ( makeChannel ( ib->fheldservice ), ib->fheldaction ));
116
117 d->m_buttons->append ( b );
118 }
119 reloadButtonMapping();
120}
121
122QValueList <OLed> GenuineIntel::ledList() const
123{
124 QValueList <OLed> vl;
125 return vl; //none
126}
127
128QValueList <OLedState> GenuineIntel::ledStateList ( OLed ) const
129{
130 QValueList <OLedState> vl;
131 return vl; // none
132}
133
134OLedState GenuineIntel::ledState ( OLed ) const
135{
136 return Led_Off;
137}
138
139bool GenuineIntel::setLedState ( OLed , OLedState )
140{
141 return false;
142}
143
144
145bool GenuineIntel::filter ( int /*unicode*/, int , int , bool , bool )
146{
147 return false;
148}
149
150void GenuineIntel::playAlarmSound()
151{
152#ifndef QT_NO_SOUND
153 static Sound snd ( "alarm" );
154 if(!snd.isFinished())
155 return;
156
157 changeMixerForAlarm(0, "/dev/sound/mixer", &snd );
158 snd. play();
159#endif
160}
161
162
163bool GenuineIntel::setSoftSuspend ( bool )
164{
165 return false;
166}
167
168
169bool GenuineIntel::setDisplayBrightness ( int )
170{
171 return false;
172}
173
174int GenuineIntel::displayBrightnessResolution() const
175{
176 return 1; // perhaps to avoid division by zero
177}
178
179
180bool GenuineIntel::hasLightSensor() const
181{
182 return false;
183}
184
185int GenuineIntel::readLightSensor()
186{
187 return 0;
188}
189
190int GenuineIntel::lightSensorResolution() const
191{
192 return 1; // see above
193}
diff --git a/libopie2/opiecore/device/odevice_genuineintel.h b/libopie2/opiecore/device/odevice_genuineintel.h
new file mode 100644
index 0000000..52c5fc6
--- a/dev/null
+++ b/libopie2/opiecore/device/odevice_genuineintel.h
@@ -0,0 +1,84 @@
1/*
2                 This file is part of the Opie Project
3              Copyright (C) The Opie Team <opie-devel@handhelds.org>
4 =.
5 .=l.
6           .>+-=
7 _;:,     .>    :=|. This program is free software; you can
8.> <`_,   >  .   <= redistribute it and/or modify it under
9:`=1 )Y*s>-.--   : the terms of the GNU Library General Public
10.="- .-=="i,     .._ License as published by the Free Software
11 - .   .-<_>     .<> Foundation; either version 2 of the License,
12     ._= =}       : or (at your option) any later version.
13    .%`+i>       _;_.
14    .i_,=:_.      -<s. This program is distributed in the hope that
15     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
16    : ..    .:,     . . . without even the implied warranty of
17    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
18  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
19..}^=.=       =       ; Library General Public License for more
20++=   -.     .`     .: details.
21 :     =  ...= . :.=-
22 -.   .:....=;==+<; You should have received a copy of the GNU
23  -_. . .   )=.  = Library General Public License along with
24    --        :-=` this library; see the file COPYING.LIB.
25 If not, write to the Free Software Foundation,
26 Inc., 59 Temple Place - Suite 330,
27 Boston, MA 02111-1307, USA.
28*/
29
30#ifndef ODEVICE_GENUINEINTEL
31#define ODEVICE_GENUINEINTEL
32
33#include "odevice.h"
34
35/* QT */
36#include <qwindowsystem_qws.h>
37
38namespace Opie {
39namespace Core {
40namespace Internal {
41
42class GenuineIntel : public ODevice, public QWSServer::KeyboardFilter
43{
44
45 protected:
46 virtual void init(const QString&);
47 virtual void initButtons();
48
49 public:
50 virtual bool setSoftSuspend( bool soft );
51
52 virtual bool setDisplayBrightness( int b );
53 virtual int displayBrightnessResolution() const;
54
55 virtual void playAlarmSound();
56
57 virtual QValueList <OLed> ledList() const;
58 virtual QValueList <OLedState> ledStateList( OLed led ) const;
59 virtual OLedState ledState( OLed led ) const;
60 virtual bool setLedState( OLed led, OLedState st );
61
62 virtual bool hasLightSensor() const;
63 virtual int readLightSensor();
64 virtual int lightSensorResolution() const;
65 protected:
66 virtual bool filter( int unicode, int keycode, int modifiers, bool isPress, bool autoRepeat );
67
68};
69
70struct gi_button {
71 Qt::Key code;
72 char *utext;
73 char *pix;
74 char *fpressedservice;
75 char *fpressedaction;
76 char *fheldservice;
77 char *fheldaction;
78};
79
80}
81}
82}
83
84#endif