summaryrefslogtreecommitdiff
authorwimpie <wimpie>2005-01-04 01:29:55 (UTC)
committer wimpie <wimpie>2005-01-04 01:29:55 (UTC)
commit5199338e990284244b8fe540d3fb4a36b24bae82 (patch) (unidiff)
treebbd17e6ab0998379a1a032851d27d78bd5db201f
parent1708efc66ceab63d93960a523e247bcbfafe6e7f (diff)
downloadopie-5199338e990284244b8fe540d3fb4a36b24bae82.zip
opie-5199338e990284244b8fe540d3fb4a36b24bae82.tar.gz
opie-5199338e990284244b8fe540d3fb4a36b24bae82.tar.bz2
added odevice_genuine for pure INTEL based CPU
-> needed for system dependend applications. being LIKE -> an IPAQ is not enough
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
@@ -1,20 +1,22 @@
1HEADERS += device/odevice.h \ 1HEADERS += device/odevice.h \
2 device/odevicebutton.h \ 2 device/odevicebutton.h \
3 device/odevice_beagle.h \ 3 device/odevice_beagle.h \
4 device/odevice_ipaq.h \ 4 device/odevice_ipaq.h \
5 device/odevice_jornada.h \ 5 device/odevice_jornada.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 \
12 device/odevicebutton.cpp \ 13 device/odevicebutton.cpp \
13 device/odevice_beagle.cpp \ 14 device/odevice_beagle.cpp \
14 device/odevice_ipaq.cpp \ 15 device/odevice_ipaq.cpp \
15 device/odevice_jornada.cpp\ 16 device/odevice_jornada.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
@@ -21,32 +21,33 @@
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_beagle.h" 30#include "odevice_beagle.h"
31#include "odevice_ipaq.h" 31#include "odevice_ipaq.h"
32#include "odevice_jornada.h" 32#include "odevice_jornada.h"
33#include "odevice_ramses.h" 33#include "odevice_ramses.h"
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>
40#include <qfile.h> 41#include <qfile.h>
41#include <qtextstream.h> 42#include <qtextstream.h>
42#include <qwindowsystem_qws.h> 43#include <qwindowsystem_qws.h>
43 44
44/* OPIE */ 45/* OPIE */
45#include <qpe/config.h> 46#include <qpe/config.h>
46#include <qpe/resource.h> 47#include <qpe/resource.h>
47#include <qpe/sound.h> 48#include <qpe/sound.h>
48#include <qpe/qcopenvelope_qws.h> 49#include <qpe/qcopenvelope_qws.h>
49#include <qpe/sound.h> 50#include <qpe/sound.h>
50#include <opie2/okeyfilter.h> 51#include <opie2/okeyfilter.h>
51 52
52/* STD */ 53/* STD */
@@ -130,32 +131,39 @@ ODevice *ODevice::inst()
130 while ( !s.atEnd() ) 131 while ( !s.atEnd() )
131 { 132 {
132 QString line; 133 QString line;
133 line = s.readLine(); 134 line = s.readLine();
134 if ( line.startsWith( "Hardware" ) ) 135 if ( line.startsWith( "Hardware" ) )
135 { 136 {
136 qDebug( "ODevice() - found '%s'", (const char*) line ); 137 qDebug( "ODevice() - found '%s'", (const char*) line );
137 cpu_info = line; 138 cpu_info = line;
138 if ( line.contains( "sharp", false ) ) dev = new Internal::Zaurus(); 139 if ( line.contains( "sharp", false ) ) dev = new Internal::Zaurus();
139 else if ( line.contains( "ipaq", false ) ) dev = new Internal::iPAQ(); 140 else if ( line.contains( "ipaq", false ) ) dev = new Internal::iPAQ();
140 else if ( line.contains( "simpad", false ) ) dev = new Internal::SIMpad(); 141 else if ( line.contains( "simpad", false ) ) dev = new Internal::SIMpad();
141 else if ( line.contains( "jornada", false ) ) dev = new Internal::Jornada(); 142 else if ( line.contains( "jornada", false ) ) dev = new Internal::Jornada();
142 else if ( line.contains( "ramses", false ) ) dev = new Internal::Ramses(); 143 else if ( line.contains( "ramses", false ) ) dev = new Internal::Ramses();
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 }
149 else 157 else
150 { 158 {
151 qWarning( "ODevice() - can't open '%s' - unknown hardware - using default.", PATH_PROC_CPUINFO ); 159 qWarning( "ODevice() - can't open '%s' - unknown hardware - using default.", PATH_PROC_CPUINFO );
152 } 160 }
153 if ( !dev ) dev = new ODevice(); 161 if ( !dev ) dev = new ODevice();
154 dev->init(cpu_info); 162 dev->init(cpu_info);
155 } 163 }
156 return dev; 164 return dev;
157} 165}
158 166
159ODevice::ODevice() 167ODevice::ODevice()
160{ 168{
161 d = new ODeviceData; 169 d = new ODeviceData;
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
@@ -94,59 +94,63 @@ enum OModel {
94 Model_Ramses_All = ( Model_Ramses | 0xffffff ), 94 Model_Ramses_All = ( Model_Ramses | 0xffffff ),
95 Model_Ramses_MNCI = ( Model_Ramses | 0x000001 ), 95 Model_Ramses_MNCI = ( Model_Ramses | 0x000001 ),
96 Model_Ramses_MNCIRX = ( Model_Ramses | 0x000002 ), 96 Model_Ramses_MNCIRX = ( Model_Ramses | 0x000002 ),
97 97
98 Model_Yopy = ( 5 << 24 ), 98 Model_Yopy = ( 5 << 24 ),
99 99
100 Model_Yopy_All = ( Model_Yopy | 0xffffff ), 100 Model_Yopy_All = ( Model_Yopy | 0xffffff ),
101 Model_Yopy_3000 = ( Model_Yopy | 0x000001 ), 101 Model_Yopy_3000 = ( Model_Yopy | 0x000001 ),
102 Model_Yopy_3500 = ( Model_Yopy | 0x000002 ), 102 Model_Yopy_3500 = ( Model_Yopy | 0x000002 ),
103 Model_Yopy_3700 = ( Model_Yopy | 0x000003 ), 103 Model_Yopy_3700 = ( Model_Yopy | 0x000003 ),
104 104
105 Model_Beagle = ( 6 << 24 ), 105 Model_Beagle = ( 6 << 24 ),
106 106
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/**
113 * The vendor of the device 115 * The vendor of the device
114 */ 116 */
115enum OVendor { 117enum OVendor {
116 Vendor_Unknown, 118 Vendor_Unknown,
117 119
118 Vendor_HP, 120 Vendor_HP,
119 Vendor_Sharp, 121 Vendor_Sharp,
120 Vendor_SIEMENS, 122 Vendor_SIEMENS,
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/**
127 * The System used 130 * The System used
128 */ 131 */
129enum OSystem { 132enum OSystem {
130 System_Unknown, 133 System_Unknown,
131 134
132 System_Familiar, 135 System_Familiar,
133 System_Zaurus, 136 System_Zaurus,
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 {
140 OSystem system; 144 OSystem system;
141 char* sysstr; 145 char* sysstr;
142 char* sysvfile; 146 char* sysvfile;
143} ODistribution; 147} ODistribution;
144 148
145extern ODistribution distributions[]; 149extern ODistribution distributions[];
146 150
147 151
148enum OLedState { 152enum OLedState {
149 Led_Off, 153 Led_Off,
150 Led_On, 154 Led_On,
151 Led_BlinkSlow, 155 Led_BlinkSlow,
152 Led_BlinkFast 156 Led_BlinkFast
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