summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opiecore/device/odevice.h7
-rw-r--r--libopie2/opiecore/device/odevice_htc.cpp255
-rw-r--r--noncore/settings/sysinfo/versioninfo.cpp14
-rw-r--r--pics/sysinfo/htcalpine.pngbin0 -> 2743 bytes
-rw-r--r--pics/sysinfo/htcapache.pngbin0 -> 1863 bytes
-rw-r--r--pics/sysinfo/htcbeetles.pngbin0 -> 16554 bytes
-rw-r--r--pics/sysinfo/htcblueangel.pngbin0 -> 4724 bytes
-rw-r--r--pics/sysinfo/htchimalaya.pngbin0 -> 2743 bytes
-rw-r--r--pics/sysinfo/htcmagician.pngbin0 -> 3229 bytes
-rw-r--r--pics/sysinfo/htcuniversal.pngbin0 -> 28617 bytes
10 files changed, 90 insertions, 186 deletions
diff --git a/libopie2/opiecore/device/odevice.h b/libopie2/opiecore/device/odevice.h
index 9afb92d..c2fa411 100644
--- a/libopie2/opiecore/device/odevice.h
+++ b/libopie2/opiecore/device/odevice.h
@@ -1,383 +1,390 @@
1/* 1/*
2                 This file is part of the Opie Project 2                 This file is part of the Opie Project
3              (C) 2002-2006 The Opie Team <opie-devel@handhelds.org> 3              (C) 2002-2006 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; version 2 of the License. 11 - .   .-<_>     .<> Foundation; version 2 of the License.
12     ._= =}       : 12     ._= =}       :
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#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
47class Sound; 47class Sound;
48 48
49namespace Opie{ 49namespace Opie{
50namespace Core{ 50namespace Core{
51 51
52class ODeviceData; 52class ODeviceData;
53/** 53/**
54 * The available devices 54 * The available devices
55 */ 55 */
56enum OModel { 56enum OModel {
57 Model_Unknown, // = 0 57 Model_Unknown, // = 0
58 58
59 Model_Series_Mask = 0xffff0000, 59 Model_Series_Mask = 0xffff0000,
60 60
61 Model_iPAQ = ( 1 << 16 ), 61 Model_iPAQ = ( 1 << 16 ),
62 62
63 Model_iPAQ_All = ( Model_iPAQ | 0xffff ), 63 Model_iPAQ_All = ( Model_iPAQ | 0xffff ),
64 Model_iPAQ_H31xx = ( Model_iPAQ | 0x0001 ), 64 Model_iPAQ_H31xx = ( Model_iPAQ | 0x0001 ),
65 Model_iPAQ_H36xx = ( Model_iPAQ | 0x0002 ), 65 Model_iPAQ_H36xx = ( Model_iPAQ | 0x0002 ),
66 Model_iPAQ_H37xx = ( Model_iPAQ | 0x0003 ), 66 Model_iPAQ_H37xx = ( Model_iPAQ | 0x0003 ),
67 Model_iPAQ_H38xx = ( Model_iPAQ | 0x0004 ), 67 Model_iPAQ_H38xx = ( Model_iPAQ | 0x0004 ),
68 Model_iPAQ_H39xx = ( Model_iPAQ | 0x0005 ), 68 Model_iPAQ_H39xx = ( Model_iPAQ | 0x0005 ),
69 Model_iPAQ_H5xxx = ( Model_iPAQ | 0x0006 ), 69 Model_iPAQ_H5xxx = ( Model_iPAQ | 0x0006 ),
70 Model_iPAQ_H22xx = ( Model_iPAQ | 0x0007 ), 70 Model_iPAQ_H22xx = ( Model_iPAQ | 0x0007 ),
71 Model_iPAQ_H191x = ( Model_iPAQ | 0x0008 ), 71 Model_iPAQ_H191x = ( Model_iPAQ | 0x0008 ),
72 Model_iPAQ_H1940 = ( Model_iPAQ | 0x0009 ), 72 Model_iPAQ_H1940 = ( Model_iPAQ | 0x0009 ),
73 Model_iPAQ_HX4700 = ( Model_iPAQ | 0x000A ), 73 Model_iPAQ_HX4700 = ( Model_iPAQ | 0x000A ),
74 Model_Jornada = ( 6 << 16 ), 74 Model_Jornada = ( 6 << 16 ),
75 Model_Jornada_56x = ( Model_Jornada | 0x0001 ), 75 Model_Jornada_56x = ( Model_Jornada | 0x0001 ),
76 Model_Jornada_720 = ( Model_Jornada | 0x0002 ), 76 Model_Jornada_720 = ( Model_Jornada | 0x0002 ),
77 Model_Jornada_820 = ( Model_Jornada | 0x0003 ),
77 78
78 Model_Zaurus = ( 2 << 16 ), 79 Model_Zaurus = ( 2 << 16 ),
79 80
80 Model_Zaurus_SL5000 = ( Model_Zaurus | 0x0001 ), 81 Model_Zaurus_SL5000 = ( Model_Zaurus | 0x0001 ),
81 Model_Zaurus_SL5500 = ( Model_Zaurus | 0x0002 ), 82 Model_Zaurus_SL5500 = ( Model_Zaurus | 0x0002 ),
82 Model_Zaurus_SLA300 = ( Model_Zaurus | 0x0003 ), 83 Model_Zaurus_SLA300 = ( Model_Zaurus | 0x0003 ),
83 Model_Zaurus_SLB600 = ( Model_Zaurus | 0x0004 ), 84 Model_Zaurus_SLB600 = ( Model_Zaurus | 0x0004 ),
84 Model_Zaurus_SLC7x0 = ( Model_Zaurus | 0x0005 ), 85 Model_Zaurus_SLC7x0 = ( Model_Zaurus | 0x0005 ),
85 Model_Zaurus_SL6000 = ( Model_Zaurus | 0x0006 ), 86 Model_Zaurus_SL6000 = ( Model_Zaurus | 0x0006 ),
86 Model_Zaurus_SLC3000 = ( Model_Zaurus | 0x0007 ), 87 Model_Zaurus_SLC3000 = ( Model_Zaurus | 0x0007 ),
87 Model_Zaurus_SLC1000 = ( Model_Zaurus | 0x0008 ), 88 Model_Zaurus_SLC1000 = ( Model_Zaurus | 0x0008 ),
88 Model_Zaurus_SLC3100 = ( Model_Zaurus | 0x0009 ), 89 Model_Zaurus_SLC3100 = ( Model_Zaurus | 0x0009 ),
89 90
90 Model_SIMpad = ( 3 << 16 ), 91 Model_SIMpad = ( 3 << 16 ),
91 92
92 Model_SIMpad_All = ( Model_SIMpad | 0xffff ), 93 Model_SIMpad_All = ( Model_SIMpad | 0xffff ),
93 Model_SIMpad_CL4 = ( Model_SIMpad | 0x0001 ), 94 Model_SIMpad_CL4 = ( Model_SIMpad | 0x0001 ),
94 Model_SIMpad_SL4 = ( Model_SIMpad | 0x0002 ), 95 Model_SIMpad_SL4 = ( Model_SIMpad | 0x0002 ),
95 Model_SIMpad_SLC = ( Model_SIMpad | 0x0003 ), 96 Model_SIMpad_SLC = ( Model_SIMpad | 0x0003 ),
96 Model_SIMpad_TSinus = ( Model_SIMpad | 0x0004 ), 97 Model_SIMpad_TSinus = ( Model_SIMpad | 0x0004 ),
97 98
98 Model_Ramses = ( 4 << 16 ), 99 Model_Ramses = ( 4 << 16 ),
99 100
100 Model_Ramses_All = ( Model_Ramses | 0xffff ), 101 Model_Ramses_All = ( Model_Ramses | 0xffff ),
101 Model_Ramses_MNCI = ( Model_Ramses | 0x0001 ), 102 Model_Ramses_MNCI = ( Model_Ramses | 0x0001 ),
102 Model_Ramses_MNCIRX = ( Model_Ramses | 0x0002 ), 103 Model_Ramses_MNCIRX = ( Model_Ramses | 0x0002 ),
103 104
104 Model_Yopy = ( 5 << 16 ), 105 Model_Yopy = ( 5 << 16 ),
105 106
106 Model_Yopy_All = ( Model_Yopy | 0xffff ), 107 Model_Yopy_All = ( Model_Yopy | 0xffff ),
107 Model_Yopy_3000 = ( Model_Yopy | 0x0001 ), 108 Model_Yopy_3000 = ( Model_Yopy | 0x0001 ),
108 Model_Yopy_3500 = ( Model_Yopy | 0x0002 ), 109 Model_Yopy_3500 = ( Model_Yopy | 0x0002 ),
109 Model_Yopy_3700 = ( Model_Yopy | 0x0003 ), 110 Model_Yopy_3700 = ( Model_Yopy | 0x0003 ),
110 111
111 Model_Beagle = ( 6 << 16 ), 112 Model_Beagle = ( 6 << 16 ),
112 113
113 Model_Beagle_All = ( Model_Beagle | 0xffff ), 114 Model_Beagle_All = ( Model_Beagle | 0xffff ),
114 Model_Beagle_PA100 = ( Model_Beagle | 0x0001 ), 115 Model_Beagle_PA100 = ( Model_Beagle | 0x0001 ),
115 116
116 Model_GenuineIntel = ( 7 << 16 ), 117 Model_GenuineIntel = ( 7 << 16 ),
117 118
118 Model_MyPal = ( 8 << 16 ), 119 Model_MyPal = ( 8 << 16 ),
119 120
120 Model_MyPal_All = ( Model_MyPal | 0xffff ), 121 Model_MyPal_All = ( Model_MyPal | 0xffff ),
121 Model_MyPal_620 = ( Model_MyPal | 0x0001 ), 122 Model_MyPal_620 = ( Model_MyPal | 0x0001 ),
122 Model_MyPal_716 = ( Model_MyPal | 0x0002 ), 123 Model_MyPal_716 = ( Model_MyPal | 0x0002 ),
123 Model_MyPal_730 = ( Model_MyPal | 0x0003 ), 124 Model_MyPal_730 = ( Model_MyPal | 0x0003 ),
124 125
125 Model_HTC = ( 9 << 16 ), 126 Model_HTC = ( 9 << 16 ),
126 Model_HTC_All = ( Model_HTC | 0xffff ), 127 Model_HTC_All = ( Model_HTC | 0xffff ),
127 Model_HTC_Universal = ( Model_HTC | 0x0001 ), 128 Model_HTC_Universal = ( Model_HTC | 0x0001 ),
129 Model_HTC_Alpine = ( Model_HTC | 0x0002 ),
130 Model_HTC_Apache = ( Model_HTC | 0x0003 ),
131 Model_HTC_Beetles = ( Model_HTC | 0x0004 ),
132 Model_HTC_Blueangel = ( Model_HTC | 0x0005 ),
133 Model_HTC_Himalaya = ( Model_HTC | 0x0006 ),
134 Model_HTC_Magician = ( Model_HTC | 0x0007 ),
128 135
129 Model_Motorola = ( 9 << 17 ), 136 Model_Motorola = ( 9 << 17 ),
130 Model_Motorola_All = ( Model_Motorola | 0xffff ), 137 Model_Motorola_All = ( Model_Motorola | 0xffff ),
131 Model_Motorola_EZX = ( Model_Motorola | 0x0001 ), 138 Model_Motorola_EZX = ( Model_Motorola | 0x0001 ),
132 139
133}; 140};
134 141
135/** 142/**
136 * The vendor of the device 143 * The vendor of the device
137 */ 144 */
138enum OVendor { 145enum OVendor {
139 Vendor_Unknown, 146 Vendor_Unknown,
140 147
141 Vendor_HP, 148 Vendor_HP,
142 Vendor_Sharp, 149 Vendor_Sharp,
143 Vendor_SIEMENS, 150 Vendor_SIEMENS,
144 Vendor_MundN, 151 Vendor_MundN,
145 Vendor_GMate, 152 Vendor_GMate,
146 Vendor_MasterIA, 153 Vendor_MasterIA,
147 Vendor_GenuineIntel, 154 Vendor_GenuineIntel,
148 Vendor_Asus, 155 Vendor_Asus,
149 Vendor_HTC, 156 Vendor_HTC,
150 Vendor_Motorola, 157 Vendor_Motorola,
151}; 158};
152 159
153/** 160/**
154 * The System used 161 * The System used
155 */ 162 */
156enum OSystem { 163enum OSystem {
157 System_Unknown, 164 System_Unknown,
158 165
159 System_Familiar, 166 System_Familiar,
160 System_Zaurus, 167 System_Zaurus,
161 System_OpenZaurus, 168 System_OpenZaurus,
162 System_Linupy, 169 System_Linupy,
163 System_OpenEmbedded, 170 System_OpenEmbedded,
164 System_PC, 171 System_PC,
165 System_OpenEZX, 172 System_OpenEZX,
166 System_Angstrom, 173 System_Angstrom,
167}; 174};
168 175
169typedef struct { 176typedef struct {
170 OSystem system; 177 OSystem system;
171 char* sysstr; 178 char* sysstr;
172 char* sysvfile; 179 char* sysvfile;
173} ODistribution; 180} ODistribution;
174 181
175extern ODistribution distributions[]; 182extern ODistribution distributions[];
176 183
177 184
178enum OLedState { 185enum OLedState {
179 Led_Off, 186 Led_Off,
180 Led_On, 187 Led_On,
181 Led_BlinkSlow, 188 Led_BlinkSlow,
182 Led_BlinkFast 189 Led_BlinkFast
183}; 190};
184 191
185enum OLed { 192enum OLed {
186 Led_Mail, 193 Led_Mail,
187 Led_Power, 194 Led_Power,
188 Led_BlueTooth 195 Led_BlueTooth
189}; 196};
190 197
191enum OHardKey { 198enum OHardKey {
192 HardKey_Datebook = Qt::Key_F9, 199 HardKey_Datebook = Qt::Key_F9,
193 HardKey_Contacts = Qt::Key_F10, 200 HardKey_Contacts = Qt::Key_F10,
194 HardKey_Menu = Qt::Key_F11, 201 HardKey_Menu = Qt::Key_F11,
195 HardKey_Home = Qt::Key_F12, 202 HardKey_Home = Qt::Key_F12,
196 HardKey_Mail = Qt::Key_F13, 203 HardKey_Mail = Qt::Key_F13,
197 HardKey_Record = Qt::Key_F24, 204 HardKey_Record = Qt::Key_F24,
198 HardKey_Suspend = Qt::Key_F34, 205 HardKey_Suspend = Qt::Key_F34,
199 HardKey_Backlight = Qt::Key_F35, 206 HardKey_Backlight = Qt::Key_F35,
200 HardKey_Action = Qt::Key_F10, 207 HardKey_Action = Qt::Key_F10,
201 HardKey_OK = Qt::Key_F11, 208 HardKey_OK = Qt::Key_F11,
202 HardKey_End = Qt::Key_F12, 209 HardKey_End = Qt::Key_F12,
203}; 210};
204 211
205enum ODirection { 212enum ODirection {
206 CW = 0, 213 CW = 0,
207 CCW = 1, 214 CCW = 1,
208 Flip = 2, 215 Flip = 2,
209}; 216};
210 217
211enum OHingeStatus { 218enum OHingeStatus {
212 CASE_CLOSED = 3, 219 CASE_CLOSED = 3,
213 CASE_PORTRAIT = 2, 220 CASE_PORTRAIT = 2,
214 CASE_LANDSCAPE = 0, 221 CASE_LANDSCAPE = 0,
215 CASE_UNKNOWN = 1, 222 CASE_UNKNOWN = 1,
216}; 223};
217 224
218/* default button for qvfb or such 225/* default button for qvfb or such
219 * see odevice.cpp for details. 226 * see odevice.cpp for details.
220 * hint: manage a user defined button for qvfb? 227 * hint: manage a user defined button for qvfb?
221 * alwin 228 * alwin
222 */ 229 */
223struct default_button { 230struct default_button {
224 Qt::Key code; 231 Qt::Key code;
225 char *utext; 232 char *utext;
226 char *pix; 233 char *pix;
227 char *fpressedservice; 234 char *fpressedservice;
228 char *fpressedaction; 235 char *fpressedaction;
229 char *fheldservice; 236 char *fheldservice;
230 char *fheldaction; 237 char *fheldaction;
231}; 238};
232 239
233/** 240/**
234 * A singleton which gives informations about device specefic option 241 * A singleton which gives informations about device specefic option
235 * like the Hardware used, LEDs, the Base Distribution and 242 * like the Hardware used, LEDs, the Base Distribution and
236 * hardware key mappings. 243 * hardware key mappings.
237 * 244 *
238 * @short A small class for device specific options 245 * @short A small class for device specific options
239 * @see QObject 246 * @see QObject
240 * @author Robert Griebl 247 * @author Robert Griebl
241 * @version 1.0 248 * @version 1.0
242 */ 249 */
243class ODevice : public QObject 250class ODevice : public QObject
244{ 251{
245 Q_OBJECT 252 Q_OBJECT
246 253
247private: 254private:
248 /* disable copy */ 255 /* disable copy */
249 ODevice ( const ODevice & ); 256 ODevice ( const ODevice & );
250 257
251protected: 258protected:
252 ODevice(); 259 ODevice();
253 virtual void init(const QString&); 260 virtual void init(const QString&);
254 virtual void initButtons(); 261 virtual void initButtons();
255 static void sendSuspendmsg(); 262 static void sendSuspendmsg();
256 263
257 ODeviceData *d; 264 ODeviceData *d;
258 265
259public: 266public:
260 // sandman do we want to allow destructions? -zecke? 267 // sandman do we want to allow destructions? -zecke?
261 virtual ~ODevice(); 268 virtual ~ODevice();
262 static ODevice *inst(); 269 static ODevice *inst();
263 270
264 // information 271 // information
265 QString modelString() const; 272 QString modelString() const;
266 OModel model() const; 273 OModel model() const;
267 inline OModel series() const { return (OModel) ( model() & Model_Series_Mask ); } 274 inline OModel series() const { return (OModel) ( model() & Model_Series_Mask ); }
268 275
269 QString vendorString() const; 276 QString vendorString() const;
270 OVendor vendor() const; 277 OVendor vendor() const;
271 278
272 QString systemString() const; 279 QString systemString() const;
273 OSystem system() const; 280 OSystem system() const;
274 281
275 QString systemVersionString() const; 282 QString systemVersionString() const;
276 283
277 virtual Transformation rotation() const; 284 virtual Transformation rotation() const;
278 virtual ODirection direction() const; 285 virtual ODirection direction() const;
279 286
280 QString qteDriver() const; 287 QString qteDriver() const;
281 288
282 // system 289 // system
283 virtual bool suspend(); 290 virtual bool suspend();
284 291
285 virtual bool setDisplayStatus ( bool on ); 292 virtual bool setDisplayStatus ( bool on );
286 virtual bool setDisplayBrightness ( int brightness ); 293 virtual bool setDisplayBrightness ( int brightness );
287 virtual int displayBrightnessResolution() const; 294 virtual int displayBrightnessResolution() const;
288 virtual bool setDisplayContrast ( int contrast ); 295 virtual bool setDisplayContrast ( int contrast );
289 virtual int displayContrastResolution() const; 296 virtual int displayContrastResolution() const;
290 297
291 // don't add new virtual methods, use this: 298 // don't add new virtual methods, use this:
292 // /*virtual */ void boo(int i ) { return virtual_hook(1,&i); }; 299 // /*virtual */ void boo(int i ) { return virtual_hook(1,&i); };
293 // and in your subclass do overwrite 300 // and in your subclass do overwrite
294 // protected virtual int virtual_hook(int, void *) 301 // protected virtual int virtual_hook(int, void *)
295 // which is defined below 302 // which is defined below
296 303
297 // input / output 304 // input / output
298 virtual void playAlarmSound(); 305 virtual void playAlarmSound();
299 virtual void playKeySound(); 306 virtual void playKeySound();
300 virtual void playTouchSound(); 307 virtual void playTouchSound();
301 308
302 virtual QValueList <OLed> ledList() const; 309 virtual QValueList <OLed> ledList() const;
303 virtual QValueList <OLedState> ledStateList ( OLed led ) const; 310 virtual QValueList <OLedState> ledStateList ( OLed led ) const;
304 virtual OLedState ledState ( OLed led ) const; 311 virtual OLedState ledState ( OLed led ) const;
305 virtual bool setLedState ( OLed led, OLedState st ); 312 virtual bool setLedState ( OLed led, OLedState st );
306 313
307 virtual bool hasLightSensor() const; 314 virtual bool hasLightSensor() const;
308 virtual int readLightSensor(); 315 virtual int readLightSensor();
309 virtual int lightSensorResolution() const; 316 virtual int lightSensorResolution() const;
310 317
311 virtual bool hasHingeSensor() const; 318 virtual bool hasHingeSensor() const;
312 virtual OHingeStatus readHingeSensor()const; 319 virtual OHingeStatus readHingeSensor()const;
313 320
314 const QStrList &allowedCpuFrequencies() const; 321 const QStrList &allowedCpuFrequencies() const;
315 bool setCurrentCpuFrequency(uint index); 322 bool setCurrentCpuFrequency(uint index);
316 323
317 /** 324 /**
318 * Returns the available buttons on this device. The number and location 325 * Returns the available buttons on this device. The number and location
319 * of buttons will vary depending on the device. Button numbers will be assigned 326 * of buttons will vary depending on the device. Button numbers will be assigned
320 * by the device manufacturer and will be from most preferred button to least preffered 327 * by the device manufacturer and will be from most preferred button to least preffered
321 * button. Note that this list only contains "user mappable" buttons. 328 * button. Note that this list only contains "user mappable" buttons.
322 * 329 *
323 * @todo Make method const and take care of calling initButtons or make that const too 330 * @todo Make method const and take care of calling initButtons or make that const too
324 * 331 *
325 */ 332 */
326 const QValueList<ODeviceButton> &buttons(); 333 const QValueList<ODeviceButton> &buttons();
327 334
328 /** 335 /**
329 * Returns the DeviceButton for the \a keyCode. If \a keyCode is not found, it 336 * Returns the DeviceButton for the \a keyCode. If \a keyCode is not found, it
330 * returns 0L 337 * returns 0L
331 */ 338 */
332 const ODeviceButton *buttonForKeycode ( ushort keyCode ); 339 const ODeviceButton *buttonForKeycode ( ushort keyCode );
333 340
334 /** 341 /**
335 * Reassigns the pressed action for \a button. To return to the factory 342 * Reassigns the pressed action for \a button. To return to the factory
336 * default pass an empty string as \a qcopMessage. 343 * default pass an empty string as \a qcopMessage.
337 */ 344 */
338 void remapPressedAction ( int button, const OQCopMessage &qcopMessage ); 345 void remapPressedAction ( int button, const OQCopMessage &qcopMessage );
339 346
340 /** 347 /**
341 * Reassigns the held action for \a button. To return to the factory 348 * Reassigns the held action for \a button. To return to the factory
342 * default pass an empty string as \a qcopMessage. 349 * default pass an empty string as \a qcopMessage.
343 */ 350 */
344 void remapHeldAction ( int button, const OQCopMessage &qcopMessage ); 351 void remapHeldAction ( int button, const OQCopMessage &qcopMessage );
345 352
346 /** 353 /**
347 * How long (in ms) you have to press a button for a "hold" action 354 * How long (in ms) you have to press a button for a "hold" action
348 */ 355 */
349 uint buttonHoldTime() const; 356 uint buttonHoldTime() const;
350 357
351signals: 358signals:
352 void buttonMappingChanged(); 359 void buttonMappingChanged();
353 360
354private slots: 361private slots:
355 void systemMessage ( const QCString &, const QByteArray & ); 362 void systemMessage ( const QCString &, const QByteArray & );
356 void playingStopped(); 363 void playingStopped();
357 364
358protected: 365protected:
359 void addPreHandler(QWSServer::KeyboardFilter*aFilter); 366 void addPreHandler(QWSServer::KeyboardFilter*aFilter);
360 void remPreHandler(QWSServer::KeyboardFilter*aFilter); 367 void remPreHandler(QWSServer::KeyboardFilter*aFilter);
361 void reloadButtonMapping(); 368 void reloadButtonMapping();
362 void changeMixerForAlarm( int mixer, const char* file, Sound *snd); 369 void changeMixerForAlarm( int mixer, const char* file, Sound *snd);
363 370
364 /* ugly virtual hook */ 371 /* ugly virtual hook */
365 virtual void virtual_hook( int id, void* data ); 372 virtual void virtual_hook( int id, void* data );
366}; 373};
367 374
368class ODeviceData { 375class ODeviceData {
369 376
370 public: 377 public:
371 QString m_vendorstr; 378 QString m_vendorstr;
372 OVendor m_vendor; 379 OVendor m_vendor;
373 380
374 QString m_modelstr; 381 QString m_modelstr;
375 OModel m_model; 382 OModel m_model;
376 383
377 QString m_systemstr; 384 QString m_systemstr;
378 OSystem m_system; 385 OSystem m_system;
379 386
380 QString m_sysverstr; 387 QString m_sysverstr;
381 388
382 Transformation m_rotation; 389 Transformation m_rotation;
383 ODirection m_direction; 390 ODirection m_direction;
diff --git a/libopie2/opiecore/device/odevice_htc.cpp b/libopie2/opiecore/device/odevice_htc.cpp
index a40308d..c21e10d 100644
--- a/libopie2/opiecore/device/odevice_htc.cpp
+++ b/libopie2/opiecore/device/odevice_htc.cpp
@@ -1,721 +1,604 @@
1/* 1/*
2                 This file is part of the Opie Project 2                 This file is part of the Opie Project
3              Copyright (C) 2002-2005 The Opie Team <opie-devel@handhelds.org> 3              Copyright (C) 2002-2005 The Opie Team <opie-devel@handhelds.org>
4 =. Copyright (C) 2002-2005 Michael 'Mickey' Lauer <mickey@Vanille.de> 4 =. Copyright (C) 2002-2005 Michael 'Mickey' Lauer <mickey@Vanille.de>
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; version 2 of the License. 11 - .   .-<_>     .<> Foundation; version 2 of the License.
12     ._= =}       : 12     ._= =}       :
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_htc.h" 30#include "odevice_htc.h"
31 31
32/* OPIE */ 32/* OPIE */
33#include <opie2/oinputsystem.h> 33#include <opie2/oinputsystem.h>
34#include <opie2/oresource.h> 34#include <opie2/oresource.h>
35 35
36#include <qpe/config.h> 36#include <qpe/config.h>
37#include <qpe/sound.h> 37#include <qpe/sound.h>
38 38
39/* QT */ 39/* QT */
40#include <qapplication.h> 40#include <qapplication.h>
41#include <qfile.h> 41#include <qfile.h>
42#include <qtextstream.h> 42#include <qtextstream.h>
43#include <qwindowsystem_qws.h> 43#include <qwindowsystem_qws.h>
44#include <qcopchannel_qws.h> 44#include <qcopchannel_qws.h>
45 45
46/* STD */ 46/* STD */
47#include <string.h> 47#include <string.h>
48#include <errno.h> 48#include <errno.h>
49#include <fcntl.h> 49#include <fcntl.h>
50#include <math.h> 50#include <math.h>
51#include <stdlib.h> 51#include <stdlib.h>
52#include <signal.h> 52#include <signal.h>
53#include <sys/ioctl.h> 53#include <sys/ioctl.h>
54#include <sys/time.h> 54#include <sys/time.h>
55#include <unistd.h> 55#include <unistd.h>
56#ifndef QT_NO_SOUND 56#ifndef QT_NO_SOUND
57#include <linux/soundcard.h> 57#include <linux/soundcard.h>
58#endif 58#endif
59 59
60using namespace Opie::Core; 60using namespace Opie::Core;
61using namespace Opie::Core::Internal; 61using namespace Opie::Core::Internal;
62 62
63struct htc_button htc_buttons [] = { 63struct htc_button htc_buttons [] = {
64 { Qt::Key_F9, QT_TRANSLATE_NOOP("Button", "Calendar Button"), 64 { Qt::Key_F9, QT_TRANSLATE_NOOP("Button", "Calendar Button"),
65 "devicebuttons/z_calendar", 65 "devicebuttons/z_calendar",
66 "datebook", "nextView()", 66 "datebook", "nextView()",
67 "today", "raise()" }, 67 "today", "raise()" },
68 { Qt::Key_F10, QT_TRANSLATE_NOOP("Button", "Contacts Button"), 68 { Qt::Key_F10, QT_TRANSLATE_NOOP("Button", "Contacts Button"),
69 "devicebuttons/z_contact", 69 "devicebuttons/z_contact",
70 "addressbook", "raise()", 70 "addressbook", "raise()",
71 "addressbook", "beamBusinessCard()" }, 71 "addressbook", "beamBusinessCard()" },
72 { Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Home Button"), 72 { Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Home Button"),
73 "devicebuttons/z_home", 73 "devicebuttons/z_home",
74 "QPE/Launcher", "home()", 74 "QPE/Launcher", "home()",
75 "buttonsettings", "raise()" }, 75 "buttonsettings", "raise()" },
76 { Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Menu Button"), 76 { Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Menu Button"),
77 "devicebuttons/z_menu", 77 "devicebuttons/z_menu",
78 "QPE/TaskBar", "toggleMenu()", 78 "QPE/TaskBar", "toggleMenu()",
79 "QPE/TaskBar", "toggleStartMenu()" }, 79 "QPE/TaskBar", "toggleStartMenu()" },
80 { Qt::Key_F13, QT_TRANSLATE_NOOP("Button", "Mail Button"), 80 { Qt::Key_F13, QT_TRANSLATE_NOOP("Button", "Mail Button"),
81 "devicebuttons/z_mail", 81 "devicebuttons/z_mail",
82 "opiemail", "raise()", 82 "opiemail", "raise()",
83 "opiemail", "newMail()" }, 83 "opiemail", "newMail()" },
84}; 84};
85 85
86struct htc_button htc_buttons_universal [] = { 86struct htc_button htc_buttons_universal [] = {
87 { Qt::Key_F9, QT_TRANSLATE_NOOP("Button", "Calendar Button"), 87 { Qt::Key_F9, QT_TRANSLATE_NOOP("Button", "Calendar Button"),
88 "devicebuttons/z_calendar", 88 "devicebuttons/z_calendar",
89 "datebook", "nextView()", 89 "datebook", "nextView()",
90 "today", "raise()" }, 90 "today", "raise()" },
91 { Qt::Key_F10, QT_TRANSLATE_NOOP("Button", "Contacts Button"), 91 { Qt::Key_F10, QT_TRANSLATE_NOOP("Button", "Contacts Button"),
92 "devicebuttons/z_contact", 92 "devicebuttons/z_contact",
93 "addressbook", "raise()", 93 "addressbook", "raise()",
94 "addressbook", "beamBusinessCard()" }, 94 "addressbook", "beamBusinessCard()" },
95 { Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Home Button"), 95 { Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Home Button"),
96 "devicebuttons/z_home", 96 "devicebuttons/z_home",
97 "QPE/Launcher", "home()", 97 "QPE/Launcher", "home()",
98 "buttonsettings", "raise()" }, 98 "buttonsettings", "raise()" },
99 { Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Menu Button"), 99 { Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Menu Button"),
100 "devicebuttons/z_menu", 100 "devicebuttons/z_menu",
101 "QPE/TaskBar", "toggleMenu()", 101 "QPE/TaskBar", "toggleMenu()",
102 "QPE/TaskBar", "toggleStartMenu()" }, 102 "QPE/TaskBar", "toggleStartMenu()" },
103 { Qt::Key_F13, QT_TRANSLATE_NOOP("Button", "Mail Button"), 103 { Qt::Key_F13, QT_TRANSLATE_NOOP("Button", "Mail Button"),
104 "devicebuttons/z_mail", 104 "devicebuttons/z_mail",
105 "opiemail", "raise()", 105 "opiemail", "raise()",
106 "opiemail", "newMail()" }, 106 "opiemail", "newMail()" },
107 107
108 { Qt::Key_F15, QT_TRANSLATE_NOOP("Button", "Hinge1"), 108 { Qt::Key_F15, QT_TRANSLATE_NOOP("Button", "Hinge1"),
109 "devicebuttons/z_hinge1", 109 "devicebuttons/z_hinge1",
110 "QPE/Rotation", "rotateDefault()",0}, 110 "QPE/Rotation", "rotateDefault()",0},
111 { Qt::Key_F16, QT_TRANSLATE_NOOP("Button", "Hinge2"), 111 { Qt::Key_F16, QT_TRANSLATE_NOOP("Button", "Hinge2"),
112 "devicebuttons/z_hinge2", 112 "devicebuttons/z_hinge2",
113 "QPE/Rotation", "rotateDefault()",0}, 113 "QPE/Rotation", "rotateDefault()",0},
114 { Qt::Key_F17, QT_TRANSLATE_NOOP("Button", "Hinge3"), 114 { Qt::Key_F17, QT_TRANSLATE_NOOP("Button", "Hinge3"),
115 "devicebuttons/z_hinge3", 115 "devicebuttons/z_hinge3",
116 "QPE/Rotation", "rotateDefault()",0}, 116 "QPE/Rotation", "rotateDefault()",0},
117}; 117};
118 118
119struct htc_button htc_buttons_6000 [] = {
120 { Qt::Key_F9, QT_TRANSLATE_NOOP("Button", "Calendar Button"),
121 "devicebuttons/z_calendar",
122 "datebook", "nextView()",
123 "today", "raise()" },
124 { Qt::Key_F10, QT_TRANSLATE_NOOP("Button", "Contacts Button"),
125 "devicebuttons/z_contact",
126 "addressbook", "raise()",
127 "addressbook", "beamBusinessCard()" },
128 { Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Home Button"),
129 "devicebuttons/z_home",
130 "QPE/Launcher", "home()",
131 "buttonsettings", "raise()" },
132 { Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Menu Button"),
133 "devicebuttons/z_menu",
134 "QPE/TaskBar", "toggleMenu()",
135 "QPE/TaskBar", "toggleStartMenu()" },
136 { Qt::Key_F13, QT_TRANSLATE_NOOP("Button", "Mail Button"),
137 "devicebuttons/z_mail",
138 "opiemail", "raise()",
139 "opiemail", "newMail()" },
140 { Qt::Key_F15, QT_TRANSLATE_NOOP("Button", "Rotate Button"),
141 "devicebuttons/z_rotate",
142 0,
143 "QPE/Rotation", "rotateDefault()" },
144 { Qt::Key_F24, QT_TRANSLATE_NOOP("Button", "Record Button"),
145 "devicebuttons/z_hinge3",
146 "QPE/VMemo", "toggleRecord()",
147 "sound", "raise()" },
148};
149 119
150// FIXME This gets unnecessary complicated. We should think about splitting the HTC
151// class up into individual classes. We would need three classes
152// 120//
153// HTC-Universal (PXA-model w/ 640x480 lcd, for Universal) 121// HTC-Universal (PXA-model w/ 480x640 3.6" lcd)
122// HTC-Alpine (PXA-model w/ 240x320 3.5" lcd)
123// HTC-Apache (PXA-model w/ 240x320 2.8" lcd)
124// HTC-Beetles (PXA-model w/ 240x240 3.0" lcd)
125// HTC-Blueangel (PXA-model w/ 240x320 3.5" lcd)
126// HTC-Himalaya (PXA-model w/ 240x320 3.5" lcd)
127// HTC-Magician (PXA-model w/ 240x320 2.8" lcd)
154 128
155void HTC::init(const QString& cpu_info) 129void HTC::init(const QString& cpu_info)
156{ 130{
157 qDebug( "HTC::init()" ); 131 qDebug( "HTC::init()" );
158 // Set the time to wait until the system is really suspended 132 // Set the time to wait until the system is really suspended
159 // the delta between apm --suspend and sleeping 133 // the delta between apm --suspend and sleeping
160 setAPMTimeOut( 15000 ); 134 setAPMTimeOut( 15000 );
161 135
162 // generic distribution code already scanned /etc/issue at that point - 136 d->m_vendorstr = "Xanadux Team";
163 // embedix releases contain "Embedix <version> | Linux for Embedded Devices" 137 d->m_systemstr = "Familiar";
164 if ( d->m_sysverstr.contains( "embedix", false ) ) 138 d->m_system = System_Familiar;
165 {
166 d->m_vendorstr = "HTC";
167 d->m_vendor = Vendor_HTC;
168 d->m_systemstr = "OpenEmbedded";
169 d->m_system = System_OpenEmbedded;
170 m_embedix = true;
171 }
172 else
173 {
174 d->m_vendorstr = "Xanadux Team";
175 d->m_systemstr = "Familiar";
176 d->m_system = System_Familiar;
177 // sysver already gathered
178
179 // OpenHTC sometimes uses the 2.4 (embedix) kernel, check if this is one
180 FILE *uname = popen("uname -r", "r");
181 QFile f;
182 QString line;
183 if ( f.open(IO_ReadOnly, uname) ) {
184 QTextStream ts ( &f );
185 line = ts.readLine();
186 m_embedix = line.startsWith( "2.4." );
187 f.close();
188 }
189 pclose(uname);
190 }
191 139
192 // check the HTC model 140 // check the HTC model
193 QString model; 141 QString model;
194 int loc = cpu_info.find( ":" ); 142 int loc = cpu_info.find( ":" );
195 if ( loc != -1 ) 143 if ( loc != -1 )
196 model = cpu_info.mid( loc+2 ).simplifyWhiteSpace(); 144 model = cpu_info.mid( loc+2 ).simplifyWhiteSpace();
197 else 145 else
198 model = cpu_info; 146 model = cpu_info;
199 147
148 d->m_model = Model_HTC_Universal;
149 d->m_modelstr = "Unknown HTC";
150
200 if ( model == "HTC Universal" ) { 151 if ( model == "HTC Universal" ) {
201 d->m_model = Model_HTC_Universal; 152 d->m_model = Model_HTC_Universal;
202 d->m_modelstr = "HTC Universal"; 153 d->m_modelstr = "HTC Universal";
203 } else { 154 }
204 d->m_model = Model_HTC_Universal; 155 if ( model == "HTC Alpine" ) {
205 d->m_modelstr = "Unknown HTC"; 156 d->m_model = Model_HTC_Alpine;
157 d->m_modelstr = "HTC Alpine";
158 }
159 if ( model == "HTC Apache" ) {
160 d->m_model = Model_HTC_Apache;
161 d->m_modelstr = "HTC Apache";
162 }
163 if ( model == "HTC Beetles" ) {
164 d->m_model = Model_HTC_Beetles;
165 d->m_modelstr = "HTC Beetles";
166 }
167 if ( model == "HTC Blueangel" ) {
168 d->m_model = Model_HTC_Blueangel;
169 d->m_modelstr = "HTC Blueangel";
170 }
171 if ( model == "HTC Himalaya" ) {
172 d->m_model = Model_HTC_Himalaya;
173 d->m_modelstr = "HTC Himalaya";
174 }
175 if ( model == "HTC Magician" ) {
176 d->m_model = Model_HTC_Magician;
177 d->m_modelstr = "HTC Magician";
206 } 178 }
207 179
208 // set path to backlight device in kernel 2.6 180
181 // set path to backlight device
209 switch ( d->m_model ) 182 switch ( d->m_model )
210 { 183 {
211 case Model_HTC_Universal: 184 case Model_HTC_Universal:
185 case Model_HTC_Magician:
186 case Model_HTC_Alpine:
187 case Model_HTC_Beetles:
188 case Model_HTC_Apache:
189 m_backlightdev = "/sys/class/backlight/pxa2xx-fb/";
190 break;
191 case Model_HTC_Blueangel:
192 case Model_HTC_Himalaya:
193 m_backlightdev = "/sys/class/backlight/w100fb/";
194 break;
212 default: 195 default:
213// m_backlightdev = "/sys/class/backlight/corgi-bl/";
214 m_backlightdev = "/sys/class/backlight/pxafb/"; 196 m_backlightdev = "/sys/class/backlight/pxafb/";
215 } 197 }
216 198
217 // set initial rotation 199 // set initial rotation
218 switch( d->m_model ) 200 switch( d->m_model )
219 { 201 {
220 case Model_HTC_Universal: 202 case Model_HTC_Universal:
221 initHingeSensor(); 203 initHingeSensor();
222 d->m_rotation = rotation(); 204 d->m_rotation = rotation();
223 d->m_direction = direction(); 205 d->m_direction = direction();
224 break; 206 break;
225 default: 207 default:
226 d->m_rotation = Rot270; 208 d->m_rotation = Rot270;
227 } 209 }
228 210
229 // set default qte driver 211 // set default qte driver
230 switch( d->m_model ) 212 switch( d->m_model )
231 { 213 {
232 default: 214 default:
233 d->m_qteDriver = "Transformed"; 215 d->m_qteDriver = "Transformed";
234 } 216 }
235 217
236 m_leds[0] = Led_Off; 218 m_leds[0] = Led_Off;
237 219
238 if ( m_embedix ) 220 qDebug( "HTC::init() - Using the 2.6 Xanadux on a %s", (const char*) d->m_modelstr );
239 qDebug( "HTC::init() - Using the 2.4 Embedix HAL on a %s", (const char*) d->m_modelstr );
240 else
241 qDebug( "HTC::init() - Using the 2.6 Xanadux HAL on a %s", (const char*) d->m_modelstr );
242} 221}
243 222
244void HTC::initButtons() 223void HTC::initButtons()
245{ 224{
246 qDebug( "HTC::initButtons()" ); 225 qDebug( "HTC::initButtons()" );
247 if ( d->m_buttons ) 226 if ( d->m_buttons )
248 return; 227 return;
249 228
250 d->m_buttons = new QValueList <ODeviceButton>; 229 d->m_buttons = new QValueList <ODeviceButton>;
251 230
252 struct htc_button * phtc_buttons; 231 struct htc_button * phtc_buttons;
253 int buttoncount; 232 int buttoncount;
254 switch ( d->m_model ) 233 switch ( d->m_model )
255 { 234 {
256 case Model_HTC_Universal: 235 case Model_HTC_Universal:
257 if ( isQWS( ) ) 236 if ( isQWS( ) )
258 { 237 {
259 addPreHandler(this); 238 addPreHandler(this);
260 } 239 }
261 phtc_buttons = htc_buttons_universal; 240 phtc_buttons = htc_buttons_universal;
262 buttoncount = ARRAY_SIZE(htc_buttons_universal); 241 buttoncount = ARRAY_SIZE(htc_buttons_universal);
263 break; 242 break;
264 default: 243 default:
265 phtc_buttons = htc_buttons; 244 phtc_buttons = htc_buttons;
266 buttoncount = ARRAY_SIZE(htc_buttons); 245 buttoncount = ARRAY_SIZE(htc_buttons);
267 break; 246 break;
268 } 247 }
269 248
270 for ( int i = 0; i < buttoncount; i++ ) { 249 for ( int i = 0; i < buttoncount; i++ ) {
271 struct htc_button *zb = phtc_buttons + i; 250 struct htc_button *zb = phtc_buttons + i;
272 ODeviceButton b; 251 ODeviceButton b;
273 252
274 b.setKeycode( zb->code ); 253 b.setKeycode( zb->code );
275 b.setUserText( QObject::tr( "Button", zb->utext )); 254 b.setUserText( QObject::tr( "Button", zb->utext ));
276 b.setPixmap( OResource::loadPixmap( zb->pix )); 255 b.setPixmap( OResource::loadPixmap( zb->pix ));
277 b.setFactoryPresetPressedAction( OQCopMessage( makeChannel ( zb->fpressedservice ), zb->fpressedaction )); 256 b.setFactoryPresetPressedAction( OQCopMessage( makeChannel ( zb->fpressedservice ), zb->fpressedaction ));
278 b.setFactoryPresetHeldAction( OQCopMessage( makeChannel ( zb->fheldservice ), zb->fheldaction )); 257 b.setFactoryPresetHeldAction( OQCopMessage( makeChannel ( zb->fheldservice ), zb->fheldaction ));
279 d->m_buttons->append( b ); 258 d->m_buttons->append( b );
280 } 259 }
281 260
282 reloadButtonMapping(); 261 reloadButtonMapping();
283} 262}
284 263
285 264
286 265
287typedef struct sharp_led_status { 266typedef struct sharp_led_status {
288 int which; /* select which LED status is wanted. */ 267 int which; /* select which LED status is wanted. */
289 int status; /* set new led status if you call SHARP_LED_SETSTATUS */ 268 int status; /* set new led status if you call SHARP_LED_SETSTATUS */
290} sharp_led_status; 269} sharp_led_status;
291 270
292void HTC::buzzer( int sound ) 271void HTC::buzzer( int sound )
293{ 272{
294#ifndef QT_NO_SOUND 273#ifndef QT_NO_SOUND
295 Sound *snd = 0; 274 Sound *snd = 0;
296 275
297 // All devices except SL5500 have a DSP device 276 // All devices except SL5500 have a DSP device
298 if ( d->m_model == Model_HTC_Universal ) { 277 if ( d->m_model == Model_HTC_Universal ) {
299 278
300 switch ( sound ){ 279 switch ( sound ){
301 case SHARP_BUZ_TOUCHSOUND: { 280 case SHARP_BUZ_TOUCHSOUND: {
302 static Sound touch_sound("touchsound"); 281 static Sound touch_sound("touchsound");
303 snd = &touch_sound; 282 snd = &touch_sound;
304 } 283 }
305 break; 284 break;
306 case SHARP_BUZ_KEYSOUND: { 285 case SHARP_BUZ_KEYSOUND: {
307 static Sound key_sound( "keysound" ); 286 static Sound key_sound( "keysound" );
308 snd = &key_sound; 287 snd = &key_sound;
309 } 288 }
310 break; 289 break;
311 case SHARP_BUZ_SCHEDULE_ALARM: 290 case SHARP_BUZ_SCHEDULE_ALARM:
312 default: { 291 default: {
313 static Sound alarm_sound("alarm"); 292 static Sound alarm_sound("alarm");
314 snd = &alarm_sound; 293 snd = &alarm_sound;
315 } 294 }
316 break; 295 break;
317 } 296 }
318 } 297 }
319 298
320 // If a soundname is defined, we expect that this device has 299 // If a soundname is defined, we expect that this device has
321 // sound capabilities.. Otherwise we expect to have the buzzer 300 // sound capabilities.. Otherwise we expect to have the buzzer
322 // device.. 301 // device..
323 if ( snd && snd->isFinished() ){ 302 if ( snd && snd->isFinished() ){
324 changeMixerForAlarm( 0, "/dev/sound/mixer", snd ); 303 changeMixerForAlarm( 0, "/dev/sound/mixer", snd );
325 snd->play(); 304 snd->play();
326 } else if( !snd ) { 305 } else if( !snd ) {
327 int fd = ::open ( "/dev/sharp_buz", O_WRONLY|O_NONBLOCK ); 306 int fd = ::open ( "/dev/sharp_buz", O_WRONLY|O_NONBLOCK );
328 307
329 if ( fd >= 0 ) { 308 if ( fd >= 0 ) {
330 ::ioctl ( fd, SHARP_BUZZER_MAKESOUND, sound ); 309 ::ioctl ( fd, SHARP_BUZZER_MAKESOUND, sound );
331 ::close ( fd ); 310 ::close ( fd );
332 } 311 }
333 312
334 } 313 }
335#endif 314#endif
336} 315}
337 316
338 317
339void HTC::playAlarmSound() 318void HTC::playAlarmSound()
340{ 319{
341 buzzer( SHARP_BUZ_SCHEDULE_ALARM ); 320 buzzer( SHARP_BUZ_SCHEDULE_ALARM );
342} 321}
343 322
344void HTC::playTouchSound() 323void HTC::playTouchSound()
345{ 324{
346 buzzer( SHARP_BUZ_TOUCHSOUND ); 325 buzzer( SHARP_BUZ_TOUCHSOUND );
347} 326}
348 327
349void HTC::playKeySound() 328void HTC::playKeySound()
350{ 329{
351 buzzer( SHARP_BUZ_KEYSOUND ); 330 buzzer( SHARP_BUZ_KEYSOUND );
352} 331}
353 332
354 333
355QValueList <OLed> HTC::ledList() const 334QValueList <OLed> HTC::ledList() const
356{ 335{
357 QValueList <OLed> vl; 336 QValueList <OLed> vl;
358 vl << Led_Mail; 337 vl << Led_Mail;
359 return vl; 338 return vl;
360} 339}
361 340
362QValueList <OLedState> HTC::ledStateList( OLed l ) const 341QValueList <OLedState> HTC::ledStateList( OLed l ) const
363{ 342{
364 QValueList <OLedState> vl; 343 QValueList <OLedState> vl;
365 344
366 if ( l == Led_Mail ) 345 if ( l == Led_Mail )
367 vl << Led_Off << Led_On << Led_BlinkSlow; 346 vl << Led_Off << Led_On << Led_BlinkSlow;
368 return vl; 347 return vl;
369} 348}
370 349
371OLedState HTC::ledState( OLed which ) const 350OLedState HTC::ledState( OLed which ) const
372{ 351{
373 if ( which == Led_Mail ) 352 if ( which == Led_Mail )
374 return m_leds [0]; 353 return m_leds [0];
375 else 354 else
376 return Led_Off; 355 return Led_Off;
377} 356}
378 357
379bool HTC::setLedState( OLed which, OLedState st ) 358bool HTC::setLedState( OLed which, OLedState st )
380{ 359{
381 // Currently not supported on non_embedix kernels 360 qDebug( "HTC::setLedState: ODevice handling not yet implemented" );
382 if (!m_embedix)
383 {
384 qDebug( "HTC::setLedState: ODevice handling for non-embedix kernels not yet implemented" );
385 return false;
386 }
387
388 static int fd = ::open ( "/dev/sharp_led", O_RDWR|O_NONBLOCK );
389
390 if ( which == Led_Mail ) {
391 if ( fd >= 0 ) {
392 struct sharp_led_status leds;
393 ::memset ( &leds, 0, sizeof( leds ));
394 leds. which = SHARP_LED_MAIL_EXISTS;
395 bool ok = true;
396
397 switch ( st ) {
398 case Led_Off : leds. status = LED_MAIL_NO_UNREAD_MAIL; break;
399 case Led_On : leds. status = LED_MAIL_NEWMAIL_EXISTS; break;
400 case Led_BlinkSlow: leds. status = LED_MAIL_UNREAD_MAIL_EX; break;
401 default : ok = false;
402 }
403
404 if ( ok && ( ::ioctl ( fd, SHARP_LED_SETSTATUS, &leds ) >= 0 )) {
405 m_leds [0] = st;
406 return true;
407 }
408 }
409 }
410 return false; 361 return false;
411} 362}
412 363
413int HTC::displayBrightnessResolution() const 364int HTC::displayBrightnessResolution() const
414{ 365{
415/* MV */
416 return 16;
417
418 int res = 1; 366 int res = 1;
419 if (m_embedix) 367
420 { 368 int fd = ::open( m_backlightdev + "max_brightness", O_RDONLY|O_NONBLOCK );
421 int fd = ::open( SHARP_FL_IOCTL_DEVICE, O_RDWR|O_NONBLOCK ); 369
422 if ( fd )
423 {
424 int value = ::ioctl( fd, SHARP_FL_IOCTL_GET_STEP, 0 );
425 ::close( fd );
426 return value ? value : res;
427 }
428 }
429 else
430 {
431 int fd = ::open( m_backlightdev + "max_brightness", O_RDONLY|O_NONBLOCK );
432 if ( fd ) 370 if ( fd )
433 { 371 {
434 char buf[100]; 372 char buf[100];
435 if ( ::read( fd, &buf[0], sizeof buf ) ) ::sscanf( &buf[0], "%d", &res ); 373 if ( ::read( fd, &buf[0], sizeof buf ) ) ::sscanf( &buf[0], "%d", &res );
436 ::close( fd ); 374 ::close( fd );
437 } 375 }
438 } 376
439 return res; 377 return res;
440} 378}
441 379
442bool HTC::setDisplayBrightness( int bright ) 380bool HTC::setDisplayBrightness( int bright )
443{ 381{
444/* MV */
445 return false;
446 382
447 //qDebug( "HTC::setDisplayBrightness( %d )", bright ); 383 //qDebug( "HTC::setDisplayBrightness( %d )", bright );
448 bool res = false; 384 bool res = false;
449 385
450 if ( bright > 255 ) bright = 255; 386 if ( bright > 255 ) bright = 255;
451 if ( bright < 0 ) bright = 0; 387 if ( bright < 0 ) bright = 0;
452 388
453 int numberOfSteps = displayBrightnessResolution(); 389 int numberOfSteps = displayBrightnessResolution();
454 int val = ( bright == 1 ) ? 1 : ( bright * numberOfSteps ) / 255; 390 int val = ( bright == 1 ) ? 1 : ( bright * numberOfSteps ) / 255;
455 391
456 if ( m_embedix ) 392 int fd = ::open( m_backlightdev + "brightness", O_WRONLY|O_NONBLOCK );
393 if ( fd )
457 { 394 {
458 int fd = ::open( SHARP_FL_IOCTL_DEVICE, O_WRONLY|O_NONBLOCK ); 395 char buf[100];
459 if ( fd ) 396 int len = ::snprintf( &buf[0], sizeof buf, "%d", val );
460 { 397 res = ( ::write( fd, &buf[0], len ) == 0 );
461 res = ( ::ioctl( fd, SHARP_FL_IOCTL_STEP_CONTRAST, val ) == 0 ); 398 ::close( fd );
462 ::close( fd );
463 }
464 }
465 else
466 {
467 int fd = ::open( m_backlightdev + "brightness", O_WRONLY|O_NONBLOCK );
468 if ( fd )
469 {
470 char buf[100];
471 int len = ::snprintf( &buf[0], sizeof buf, "%d", val );
472 res = ( ::write( fd, &buf[0], len ) == 0 );
473 ::close( fd );
474 }
475 } 399 }
476 return res; 400 return res;
477} 401}
478 402
479bool HTC::setDisplayStatus( bool on ) 403bool HTC::setDisplayStatus( bool on )
480{ 404{
481/* MV */
482 return false;
483 405
484 bool res = false; 406 bool res = false;
485 if ( m_embedix ) 407
486 { 408 int fd = ::open( m_backlightdev + "power", O_WRONLY|O_NONBLOCK );
487 int fd = ::open( SHARP_FL_IOCTL_DEVICE, O_WRONLY|O_NONBLOCK ); 409 if ( fd )
488 if ( fd )
489 {
490 int ioctlnum = on ? SHARP_FL_IOCTL_ON : SHARP_FL_IOCTL_OFF;
491 res = ( ::ioctl ( fd, ioctlnum, 0 ) == 0 );
492 ::close ( fd );
493 }
494 }
495 else
496 { 410 {
497 int fd = ::open( m_backlightdev + "power", O_WRONLY|O_NONBLOCK ); 411 char buf[10];
498 if ( fd ) 412 buf[0] = on ? FB_BLANK_UNBLANK : FB_BLANK_POWERDOWN;
499 { 413 buf[1] = '\0';
500 char buf[10]; 414 res = ( ::write( fd, &buf[0], 2 ) == 0 );
501 buf[0] = on ? FB_BLANK_UNBLANK : FB_BLANK_POWERDOWN; 415 ::close( fd );
502 buf[1] = '\0';
503 res = ( ::write( fd, &buf[0], 2 ) == 0 );
504 ::close( fd );
505 }
506 } 416 }
507 return res; 417 return res;
508} 418}
509 419
510Transformation HTC::rotation() const 420Transformation HTC::rotation() const
511{ 421{
512 qDebug( "HTC::rotation()" ); 422 qDebug( "HTC::rotation()" );
513 Transformation rot; 423 Transformation rot;
514 424
515 switch ( d->m_model ) { 425 switch ( d->m_model ) {
516 case Model_HTC_Universal: 426 case Model_HTC_Universal:
517 { 427 {
518 OHingeStatus hs = readHingeSensor(); 428 OHingeStatus hs = readHingeSensor();
519 qDebug( "HTC::rotation() - hinge sensor = %d", (int) hs ); 429 qDebug( "HTC::rotation() - hinge sensor = %d", (int) hs );
520 if ( hs == CASE_PORTRAIT ) rot = Rot0; 430 if ( hs == CASE_PORTRAIT ) rot = Rot0;
521 else if ( hs == CASE_UNKNOWN ) rot = Rot270; 431 else if ( hs == CASE_UNKNOWN ) rot = Rot270;
522 else rot = Rot270; 432 else rot = Rot270;
523 } 433 }
524 break; 434 break;
525 } 435 }
526 436
527 qDebug( "HTC::rotation() - returning '%d'", rot ); 437 qDebug( "HTC::rotation() - returning '%d'", rot );
528 return rot; 438 return rot;
529} 439}
530ODirection HTC::direction() const 440ODirection HTC::direction() const
531{ 441{
532 ODirection dir; 442 ODirection dir;
533 443
534 switch ( d->m_model ) { 444 switch ( d->m_model ) {
535 case Model_HTC_Universal: { 445 case Model_HTC_Universal: {
536 OHingeStatus hs = readHingeSensor(); 446 OHingeStatus hs = readHingeSensor();
537 if ( hs == CASE_PORTRAIT ) dir = CCW; 447 if ( hs == CASE_PORTRAIT ) dir = CCW;
538 else if ( hs == CASE_UNKNOWN ) dir = CCW; 448 else if ( hs == CASE_UNKNOWN ) dir = CCW;
539 else dir = CW; 449 else dir = CW;
540 } 450 }
541 break; 451 break;
542 default: dir = d->m_direction; 452 default: dir = d->m_direction;
543 break; 453 break;
544 } 454 }
545 return dir; 455 return dir;
546 456
547} 457}
548 458
549bool HTC::hasHingeSensor() const 459bool HTC::hasHingeSensor() const
550{ 460{
551 return d->m_model == Model_HTC_Universal; 461 return d->m_model == Model_HTC_Universal;
552} 462}
553 463
554OHingeStatus HTC::readHingeSensor() const 464OHingeStatus HTC::readHingeSensor() const
555{ 465{
556 if (m_embedix)
557 {
558 int handle = ::open("/dev/apm_bios", O_RDWR|O_NONBLOCK);
559 if (handle == -1)
560 {
561 qWarning("HTC::readHingeSensor() - failed (%s)", "unknown reason" ); //FIXME: use strerror
562 return CASE_UNKNOWN;
563 }
564 else
565 {
566 int retval = ::ioctl(handle, SHARP_IOCTL_GET_ROTATION);
567 ::close (handle);
568 if ( retval == CASE_CLOSED || retval == CASE_PORTRAIT || retval == CASE_LANDSCAPE )
569 {
570 qDebug( "HTC::readHingeSensor() - result = %d", retval );
571 return static_cast<OHingeStatus>( retval );
572 }
573 else
574 {
575 qWarning("HTC::readHingeSensor() - couldn't compute hinge status!" );
576 return CASE_UNKNOWN;
577 }
578 }
579 }
580 else
581 {
582 /* 466 /*
583 * The HTC Universal keyboard is event source 1 in kernel 2.6. 467 * The HTC Universal keyboard is event source 1 in kernel 2.6.
584 * Hinge status is reported via Input System Switchs 0 and 1 like that: 468 * Hinge status is reported via Input System Switchs 0 and 1 like that:
585 * 469 *
586 * ------------------------- 470 * -------------------------
587 * | SW0 | SW1 | CASE | 471 * | SW0 | SW1 | CASE |
588 * |-----|-----|-----------| 472 * |-----|-----|-----------|
589 * | 0 0 Unknown | 473 * | 0 0 Unknown |
590 * | 1 0 Portrait | 474 * | 1 0 Portrait |
591 * | 0 1 Closed | 475 * | 0 1 Closed |
592 * | 1 1 Landscape | 476 * | 1 1 Landscape |
593 * ------------------------- 477 * -------------------------
594 */ 478 */
595 OInputDevice* keyboard = OInputSystem::instance()->device( "event1" ); 479 OInputDevice* keyboard = OInputSystem::instance()->device( "event1" );
596 bool switch0 = true; 480 bool switch0 = true;
597 bool switch1 = false; 481 bool switch1 = false;
598 if ( keyboard ) 482 if ( keyboard )
599 { 483 {
600 switch0 = keyboard->isHeld( OInputDevice::Switch0 ); 484 switch0 = keyboard->isHeld( OInputDevice::Switch0 );
601 switch1 = keyboard->isHeld( OInputDevice::Switch1 ); 485 switch1 = keyboard->isHeld( OInputDevice::Switch1 );
602 } 486 }
603 if ( switch0 ) 487 if ( switch0 )
604 { 488 {
605 return switch1 ? CASE_LANDSCAPE : CASE_PORTRAIT; 489 return switch1 ? CASE_LANDSCAPE : CASE_PORTRAIT;
606 } 490 }
607 else 491 else
608 { 492 {
609 return switch1 ? CASE_CLOSED : CASE_UNKNOWN; 493 return switch1 ? CASE_CLOSED : CASE_UNKNOWN;
610 } 494 }
611 }
612} 495}
613 496
614void HTC::initHingeSensor() 497void HTC::initHingeSensor()
615{ 498{
616 if ( m_embedix ) return; 499 if ( m_embedix ) return;
617 500
618 m_hinge.setName( "/dev/input/event1" ); 501 m_hinge.setName( "/dev/input/event1" );
619 if ( !m_hinge.open( IO_ReadOnly ) ) 502 if ( !m_hinge.open( IO_ReadOnly ) )
620 { 503 {
621 qWarning( "HTC::init() - Couldn't open /dev/input/event1 for read (%s)", strerror( errno ) ); 504 qWarning( "HTC::init() - Couldn't open /dev/input/event1 for read (%s)", strerror( errno ) );
622 return; 505 return;
623 } 506 }
624 507
625 QSocketNotifier* sn = new QSocketNotifier( m_hinge.handle(), QSocketNotifier::Read, this ); 508 QSocketNotifier* sn = new QSocketNotifier( m_hinge.handle(), QSocketNotifier::Read, this );
626 QObject::connect( sn, SIGNAL(activated(int)), this, SLOT(hingeSensorTriggered()) ); 509 QObject::connect( sn, SIGNAL(activated(int)), this, SLOT(hingeSensorTriggered()) );
627 510
628 qDebug( "HTC::init() - Hinge Sensor Initialization successfully completed" ); 511 qDebug( "HTC::init() - Hinge Sensor Initialization successfully completed" );
629} 512}
630 513
631void HTC::hingeSensorTriggered() 514void HTC::hingeSensorTriggered()
632{ 515{
633 qDebug( "HTC::hingeSensorTriggered() - got event" ); 516 qDebug( "HTC::hingeSensorTriggered() - got event" );
634 struct input_event e; 517 struct input_event e;
635 if ( ::read( m_hinge.handle(), &e, sizeof e ) > 0 ) 518 if ( ::read( m_hinge.handle(), &e, sizeof e ) > 0 )
636 { 519 {
637 qDebug( "HTC::hingeSensorTriggered() - event has type %d, code %d, value %d", e.type, e.code, e.value ); 520 qDebug( "HTC::hingeSensorTriggered() - event has type %d, code %d, value %d", e.type, e.code, e.value );
638 if ( e.type != EV_SW ) return; 521 if ( e.type != EV_SW ) return;
639 if ( readHingeSensor() != CASE_UNKNOWN ) 522 if ( readHingeSensor() != CASE_UNKNOWN )
640 { 523 {
641 qDebug( "HTC::hingeSensorTriggered() - got valid switch event, calling rotateDefault()" ); 524 qDebug( "HTC::hingeSensorTriggered() - got valid switch event, calling rotateDefault()" );
642 QCopChannel::send( "QPE/Rotation", "rotateDefault()" ); 525 QCopChannel::send( "QPE/Rotation", "rotateDefault()" );
643 } 526 }
644 } 527 }
645} 528}
646 529
647void HTC::systemMessage( const QCString &msg, const QByteArray & ) 530void HTC::systemMessage( const QCString &msg, const QByteArray & )
648{ 531{
649 if ( msg == "deviceButtonMappingChanged()" ) { 532 if ( msg == "deviceButtonMappingChanged()" ) {
650 reloadButtonMapping(); 533 reloadButtonMapping();
651 } 534 }
652} 535}
653 536
654/* 537/*
655 * Take code from iPAQ device. 538 * Take code from iPAQ device.
656 * That way we switch the cursor directions depending on status of hinge sensor, eg. hardware direction. 539 * That way we switch the cursor directions depending on status of hinge sensor, eg. hardware direction.
657 * I hope that is ok - Alwin 540 * I hope that is ok - Alwin
658 */ 541 */
659bool HTC::filter ( int /*unicode*/, int keycode, int modifiers, bool isPress, bool autoRepeat ) 542bool HTC::filter ( int /*unicode*/, int keycode, int modifiers, bool isPress, bool autoRepeat )
660{ 543{
661 int newkeycode = keycode; 544 int newkeycode = keycode;
662 545
663 if ( !hasHingeSensor() ) return false; 546 if ( !hasHingeSensor() ) return false;
664 547
665 /* map cursor keys depending on the hinge status */ 548 /* map cursor keys depending on the hinge status */
666 switch ( keycode ) { 549 switch ( keycode ) {
667 // Rotate cursor keys 550 // Rotate cursor keys
668 case Key_Left : 551 case Key_Left :
669 case Key_Right: 552 case Key_Right:
670 case Key_Up : 553 case Key_Up :
671 case Key_Down : 554 case Key_Down :
672 { 555 {
673 if (rotation()==Rot90) { 556 if (rotation()==Rot90) {
674 newkeycode = Key_Left + ( keycode - Key_Left + 3 ) % 4; 557 newkeycode = Key_Left + ( keycode - Key_Left + 3 ) % 4;
675 } 558 }
676 } 559 }
677 break; 560 break;
678 561
679 } 562 }
680 if (newkeycode!=keycode) { 563 if (newkeycode!=keycode) {
681 if ( newkeycode != Key_unknown ) { 564 if ( newkeycode != Key_unknown ) {
682 QWSServer::sendKeyEvent ( -1, newkeycode, modifiers, isPress, autoRepeat ); 565 QWSServer::sendKeyEvent ( -1, newkeycode, modifiers, isPress, autoRepeat );
683 } 566 }
684 return true; 567 return true;
685 } 568 }
686 return false; 569 return false;
687} 570}
688 571
689bool HTC::suspend() { 572bool HTC::suspend() {
690 573
691/* MV */ 574/* MV */
692 return false; 575 return false;
693 576
694 if ( !isQWS( ) ) // only qwsserver is allowed to suspend 577 if ( !isQWS( ) ) // only qwsserver is allowed to suspend
695 return false; 578 return false;
696 579
697 bool res = false; 580 bool res = false;
698 QCopChannel::send( "QPE/System", "aboutToSuspend()" ); 581 QCopChannel::send( "QPE/System", "aboutToSuspend()" );
699 582
700 struct timeval tvs, tvn; 583 struct timeval tvs, tvn;
701 ::gettimeofday ( &tvs, 0 ); 584 ::gettimeofday ( &tvs, 0 );
702 585
703 ::sync(); // flush fs caches 586 ::sync(); // flush fs caches
704 res = ( ::system ( "apm --suspend" ) == 0 ); 587 res = ( ::system ( "apm --suspend" ) == 0 );
705 588
706 // This is needed because some apm implementations are asynchronous and we 589 // This is needed because some apm implementations are asynchronous and we
707 // can not be sure when exactly the device is really suspended 590 // can not be sure when exactly the device is really suspended
708 // This can be deleted as soon as a stable familiar with a synchronous apm implementation exists. 591 // This can be deleted as soon as a stable familiar with a synchronous apm implementation exists.
709 // on non embedix eg. 2.6 kernel line apm is synchronous so we don't need it here. 592 // on non embedix eg. 2.6 kernel line apm is synchronous so we don't need it here.
710 593
711 if ( res && m_embedix) { 594 if ( res && m_embedix) {
712 do { // wait at most 1.5 sec: either suspend didn't work or the device resumed 595 do { // wait at most 1.5 sec: either suspend didn't work or the device resumed
713 ::usleep ( 200 * 1000 ); 596 ::usleep ( 200 * 1000 );
714 ::gettimeofday ( &tvn, 0 ); 597 ::gettimeofday ( &tvn, 0 );
715 } while ((( tvn. tv_sec - tvs. tv_sec ) * 1000 + ( tvn. tv_usec - tvs. tv_usec ) / 1000 ) < m_timeOut ); 598 } while ((( tvn. tv_sec - tvs. tv_sec ) * 1000 + ( tvn. tv_usec - tvs. tv_usec ) / 1000 ) < m_timeOut );
716 } 599 }
717 600
718 QCopChannel::send( "QPE/System", "returnFromSuspend()" ); 601 QCopChannel::send( "QPE/System", "returnFromSuspend()" );
719 602
720 return res; 603 return res;
721} 604}
diff --git a/noncore/settings/sysinfo/versioninfo.cpp b/noncore/settings/sysinfo/versioninfo.cpp
index 29c9a05..5105b42 100644
--- a/noncore/settings/sysinfo/versioninfo.cpp
+++ b/noncore/settings/sysinfo/versioninfo.cpp
@@ -1,178 +1,192 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2000 Trolltech AS. All rights reserved. 2** Copyright (C) 2000 Trolltech AS. All rights reserved.
3** 3**
4** This file is part of Qtopia Environment. 4** This file is part of Qtopia Environment.
5** 5**
6** This file may be distributed and/or modified under the terms of the 6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software 7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the 8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file. 9** packaging of this file.
10** 10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information. 14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15** 15**
16** Contact info@trolltech.com if any conditions of this licensing are 16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you. 17** not clear to you.
18** 18**
19**********************************************************************/ 19**********************************************************************/
20 20
21#include "versioninfo.h" 21#include "versioninfo.h"
22 22
23/* OPIE */ 23/* OPIE */
24#include <opie2/odevice.h> 24#include <opie2/odevice.h>
25#include <opie2/oresource.h> 25#include <opie2/oresource.h>
26#include <qpe/version.h> 26#include <qpe/version.h>
27 27
28/* QT */ 28/* QT */
29#include <qfile.h> 29#include <qfile.h>
30#include <qlabel.h> 30#include <qlabel.h>
31#include <qlayout.h> 31#include <qlayout.h>
32#include <qscrollview.h> 32#include <qscrollview.h>
33#include <qtextstream.h> 33#include <qtextstream.h>
34#include <qwhatsthis.h> 34#include <qwhatsthis.h>
35 35
36using namespace Opie::Core; 36using namespace Opie::Core;
37 37
38VersionInfo::VersionInfo( QWidget *parent, const char *name, WFlags f ) 38VersionInfo::VersionInfo( QWidget *parent, const char *name, WFlags f )
39 : QWidget( parent, name, f ) 39 : QWidget( parent, name, f )
40{ 40{
41 setMinimumSize( 200, 150 ); 41 setMinimumSize( 200, 150 );
42 42
43 QVBoxLayout *tmpvb = new QVBoxLayout( this ); 43 QVBoxLayout *tmpvb = new QVBoxLayout( this );
44 QScrollView *sv = new QScrollView( this ); 44 QScrollView *sv = new QScrollView( this );
45 tmpvb->addWidget( sv, 0, 0 ); 45 tmpvb->addWidget( sv, 0, 0 );
46 sv->setResizePolicy( QScrollView::AutoOneFit ); 46 sv->setResizePolicy( QScrollView::AutoOneFit );
47 sv->setHScrollBarMode( QScrollView::AlwaysOff ); 47 sv->setHScrollBarMode( QScrollView::AlwaysOff );
48 sv->setVScrollBarMode( QScrollView::AlwaysOff ); 48 sv->setVScrollBarMode( QScrollView::AlwaysOff );
49 sv->setFrameStyle( QFrame::NoFrame ); 49 sv->setFrameStyle( QFrame::NoFrame );
50 QWidget *container = new QWidget( sv->viewport() ); 50 QWidget *container = new QWidget( sv->viewport() );
51 sv->addChild( container ); 51 sv->addChild( container );
52 52
53 QVBoxLayout *vb = new QVBoxLayout( container, 3 ); 53 QVBoxLayout *vb = new QVBoxLayout( container, 3 );
54 54
55 QString kernelVersionString; 55 QString kernelVersionString;
56 QFile file( "/proc/version" ); 56 QFile file( "/proc/version" );
57 if ( file.open( IO_ReadOnly ) ) 57 if ( file.open( IO_ReadOnly ) )
58 { 58 {
59 QTextStream t( &file ); 59 QTextStream t( &file );
60 QStringList strList; 60 QStringList strList;
61 61
62 strList = QStringList::split( " " , t.read(), false ); 62 strList = QStringList::split( " " , t.read(), false );
63 63
64 kernelVersionString = "<qt>" + tr( "<b>Linux Kernel</b><p>Version: " ); 64 kernelVersionString = "<qt>" + tr( "<b>Linux Kernel</b><p>Version: " );
65 kernelVersionString.append( strList[2] ); 65 kernelVersionString.append( strList[2] );
66 kernelVersionString.append( "<br>" ); 66 kernelVersionString.append( "<br>" );
67 kernelVersionString.append( tr( "Compiled by: " ) ); 67 kernelVersionString.append( tr( "Compiled by: " ) );
68 kernelVersionString.append( strList[3] ); 68 kernelVersionString.append( strList[3] );
69 kernelVersionString.append("</qt>"); 69 kernelVersionString.append("</qt>");
70 file.close(); 70 file.close();
71 } 71 }
72 72
73 QString palmtopVersionString = "<qt>" + tr( "<b>Opie</b><p>Version: " ); 73 QString palmtopVersionString = "<qt>" + tr( "<b>Opie</b><p>Version: " );
74 palmtopVersionString.append( QPE_VERSION ); 74 palmtopVersionString.append( QPE_VERSION );
75 palmtopVersionString.append( "<br>" ); 75 palmtopVersionString.append( "<br>" );
76#ifdef QPE_VENDOR 76#ifdef QPE_VENDOR
77 QString builder = QPE_VENDOR; 77 QString builder = QPE_VENDOR;
78#else 78#else
79 QString builder = "Unknown"; 79 QString builder = "Unknown";
80#endif 80#endif
81 palmtopVersionString.append( tr( "Built against Qt/E " ) ); 81 palmtopVersionString.append( tr( "Built against Qt/E " ) );
82 palmtopVersionString.append( QT_VERSION_STR ); 82 palmtopVersionString.append( QT_VERSION_STR );
83 palmtopVersionString.append( "<br>" ); 83 palmtopVersionString.append( "<br>" );
84 palmtopVersionString.append( tr( "Built on: " ) ); 84 palmtopVersionString.append( tr( "Built on: " ) );
85 palmtopVersionString.append( __DATE__ ); 85 palmtopVersionString.append( __DATE__ );
86 palmtopVersionString.append( "</qt>" ); 86 palmtopVersionString.append( "</qt>" );
87 87
88 QHBoxLayout *hb1 = new QHBoxLayout( vb ); 88 QHBoxLayout *hb1 = new QHBoxLayout( vb );
89 hb1->setSpacing( 2 ); 89 hb1->setSpacing( 2 );
90 90
91 QLabel *palmtopLogo = new QLabel( container ); 91 QLabel *palmtopLogo = new QLabel( container );
92 QImage logo1 = Opie::Core::OResource::loadImage( "logo/opielogo" ); 92 QImage logo1 = Opie::Core::OResource::loadImage( "logo/opielogo" );
93 logo1 = logo1.smoothScale( 50, 55 ); 93 logo1 = logo1.smoothScale( 50, 55 );
94 QPixmap logo1Pixmap; 94 QPixmap logo1Pixmap;
95 logo1Pixmap.convertFromImage( logo1 ); 95 logo1Pixmap.convertFromImage( logo1 );
96 palmtopLogo->setPixmap( logo1Pixmap ); 96 palmtopLogo->setPixmap( logo1Pixmap );
97 palmtopLogo->setFixedSize( 60, 60 ); 97 palmtopLogo->setFixedSize( 60, 60 );
98 hb1->addWidget( palmtopLogo, 0, Qt::AlignTop + Qt::AlignLeft ); 98 hb1->addWidget( palmtopLogo, 0, Qt::AlignTop + Qt::AlignLeft );
99 99
100 QLabel *palmtopVersion = new QLabel( container ); 100 QLabel *palmtopVersion = new QLabel( container );
101 palmtopVersion->setText( palmtopVersionString ); 101 palmtopVersion->setText( palmtopVersionString );
102 hb1->addWidget( palmtopVersion, 1, Qt::AlignTop + Qt::AlignLeft ); 102 hb1->addWidget( palmtopVersion, 1, Qt::AlignTop + Qt::AlignLeft );
103 103
104 104
105 QHBoxLayout *hb2 = new QHBoxLayout( vb ); 105 QHBoxLayout *hb2 = new QHBoxLayout( vb );
106 hb1->setSpacing( 2 ); 106 hb1->setSpacing( 2 );
107 107
108 QLabel *linuxLogo = new QLabel( container ); 108 QLabel *linuxLogo = new QLabel( container );
109 QImage logo2 = Opie::Core::OResource::loadImage( "logo/tux-logo" ); 109 QImage logo2 = Opie::Core::OResource::loadImage( "logo/tux-logo" );
110 logo2 = logo2.smoothScale( 55, 60 ); 110 logo2 = logo2.smoothScale( 55, 60 );
111 QPixmap logo2Pixmap; 111 QPixmap logo2Pixmap;
112 logo2Pixmap.convertFromImage( logo2 ); 112 logo2Pixmap.convertFromImage( logo2 );
113 linuxLogo->setPixmap( logo2Pixmap ); 113 linuxLogo->setPixmap( logo2Pixmap );
114 linuxLogo->setFixedSize( 60, 60 ); 114 linuxLogo->setFixedSize( 60, 60 );
115 hb2->addWidget( linuxLogo, 0, Qt::AlignTop + Qt::AlignLeft ); 115 hb2->addWidget( linuxLogo, 0, Qt::AlignTop + Qt::AlignLeft );
116 116
117 QLabel *kernelVersion = new QLabel( container ); 117 QLabel *kernelVersion = new QLabel( container );
118 kernelVersion->setText( kernelVersionString ); 118 kernelVersion->setText( kernelVersionString );
119 hb2->addWidget( kernelVersion, 1, Qt::AlignTop + Qt::AlignLeft ); 119 hb2->addWidget( kernelVersion, 1, Qt::AlignTop + Qt::AlignLeft );
120 120
121 121
122 QHBoxLayout *hb3 = new QHBoxLayout( vb ); 122 QHBoxLayout *hb3 = new QHBoxLayout( vb );
123 hb3->setSpacing( 2 ); 123 hb3->setSpacing( 2 );
124 124
125 QLabel *palmtopLogo3 = new QLabel( container ); 125 QLabel *palmtopLogo3 = new QLabel( container );
126 126
127 OModel model = ODevice::inst()->model(); 127 OModel model = ODevice::inst()->model();
128 QString modelPixmap = "sysinfo/"; 128 QString modelPixmap = "sysinfo/";
129 if ( model == Model_Zaurus_SLC7x0 ) 129 if ( model == Model_Zaurus_SLC7x0 )
130 modelPixmap += "zaurusc700"; 130 modelPixmap += "zaurusc700";
131 else if ( model >= Model_Zaurus_SL5000 && model <= Model_Zaurus_SLB600 ) 131 else if ( model >= Model_Zaurus_SL5000 && model <= Model_Zaurus_SLB600 )
132 modelPixmap += "zaurus5500"; 132 modelPixmap += "zaurus5500";
133 else if ( model >= Model_iPAQ_H31xx && model <= Model_iPAQ_H5xxx ) 133 else if ( model >= Model_iPAQ_H31xx && model <= Model_iPAQ_H5xxx )
134 modelPixmap += "ipaq3600"; 134 modelPixmap += "ipaq3600";
135 else if ( model >= Model_SIMpad_CL4 && model <= Model_SIMpad_TSinus ) 135 else if ( model >= Model_SIMpad_CL4 && model <= Model_SIMpad_TSinus )
136 modelPixmap += "simpad"; 136 modelPixmap += "simpad";
137 else if ( model == Model_Jornada_56x ) 137 else if ( model == Model_Jornada_56x )
138 modelPixmap += "jornada56x"; 138 modelPixmap += "jornada56x";
139 else if ( model == Model_Jornada_720 ) 139 else if ( model == Model_Jornada_720 )
140 modelPixmap += "jornada720"; 140 modelPixmap += "jornada720";
141 else if ( model == Model_HTC_Universal )
142 modelPixmap += "htcuniversal";
143 else if ( model == Model_HTC_Blueangel )
144 modelPixmap += "htcblueangel";
145 else if ( model == Model_HTC_Apache )
146 modelPixmap += "htcapache";
147 else if ( model == Model_HTC_Magician )
148 modelPixmap += "htcmagician";
149 else if ( model == Model_HTC_Himalaya )
150 modelPixmap += "htchimalaya";
151 else if ( model == Model_HTC_Alpine )
152 modelPixmap += "htcalpine";
153 else if ( model == Model_HTC_Beetles )
154 modelPixmap += "htcbeetles";
141 else 155 else
142 modelPixmap += "pda"; 156 modelPixmap += "pda";
143 157
144 QImage logo3 = Opie::Core::OResource::loadImage( modelPixmap ); 158 QImage logo3 = Opie::Core::OResource::loadImage( modelPixmap );
145 159
146 int width = logo3.width(); 160 int width = logo3.width();
147 int height = logo3.height(); 161 int height = logo3.height();
148 float aspect = float( height ) / width; 162 float aspect = float( height ) / width;
149 logo3 = logo3.smoothScale( 50, 50.0 * aspect ); 163 logo3 = logo3.smoothScale( 50, 50.0 * aspect );
150 164
151 QPixmap logo3Pixmap; 165 QPixmap logo3Pixmap;
152 logo3Pixmap.convertFromImage( logo3 ); 166 logo3Pixmap.convertFromImage( logo3 );
153 palmtopLogo3->setPixmap( logo3Pixmap ); 167 palmtopLogo3->setPixmap( logo3Pixmap );
154 palmtopLogo3->setFixedSize( 60, 100 ); 168 palmtopLogo3->setFixedSize( 60, 100 );
155 hb3->addWidget( palmtopLogo3, 0, Qt::AlignTop + Qt::AlignLeft ); 169 hb3->addWidget( palmtopLogo3, 0, Qt::AlignTop + Qt::AlignLeft );
156 170
157 QString systemString = "<qt><b>"; 171 QString systemString = "<qt><b>";
158 systemString.append( ODevice::inst()->systemString() ); 172 systemString.append( ODevice::inst()->systemString() );
159 systemString.append( "</b>" ); 173 systemString.append( "</b>" );
160 systemString.append( tr( "<p>Version: " ) ); 174 systemString.append( tr( "<p>Version: " ) );
161 systemString.append( ODevice::inst()->systemVersionString() ); 175 systemString.append( ODevice::inst()->systemVersionString() );
162 systemString.append( tr( "<br>Model: " ) ); 176 systemString.append( tr( "<br>Model: " ) );
163 systemString.append( ODevice::inst()->modelString() ); 177 systemString.append( ODevice::inst()->modelString() );
164 systemString.append( tr( "<br>Vendor: " ) ); 178 systemString.append( tr( "<br>Vendor: " ) );
165 systemString.append( ODevice::inst()->vendorString() ); 179 systemString.append( ODevice::inst()->vendorString() );
166 systemString.append("</qt>"); 180 systemString.append("</qt>");
167 181
168 QLabel *systemVersion = new QLabel( container ); 182 QLabel *systemVersion = new QLabel( container );
169 systemVersion->setText( systemString ); 183 systemVersion->setText( systemString );
170 hb3->addWidget( systemVersion, 1, Qt::AlignTop + Qt::AlignLeft ); 184 hb3->addWidget( systemVersion, 1, Qt::AlignTop + Qt::AlignLeft );
171 185
172 QWhatsThis::add( this, tr( "This page shows the current versions of Opie, the Linux kernel and distribution running on this handheld device." ) ); 186 QWhatsThis::add( this, tr( "This page shows the current versions of Opie, the Linux kernel and distribution running on this handheld device." ) );
173} 187}
174 188
175VersionInfo::~VersionInfo() 189VersionInfo::~VersionInfo()
176{ 190{
177} 191}
178 192
diff --git a/pics/sysinfo/htcalpine.png b/pics/sysinfo/htcalpine.png
new file mode 100644
index 0000000..6a963d9
--- a/dev/null
+++ b/pics/sysinfo/htcalpine.png
Binary files differ
diff --git a/pics/sysinfo/htcapache.png b/pics/sysinfo/htcapache.png
new file mode 100644
index 0000000..f11102f
--- a/dev/null
+++ b/pics/sysinfo/htcapache.png
Binary files differ
diff --git a/pics/sysinfo/htcbeetles.png b/pics/sysinfo/htcbeetles.png
new file mode 100644
index 0000000..5cfa8af
--- a/dev/null
+++ b/pics/sysinfo/htcbeetles.png
Binary files differ
diff --git a/pics/sysinfo/htcblueangel.png b/pics/sysinfo/htcblueangel.png
new file mode 100644
index 0000000..46c18d3
--- a/dev/null
+++ b/pics/sysinfo/htcblueangel.png
Binary files differ
diff --git a/pics/sysinfo/htchimalaya.png b/pics/sysinfo/htchimalaya.png
new file mode 100644
index 0000000..6a963d9
--- a/dev/null
+++ b/pics/sysinfo/htchimalaya.png
Binary files differ
diff --git a/pics/sysinfo/htcmagician.png b/pics/sysinfo/htcmagician.png
new file mode 100644
index 0000000..b6e6223
--- a/dev/null
+++ b/pics/sysinfo/htcmagician.png
Binary files differ
diff --git a/pics/sysinfo/htcuniversal.png b/pics/sysinfo/htcuniversal.png
new file mode 100644
index 0000000..e413bfb
--- a/dev/null
+++ b/pics/sysinfo/htcuniversal.png
Binary files differ