author | wimpie <wimpie> | 2005-01-04 01:29:55 (UTC) |
---|---|---|
committer | wimpie <wimpie> | 2005-01-04 01:29:55 (UTC) |
commit | 5199338e990284244b8fe540d3fb4a36b24bae82 (patch) (unidiff) | |
tree | bbd17e6ab0998379a1a032851d27d78bd5db201f | |
parent | 1708efc66ceab63d93960a523e247bcbfafe6e7f (diff) | |
download | opie-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
-rw-r--r-- | libopie2/opiecore/device/device.pro | 2 | ||||
-rw-r--r-- | libopie2/opiecore/device/odevice.cpp | 8 | ||||
-rw-r--r-- | libopie2/opiecore/device/odevice.h | 4 | ||||
-rw-r--r-- | libopie2/opiecore/device/odevice_genuineintel.cpp | 193 | ||||
-rw-r--r-- | libopie2/opiecore/device/odevice_genuineintel.h | 84 |
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 @@ | |||
1 | HEADERS += device/odevice.h \ | 1 | HEADERS += 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 | ||
11 | SOURCES += device/odevice.cpp \ | 12 | SOURCES += 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 | |||
@@ -1,241 +1,249 @@ | |||
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_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 */ |
53 | #include <fcntl.h> | 54 | #include <fcntl.h> |
54 | #include <math.h> | 55 | #include <math.h> |
55 | #include <stdlib.h> | 56 | #include <stdlib.h> |
56 | #include <signal.h> | 57 | #include <signal.h> |
57 | #include <sys/ioctl.h> | 58 | #include <sys/ioctl.h> |
58 | #include <sys/time.h> | 59 | #include <sys/time.h> |
59 | #include <unistd.h> | 60 | #include <unistd.h> |
60 | #ifndef QT_NO_SOUND | 61 | #ifndef QT_NO_SOUND |
61 | #include <linux/soundcard.h> | 62 | #include <linux/soundcard.h> |
62 | #endif | 63 | #endif |
63 | 64 | ||
64 | namespace Opie { | 65 | namespace Opie { |
65 | namespace Core { | 66 | namespace Core { |
66 | 67 | ||
67 | static const char* PATH_PROC_CPUINFO = "/proc/cpuinfo"; | 68 | static const char* PATH_PROC_CPUINFO = "/proc/cpuinfo"; |
68 | 69 | ||
69 | 70 | ||
70 | /* STATIC and common implementation */ | 71 | /* STATIC and common implementation */ |
71 | /* EXPORT */ ODistribution distributions[] = { | 72 | /* EXPORT */ ODistribution distributions[] = { |
72 | { System_Familiar, "FamiliarLinux", "/etc/familiar-version" }, | 73 | { System_Familiar, "FamiliarLinux", "/etc/familiar-version" }, |
73 | { System_OpenZaurus, "OpenZaurus", "/etc/oz_version" }, | 74 | { System_OpenZaurus, "OpenZaurus", "/etc/oz_version" }, |
74 | { System_OpenEmbedded, "OpenEmbedded", "/etc/oe-version" }, | 75 | { System_OpenEmbedded, "OpenEmbedded", "/etc/oe-version" }, |
75 | { System_Unknown, "Linux", "/etc/issue" }, | 76 | { System_Unknown, "Linux", "/etc/issue" }, |
76 | }; | 77 | }; |
77 | 78 | ||
78 | 79 | ||
79 | /* EXPORT */ bool isQWS(){ | 80 | /* EXPORT */ bool isQWS(){ |
80 | return qApp ? ( qApp->type() == QApplication::GuiServer ) : false; | 81 | return qApp ? ( qApp->type() == QApplication::GuiServer ) : false; |
81 | } | 82 | } |
82 | 83 | ||
83 | /* EXPORT */ QCString makeChannel ( const char *str ){ | 84 | /* EXPORT */ QCString makeChannel ( const char *str ){ |
84 | if ( str && !::strchr ( str, '/' )) | 85 | if ( str && !::strchr ( str, '/' )) |
85 | return QCString ( "QPE/Application/" ) + str; | 86 | return QCString ( "QPE/Application/" ) + str; |
86 | else | 87 | else |
87 | return str; | 88 | return str; |
88 | } | 89 | } |
89 | 90 | ||
90 | 91 | ||
91 | 92 | ||
92 | /* Now the default implementation of ODevice */ | 93 | /* Now the default implementation of ODevice */ |
93 | 94 | ||
94 | struct default_button default_buttons [] = { | 95 | struct default_button default_buttons [] = { |
95 | { Qt::Key_F9, QT_TRANSLATE_NOOP("Button", "Calendar Button"), | 96 | { Qt::Key_F9, QT_TRANSLATE_NOOP("Button", "Calendar Button"), |
96 | "devicebuttons/z_calendar", | 97 | "devicebuttons/z_calendar", |
97 | "datebook", "nextView()", | 98 | "datebook", "nextView()", |
98 | "today", "raise()" }, | 99 | "today", "raise()" }, |
99 | { Qt::Key_F10, QT_TRANSLATE_NOOP("Button", "Contacts Button"), | 100 | { Qt::Key_F10, QT_TRANSLATE_NOOP("Button", "Contacts Button"), |
100 | "devicebuttons/z_contact", | 101 | "devicebuttons/z_contact", |
101 | "addressbook", "raise()", | 102 | "addressbook", "raise()", |
102 | "addressbook", "beamBusinessCard()" }, | 103 | "addressbook", "beamBusinessCard()" }, |
103 | { Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Home Button"), | 104 | { Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Home Button"), |
104 | "devicebuttons/z_home", | 105 | "devicebuttons/z_home", |
105 | "QPE/Launcher", "home()", | 106 | "QPE/Launcher", "home()", |
106 | "buttonsettings", "raise()" }, | 107 | "buttonsettings", "raise()" }, |
107 | { Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Menu Button"), | 108 | { Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Menu Button"), |
108 | "devicebuttons/z_menu", | 109 | "devicebuttons/z_menu", |
109 | "QPE/TaskBar", "toggleMenu()", | 110 | "QPE/TaskBar", "toggleMenu()", |
110 | "QPE/TaskBar", "toggleStartMenu()" }, | 111 | "QPE/TaskBar", "toggleStartMenu()" }, |
111 | { Qt::Key_F13, QT_TRANSLATE_NOOP("Button", "Mail Button"), | 112 | { Qt::Key_F13, QT_TRANSLATE_NOOP("Button", "Mail Button"), |
112 | "devicebuttons/z_mail", | 113 | "devicebuttons/z_mail", |
113 | "opiemail", "raise()", | 114 | "opiemail", "raise()", |
114 | "opiemail", "newMail()" }, | 115 | "opiemail", "newMail()" }, |
115 | }; | 116 | }; |
116 | 117 | ||
117 | ODevice *ODevice::inst() | 118 | ODevice *ODevice::inst() |
118 | { | 119 | { |
119 | static ODevice *dev = 0; | 120 | static ODevice *dev = 0; |
120 | 121 | ||
121 | // rewrite this to only use /proc/cpuinfo or so | 122 | // rewrite this to only use /proc/cpuinfo or so |
122 | QString cpu_info; | 123 | QString cpu_info; |
123 | 124 | ||
124 | if ( !dev ) | 125 | if ( !dev ) |
125 | { | 126 | { |
126 | QFile f( PATH_PROC_CPUINFO ); | 127 | QFile f( PATH_PROC_CPUINFO ); |
127 | if ( f.open( IO_ReadOnly ) ) | 128 | if ( f.open( IO_ReadOnly ) ) |
128 | { | 129 | { |
129 | QTextStream s( &f ); | 130 | QTextStream s( &f ); |
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 | ||
159 | ODevice::ODevice() | 167 | ODevice::ODevice() |
160 | { | 168 | { |
161 | d = new ODeviceData; | 169 | d = new ODeviceData; |
162 | 170 | ||
163 | d->m_modelstr = "Unknown"; | 171 | d->m_modelstr = "Unknown"; |
164 | d->m_model = Model_Unknown; | 172 | d->m_model = Model_Unknown; |
165 | d->m_vendorstr = "Unknown"; | 173 | d->m_vendorstr = "Unknown"; |
166 | d->m_vendor = Vendor_Unknown; | 174 | d->m_vendor = Vendor_Unknown; |
167 | d->m_systemstr = "Unknown"; | 175 | d->m_systemstr = "Unknown"; |
168 | d->m_system = System_Unknown; | 176 | d->m_system = System_Unknown; |
169 | d->m_sysverstr = "0.0"; | 177 | d->m_sysverstr = "0.0"; |
170 | d->m_rotation = Rot0; | 178 | d->m_rotation = Rot0; |
171 | d->m_direction = CW; | 179 | d->m_direction = CW; |
172 | 180 | ||
173 | d->m_holdtime = 1000; // 1000ms | 181 | d->m_holdtime = 1000; // 1000ms |
174 | d->m_buttons = 0; | 182 | d->m_buttons = 0; |
175 | d->m_cpu_frequencies = new QStrList; | 183 | d->m_cpu_frequencies = new QStrList; |
176 | 184 | ||
177 | 185 | ||
178 | /* mixer */ | 186 | /* mixer */ |
179 | d->m_sound = d->m_vol = d->m_mixer = -1; | 187 | d->m_sound = d->m_vol = d->m_mixer = -1; |
180 | 188 | ||
181 | /* System QCopChannel created */ | 189 | /* System QCopChannel created */ |
182 | d->m_initializedButtonQcop = false; | 190 | d->m_initializedButtonQcop = false; |
183 | 191 | ||
184 | // New distribution detection code first checks for legacy distributions, | 192 | // New distribution detection code first checks for legacy distributions, |
185 | // identified by /etc/familiar-version or /etc/oz_version. | 193 | // identified by /etc/familiar-version or /etc/oz_version. |
186 | // Then check for OpenEmbedded and lastly, read /etc/issue | 194 | // Then check for OpenEmbedded and lastly, read /etc/issue |
187 | 195 | ||
188 | for ( unsigned int i = 0; i < sizeof distributions; ++i ) | 196 | for ( unsigned int i = 0; i < sizeof distributions; ++i ) |
189 | { | 197 | { |
190 | if ( QFile::exists( distributions[i].sysvfile ) ) | 198 | if ( QFile::exists( distributions[i].sysvfile ) ) |
191 | { | 199 | { |
192 | d->m_systemstr = distributions[i].sysstr; | 200 | d->m_systemstr = distributions[i].sysstr; |
193 | d->m_system = distributions[i].system; | 201 | d->m_system = distributions[i].system; |
194 | d->m_sysverstr = "<Unknown>"; | 202 | d->m_sysverstr = "<Unknown>"; |
195 | QFile f( distributions[i].sysvfile ); | 203 | QFile f( distributions[i].sysvfile ); |
196 | if ( f.open( IO_ReadOnly ) ) | 204 | if ( f.open( IO_ReadOnly ) ) |
197 | { | 205 | { |
198 | QTextStream ts( &f ); | 206 | QTextStream ts( &f ); |
199 | d->m_sysverstr = ts.readLine().replace( QRegExp( "\\\\." ), "" ); | 207 | d->m_sysverstr = ts.readLine().replace( QRegExp( "\\\\." ), "" ); |
200 | } | 208 | } |
201 | break; | 209 | break; |
202 | } | 210 | } |
203 | } | 211 | } |
204 | } | 212 | } |
205 | 213 | ||
206 | void ODevice::systemMessage( const QCString &msg, const QByteArray & ) | 214 | void ODevice::systemMessage( const QCString &msg, const QByteArray & ) |
207 | { | 215 | { |
208 | if ( msg == "deviceButtonMappingChanged()" ) { | 216 | if ( msg == "deviceButtonMappingChanged()" ) { |
209 | reloadButtonMapping(); | 217 | reloadButtonMapping(); |
210 | } | 218 | } |
211 | } | 219 | } |
212 | 220 | ||
213 | void ODevice::init(const QString&) | 221 | void ODevice::init(const QString&) |
214 | { | 222 | { |
215 | } | 223 | } |
216 | 224 | ||
217 | /** | 225 | /** |
218 | * This method initialises the button mapping | 226 | * This method initialises the button mapping |
219 | */ | 227 | */ |
220 | void ODevice::initButtons() | 228 | void ODevice::initButtons() |
221 | { | 229 | { |
222 | if ( d->m_buttons ) | 230 | if ( d->m_buttons ) |
223 | return; | 231 | return; |
224 | 232 | ||
225 | qDebug ( "init Buttons" ); | 233 | qDebug ( "init Buttons" ); |
226 | d->m_buttons = new QValueList <ODeviceButton>; | 234 | d->m_buttons = new QValueList <ODeviceButton>; |
227 | 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++ ) { |
228 | default_button *db = default_buttons + i; | 236 | default_button *db = default_buttons + i; |
229 | ODeviceButton b; | 237 | ODeviceButton b; |
230 | b. setKeycode ( db->code ); | 238 | b. setKeycode ( db->code ); |
231 | b. setUserText ( QObject::tr ( "Button", db->utext )); | 239 | b. setUserText ( QObject::tr ( "Button", db->utext )); |
232 | b. setPixmap ( Resource::loadPixmap ( db->pix )); | 240 | b. setPixmap ( Resource::loadPixmap ( db->pix )); |
233 | b. setFactoryPresetPressedAction ( OQCopMessage ( makeChannel ( db->fpressedservice ), db->fpressedaction )); | 241 | b. setFactoryPresetPressedAction ( OQCopMessage ( makeChannel ( db->fpressedservice ), db->fpressedaction )); |
234 | b. setFactoryPresetHeldAction ( OQCopMessage ( makeChannel ( db->fheldservice ), db->fheldaction )); | 242 | b. setFactoryPresetHeldAction ( OQCopMessage ( makeChannel ( db->fheldservice ), db->fheldaction )); |
235 | d->m_buttons->append ( b ); | 243 | d->m_buttons->append ( b ); |
236 | } | 244 | } |
237 | 245 | ||
238 | reloadButtonMapping(); | 246 | reloadButtonMapping(); |
239 | } | 247 | } |
240 | 248 | ||
241 | ODevice::~ODevice() | 249 | ODevice::~ODevice() |
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 | |||
@@ -14,219 +14,223 @@ | |||
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 | #ifndef ODEVICE_H_ | 30 | #ifndef ODEVICE_H_ |
31 | #define ODEVICE_H_ | 31 | #define ODEVICE_H_ |
32 | 32 | ||
33 | /* OPIE */ | 33 | /* OPIE */ |
34 | #include <opie2/odevicebutton.h> | 34 | #include <opie2/odevicebutton.h> |
35 | #include <qpe/qpeapplication.h> /* for Transformation enum.. */ | 35 | #include <qpe/qpeapplication.h> /* for Transformation enum.. */ |
36 | 36 | ||
37 | /* QT */ | 37 | /* QT */ |
38 | #include <qnamespace.h> | 38 | #include <qnamespace.h> |
39 | #include <qobject.h> | 39 | #include <qobject.h> |
40 | #include <qstring.h> | 40 | #include <qstring.h> |
41 | 41 | ||
42 | 42 | ||
43 | #include <qstrlist.h> | 43 | #include <qstrlist.h> |
44 | #include <qwindowsystem_qws.h> | 44 | #include <qwindowsystem_qws.h> |
45 | 45 | ||
46 | 46 | ||
47 | class Sound; | 47 | class Sound; |
48 | 48 | ||
49 | namespace Opie{ | 49 | namespace Opie{ |
50 | namespace Core{ | 50 | namespace Core{ |
51 | 51 | ||
52 | class ODeviceData; | 52 | class ODeviceData; |
53 | /** | 53 | /** |
54 | * The available devices | 54 | * The available devices |
55 | */ | 55 | */ |
56 | enum OModel { | 56 | enum OModel { |
57 | Model_Unknown, // = 0 | 57 | Model_Unknown, // = 0 |
58 | 58 | ||
59 | Model_Series_Mask = 0xff000000, | 59 | Model_Series_Mask = 0xff000000, |
60 | 60 | ||
61 | Model_iPAQ = ( 1 << 24 ), | 61 | Model_iPAQ = ( 1 << 24 ), |
62 | 62 | ||
63 | Model_iPAQ_All = ( Model_iPAQ | 0xffffff ), | 63 | Model_iPAQ_All = ( Model_iPAQ | 0xffffff ), |
64 | Model_iPAQ_H31xx = ( Model_iPAQ | 0x000001 ), | 64 | Model_iPAQ_H31xx = ( Model_iPAQ | 0x000001 ), |
65 | Model_iPAQ_H36xx = ( Model_iPAQ | 0x000002 ), | 65 | Model_iPAQ_H36xx = ( Model_iPAQ | 0x000002 ), |
66 | Model_iPAQ_H37xx = ( Model_iPAQ | 0x000004 ), | 66 | Model_iPAQ_H37xx = ( Model_iPAQ | 0x000004 ), |
67 | Model_iPAQ_H38xx = ( Model_iPAQ | 0x000008 ), | 67 | Model_iPAQ_H38xx = ( Model_iPAQ | 0x000008 ), |
68 | Model_iPAQ_H39xx = ( Model_iPAQ | 0x000010 ), | 68 | Model_iPAQ_H39xx = ( Model_iPAQ | 0x000010 ), |
69 | Model_iPAQ_H5xxx = ( Model_iPAQ | 0x000020 ), | 69 | Model_iPAQ_H5xxx = ( Model_iPAQ | 0x000020 ), |
70 | Model_iPAQ_H22xx = ( Model_iPAQ | 0x000040 ), | 70 | Model_iPAQ_H22xx = ( Model_iPAQ | 0x000040 ), |
71 | 71 | ||
72 | Model_Jornada = ( 6 << 24 ), | 72 | Model_Jornada = ( 6 << 24 ), |
73 | Model_Jornada_56x = ( Model_Jornada | 0x000001 ), | 73 | Model_Jornada_56x = ( Model_Jornada | 0x000001 ), |
74 | 74 | ||
75 | Model_Zaurus = ( 2 << 24 ), | 75 | Model_Zaurus = ( 2 << 24 ), |
76 | 76 | ||
77 | Model_Zaurus_SL5000 = ( Model_Zaurus | 0x000001 ), | 77 | Model_Zaurus_SL5000 = ( Model_Zaurus | 0x000001 ), |
78 | Model_Zaurus_SL5500 = ( Model_Zaurus | 0x000002 ), | 78 | Model_Zaurus_SL5500 = ( Model_Zaurus | 0x000002 ), |
79 | Model_Zaurus_SLA300 = ( Model_Zaurus | 0x000003 ), | 79 | Model_Zaurus_SLA300 = ( Model_Zaurus | 0x000003 ), |
80 | Model_Zaurus_SLB600 = ( Model_Zaurus | 0x000004 ), | 80 | Model_Zaurus_SLB600 = ( Model_Zaurus | 0x000004 ), |
81 | Model_Zaurus_SLC7x0 = ( Model_Zaurus | 0x000005 ), | 81 | Model_Zaurus_SLC7x0 = ( Model_Zaurus | 0x000005 ), |
82 | Model_Zaurus_SL6000 = ( Model_Zaurus | 0x000006 ), | 82 | Model_Zaurus_SL6000 = ( Model_Zaurus | 0x000006 ), |
83 | 83 | ||
84 | Model_SIMpad = ( 3 << 24 ), | 84 | Model_SIMpad = ( 3 << 24 ), |
85 | 85 | ||
86 | Model_SIMpad_All = ( Model_SIMpad | 0xffffff ), | 86 | Model_SIMpad_All = ( Model_SIMpad | 0xffffff ), |
87 | Model_SIMpad_CL4 = ( Model_SIMpad | 0x000001 ), | 87 | Model_SIMpad_CL4 = ( Model_SIMpad | 0x000001 ), |
88 | Model_SIMpad_SL4 = ( Model_SIMpad | 0x000002 ), | 88 | Model_SIMpad_SL4 = ( Model_SIMpad | 0x000002 ), |
89 | Model_SIMpad_SLC = ( Model_SIMpad | 0x000004 ), | 89 | Model_SIMpad_SLC = ( Model_SIMpad | 0x000004 ), |
90 | Model_SIMpad_TSinus = ( Model_SIMpad | 0x000008 ), | 90 | Model_SIMpad_TSinus = ( Model_SIMpad | 0x000008 ), |
91 | 91 | ||
92 | Model_Ramses = ( 4 << 24 ), | 92 | Model_Ramses = ( 4 << 24 ), |
93 | 93 | ||
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 | */ |
115 | enum OVendor { | 117 | enum 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 | */ |
129 | enum OSystem { | 132 | enum 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 | ||
139 | typedef struct { | 143 | typedef 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 | ||
145 | extern ODistribution distributions[]; | 149 | extern ODistribution distributions[]; |
146 | 150 | ||
147 | 151 | ||
148 | enum OLedState { | 152 | enum 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 |
153 | }; | 157 | }; |
154 | 158 | ||
155 | enum OLed { | 159 | enum OLed { |
156 | Led_Mail, | 160 | Led_Mail, |
157 | Led_Power, | 161 | Led_Power, |
158 | Led_BlueTooth | 162 | Led_BlueTooth |
159 | }; | 163 | }; |
160 | 164 | ||
161 | enum OHardKey { | 165 | enum OHardKey { |
162 | HardKey_Datebook = Qt::Key_F9, | 166 | HardKey_Datebook = Qt::Key_F9, |
163 | HardKey_Contacts = Qt::Key_F10, | 167 | HardKey_Contacts = Qt::Key_F10, |
164 | HardKey_Menu = Qt::Key_F11, | 168 | HardKey_Menu = Qt::Key_F11, |
165 | HardKey_Home = Qt::Key_F12, | 169 | HardKey_Home = Qt::Key_F12, |
166 | HardKey_Mail = Qt::Key_F13, | 170 | HardKey_Mail = Qt::Key_F13, |
167 | HardKey_Record = Qt::Key_F24, | 171 | HardKey_Record = Qt::Key_F24, |
168 | HardKey_Suspend = Qt::Key_F34, | 172 | HardKey_Suspend = Qt::Key_F34, |
169 | HardKey_Backlight = Qt::Key_F35, | 173 | HardKey_Backlight = Qt::Key_F35, |
170 | HardKey_Action = Qt::Key_F10, | 174 | HardKey_Action = Qt::Key_F10, |
171 | HardKey_OK = Qt::Key_F11, | 175 | HardKey_OK = Qt::Key_F11, |
172 | HardKey_End = Qt::Key_F12, | 176 | HardKey_End = Qt::Key_F12, |
173 | }; | 177 | }; |
174 | 178 | ||
175 | enum ODirection { | 179 | enum ODirection { |
176 | CW = 0, | 180 | CW = 0, |
177 | CCW = 1, | 181 | CCW = 1, |
178 | Flip = 2, | 182 | Flip = 2, |
179 | }; | 183 | }; |
180 | 184 | ||
181 | enum OHingeStatus { | 185 | enum OHingeStatus { |
182 | CASE_CLOSED = 3, | 186 | CASE_CLOSED = 3, |
183 | CASE_PORTRAIT = 2, | 187 | CASE_PORTRAIT = 2, |
184 | CASE_LANDSCAPE = 0, | 188 | CASE_LANDSCAPE = 0, |
185 | CASE_UNKNOWN = 1, | 189 | CASE_UNKNOWN = 1, |
186 | }; | 190 | }; |
187 | 191 | ||
188 | /* default button for qvfb or such | 192 | /* default button for qvfb or such |
189 | * see odevice.cpp for details. | 193 | * see odevice.cpp for details. |
190 | * hint: manage a user defined button for qvfb? | 194 | * hint: manage a user defined button for qvfb? |
191 | * alwin | 195 | * alwin |
192 | */ | 196 | */ |
193 | struct default_button { | 197 | struct default_button { |
194 | Qt::Key code; | 198 | Qt::Key code; |
195 | char *utext; | 199 | char *utext; |
196 | char *pix; | 200 | char *pix; |
197 | char *fpressedservice; | 201 | char *fpressedservice; |
198 | char *fpressedaction; | 202 | char *fpressedaction; |
199 | char *fheldservice; | 203 | char *fheldservice; |
200 | char *fheldaction; | 204 | char *fheldaction; |
201 | }; | 205 | }; |
202 | 206 | ||
203 | /** | 207 | /** |
204 | * A singleton which gives informations about device specefic option | 208 | * A singleton which gives informations about device specefic option |
205 | * like the Hardware used, LEDs, the Base Distribution and | 209 | * like the Hardware used, LEDs, the Base Distribution and |
206 | * hardware key mappings. | 210 | * hardware key mappings. |
207 | * | 211 | * |
208 | * @short A small class for device specefic options | 212 | * @short A small class for device specefic options |
209 | * @see QObject | 213 | * @see QObject |
210 | * @author Robert Griebl | 214 | * @author Robert Griebl |
211 | * @version 1.0 | 215 | * @version 1.0 |
212 | */ | 216 | */ |
213 | class ODevice : public QObject | 217 | class ODevice : public QObject |
214 | { | 218 | { |
215 | Q_OBJECT | 219 | Q_OBJECT |
216 | 220 | ||
217 | private: | 221 | private: |
218 | /* disable copy */ | 222 | /* disable copy */ |
219 | ODevice ( const ODevice & ); | 223 | ODevice ( const ODevice & ); |
220 | 224 | ||
221 | protected: | 225 | protected: |
222 | ODevice(); | 226 | ODevice(); |
223 | virtual void init(const QString&); | 227 | virtual void init(const QString&); |
224 | virtual void initButtons(); | 228 | virtual void initButtons(); |
225 | static void sendSuspendmsg(); | 229 | static void sendSuspendmsg(); |
226 | 230 | ||
227 | ODeviceData *d; | 231 | ODeviceData *d; |
228 | 232 | ||
229 | public: | 233 | public: |
230 | // sandman do we want to allow destructions? -zecke? | 234 | // sandman do we want to allow destructions? -zecke? |
231 | virtual ~ODevice(); | 235 | virtual ~ODevice(); |
232 | 236 | ||
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 | |||
49 | using namespace Opie::Core; | ||
50 | using namespace Opie::Core::Internal; | ||
51 | |||
52 | struct 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 | |||
85 | void 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 | |||
96 | void 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 | |||
122 | QValueList <OLed> GenuineIntel::ledList() const | ||
123 | { | ||
124 | QValueList <OLed> vl; | ||
125 | return vl; //none | ||
126 | } | ||
127 | |||
128 | QValueList <OLedState> GenuineIntel::ledStateList ( OLed ) const | ||
129 | { | ||
130 | QValueList <OLedState> vl; | ||
131 | return vl; // none | ||
132 | } | ||
133 | |||
134 | OLedState GenuineIntel::ledState ( OLed ) const | ||
135 | { | ||
136 | return Led_Off; | ||
137 | } | ||
138 | |||
139 | bool GenuineIntel::setLedState ( OLed , OLedState ) | ||
140 | { | ||
141 | return false; | ||
142 | } | ||
143 | |||
144 | |||
145 | bool GenuineIntel::filter ( int /*unicode*/, int , int , bool , bool ) | ||
146 | { | ||
147 | return false; | ||
148 | } | ||
149 | |||
150 | void 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 | |||
163 | bool GenuineIntel::setSoftSuspend ( bool ) | ||
164 | { | ||
165 | return false; | ||
166 | } | ||
167 | |||
168 | |||
169 | bool GenuineIntel::setDisplayBrightness ( int ) | ||
170 | { | ||
171 | return false; | ||
172 | } | ||
173 | |||
174 | int GenuineIntel::displayBrightnessResolution() const | ||
175 | { | ||
176 | return 1; // perhaps to avoid division by zero | ||
177 | } | ||
178 | |||
179 | |||
180 | bool GenuineIntel::hasLightSensor() const | ||
181 | { | ||
182 | return false; | ||
183 | } | ||
184 | |||
185 | int GenuineIntel::readLightSensor() | ||
186 | { | ||
187 | return 0; | ||
188 | } | ||
189 | |||
190 | int 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 | |||
38 | namespace Opie { | ||
39 | namespace Core { | ||
40 | namespace Internal { | ||
41 | |||
42 | class 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 | |||
70 | struct 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 | ||