summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--libopie/odevice.cpp91
-rw-r--r--libopie/odevice.h3
2 files changed, 70 insertions, 24 deletions
diff --git a/libopie/odevice.cpp b/libopie/odevice.cpp
index 80975c9..377945d 100644
--- a/libopie/odevice.cpp
+++ b/libopie/odevice.cpp
@@ -1,1203 +1,1248 @@
1/* This file is part of the OPIE libraries 1/* This file is part of the OPIE libraries
2 Copyright (C) 2002 Robert Griebl (sandman@handhelds.org) 2 Copyright (C) 2002 Robert Griebl (sandman@handhelds.org)
3 3
4 This library is free software; you can redistribute it and/or 4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Library General Public 5 modify it under the terms of the GNU Library General Public
6 License as published by the Free Software Foundation; either 6 License as published by the Free Software Foundation; either
7 version 2 of the License, or (at your option) any later version. 7 version 2 of the License, or (at your option) any later version.
8 8
9 This library is distributed in the hope that it will be useful, 9 This library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of 10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Library General Public License for more details. 12 Library General Public License for more details.
13 13
14 You should have received a copy of the GNU Library General Public License 14 You should have received a copy of the GNU Library General Public License
15 along with this library; see the file COPYING.LIB. If not, write to 15 along with this library; see the file COPYING.LIB. If not, write to
16 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 16 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17 Boston, MA 02111-1307, USA. 17 Boston, MA 02111-1307, USA.
18*/ 18*/
19 19
20#include <stdlib.h> 20#include <stdlib.h>
21#include <unistd.h> 21#include <unistd.h>
22#include <fcntl.h> 22#include <fcntl.h>
23#include <sys/ioctl.h> 23#include <sys/ioctl.h>
24#include <signal.h> 24#include <signal.h>
25#include <sys/time.h> 25#include <sys/time.h>
26#include <linux/soundcard.h> 26#include <linux/soundcard.h>
27#include <math.h> 27#include <math.h>
28 28
29#include <qapplication.h> 29#include <qapplication.h>
30 30
31#include <qfile.h> 31#include <qfile.h>
32#include <qtextstream.h> 32#include <qtextstream.h>
33#include <qpe/sound.h> 33#include <qpe/sound.h>
34#include <qpe/resource.h> 34#include <qpe/resource.h>
35#include <qpe/config.h> 35#include <qpe/config.h>
36#include <qpe/qcopenvelope_qws.h> 36#include <qpe/qcopenvelope_qws.h>
37 37
38#include "odevice.h" 38#include "odevice.h"
39 39
40#include <qwindowsystem_qws.h> 40#include <qwindowsystem_qws.h>
41 41
42 42
43// _IO and friends are only defined in kernel headers ... 43// _IO and friends are only defined in kernel headers ...
44 44
45#define OD_IOC(dir,type,number,size) (( dir << 30 ) | ( type << 8 ) | ( number ) | ( size << 16 )) 45#define OD_IOC(dir,type,number,size) (( dir << 30 ) | ( type << 8 ) | ( number ) | ( size << 16 ))
46 46
47#define OD_IO(type,number) OD_IOC(0,type,number,0) 47#define OD_IO(type,number) OD_IOC(0,type,number,0)
48#define OD_IOW(type,number,size) OD_IOC(1,type,number,sizeof(size)) 48#define OD_IOW(type,number,size) OD_IOC(1,type,number,sizeof(size))
49#define OD_IOR(type,number,size) OD_IOC(2,type,number,sizeof(size)) 49#define OD_IOR(type,number,size) OD_IOC(2,type,number,sizeof(size))
50#define OD_IORW(type,number,size) OD_IOC(3,type,number,sizeof(size)) 50#define OD_IORW(type,number,size) OD_IOC(3,type,number,sizeof(size))
51 51
52using namespace Opie; 52using namespace Opie;
53 53
54class ODeviceData { 54class ODeviceData {
55public: 55public:
56 bool m_qwsserver; 56 bool m_qwsserver;
57 57
58 QString m_vendorstr; 58 QString m_vendorstr;
59 OVendor m_vendor; 59 OVendor m_vendor;
60 60
61 QString m_modelstr; 61 QString m_modelstr;
62 OModel m_model; 62 OModel m_model;
63 63
64 QString m_systemstr; 64 QString m_systemstr;
65 OSystem m_system; 65 OSystem m_system;
66 66
67 QString m_sysverstr; 67 QString m_sysverstr;
68 68
69 Transformation m_rotation; 69 Transformation m_rotation;
70 70
71 QValueList <ODeviceButton> m_buttons; 71 QValueList <ODeviceButton> *m_buttons;
72 uint m_holdtime; 72 uint m_holdtime;
73}; 73};
74 74
75 75
76class iPAQ : public ODevice, public QWSServer::KeyboardFilter { 76class iPAQ : public ODevice, public QWSServer::KeyboardFilter {
77protected: 77protected:
78 virtual void init ( ); 78 virtual void init ( );
79 virtual void initButtons ( );
79 80
80public: 81public:
81 virtual bool setSoftSuspend ( bool soft ); 82 virtual bool setSoftSuspend ( bool soft );
82 83
83 virtual bool setDisplayBrightness ( int b ); 84 virtual bool setDisplayBrightness ( int b );
84 virtual int displayBrightnessResolution ( ) const; 85 virtual int displayBrightnessResolution ( ) const;
85 86
86 virtual void alarmSound ( ); 87 virtual void alarmSound ( );
87 88
88 virtual QValueList <OLed> ledList ( ) const; 89 virtual QValueList <OLed> ledList ( ) const;
89 virtual QValueList <OLedState> ledStateList ( OLed led ) const; 90 virtual QValueList <OLedState> ledStateList ( OLed led ) const;
90 virtual OLedState ledState ( OLed led ) const; 91 virtual OLedState ledState ( OLed led ) const;
91 virtual bool setLedState ( OLed led, OLedState st ); 92 virtual bool setLedState ( OLed led, OLedState st );
92 93
93 virtual bool hasLightSensor ( ) const; 94 virtual bool hasLightSensor ( ) const;
94 virtual int readLightSensor ( ); 95 virtual int readLightSensor ( );
95 virtual int lightSensorResolution ( ) const; 96 virtual int lightSensorResolution ( ) const;
96 97
97protected: 98protected:
98 virtual bool filter ( int unicode, int keycode, int modifiers, bool isPress, bool autoRepeat ); 99 virtual bool filter ( int unicode, int keycode, int modifiers, bool isPress, bool autoRepeat );
99 virtual void timerEvent ( QTimerEvent *te ); 100 virtual void timerEvent ( QTimerEvent *te );
100 101
101 int m_power_timer; 102 int m_power_timer;
102 103
103 OLedState m_leds [2]; 104 OLedState m_leds [2];
104}; 105};
105 106
106class Zaurus : public ODevice { 107class Zaurus : public ODevice {
107protected: 108protected:
108 virtual void init ( ); 109 virtual void init ( );
110 virtual void initButtons ( );
109 111
110 public: 112 public:
111 virtual bool setSoftSuspend ( bool soft ); 113 virtual bool setSoftSuspend ( bool soft );
112 114
113 virtual bool setDisplayBrightness ( int b ); 115 virtual bool setDisplayBrightness ( int b );
114 virtual int displayBrightnessResolution ( ) const; 116 virtual int displayBrightnessResolution ( ) const;
115 117
116 virtual void alarmSound ( ); 118 virtual void alarmSound ( );
117 virtual void keySound ( ); 119 virtual void keySound ( );
118 virtual void touchSound ( ); 120 virtual void touchSound ( );
119 121
120 virtual QValueList <OLed> ledList ( ) const; 122 virtual QValueList <OLed> ledList ( ) const;
121 virtual QValueList <OLedState> ledStateList ( OLed led ) const; 123 virtual QValueList <OLedState> ledStateList ( OLed led ) const;
122 virtual OLedState ledState ( OLed led ) const; 124 virtual OLedState ledState ( OLed led ) const;
123 virtual bool setLedState ( OLed led, OLedState st ); 125 virtual bool setLedState ( OLed led, OLedState st );
124 126
125protected: 127protected:
126 virtual void buzzer ( int snd ); 128 virtual void buzzer ( int snd );
127 129
128 OLedState m_leds [1]; 130 OLedState m_leds [1];
129}; 131};
130 132
131 133
132struct i_button { 134struct i_button {
133 uint model; 135 uint model;
134 Qt::Key code; 136 Qt::Key code;
135 char *utext; 137 char *utext;
136 char *pix; 138 char *pix;
137 char *fpressedservice; 139 char *fpressedservice;
138 char *fpressedaction; 140 char *fpressedaction;
139 char *fheldservice; 141 char *fheldservice;
140 char *fheldaction; 142 char *fheldaction;
141} ipaq_buttons [] = { 143} ipaq_buttons [] = {
142 { Model_iPAQ_H31xx | Model_iPAQ_H36xx | Model_iPAQ_H37xx | Model_iPAQ_H38xx | Model_iPAQ_H39xx, 144 { Model_iPAQ_H31xx | Model_iPAQ_H36xx | Model_iPAQ_H37xx | Model_iPAQ_H38xx | Model_iPAQ_H39xx,
143 Qt::Key_F9, QT_TRANSLATE_NOOP("Button", "Calendar Button"), 145 Qt::Key_F9, QT_TRANSLATE_NOOP("Button", "Calendar Button"),
144 "devicebuttons/ipaq_calendar", 146 "devicebuttons/ipaq_calendar",
145 "datebook", "nextView()", 147 "datebook", "nextView()",
146 "today", "raise()" }, 148 "today", "raise()" },
147 { Model_iPAQ_H31xx | Model_iPAQ_H36xx | Model_iPAQ_H37xx | Model_iPAQ_H38xx | Model_iPAQ_H39xx, 149 { Model_iPAQ_H31xx | Model_iPAQ_H36xx | Model_iPAQ_H37xx | Model_iPAQ_H38xx | Model_iPAQ_H39xx,
148 Qt::Key_F10, QT_TRANSLATE_NOOP("Button", "Contacts Button"), 150 Qt::Key_F10, QT_TRANSLATE_NOOP("Button", "Contacts Button"),
149 "devicebuttons/ipaq_contact", 151 "devicebuttons/ipaq_contact",
150 "addressbook", "raise()", 152 "addressbook", "raise()",
151 "addressbook", "beamBusinessCard()" }, 153 "addressbook", "beamBusinessCard()" },
152 { Model_iPAQ_H31xx | Model_iPAQ_H36xx | Model_iPAQ_H37xx, 154 { Model_iPAQ_H31xx | Model_iPAQ_H36xx | Model_iPAQ_H37xx,
153 Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Menu Button"), 155 Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Menu Button"),
154 "devicebuttons/ipaq_menu", 156 "devicebuttons/ipaq_menu",
155 "QPE/TaskBar", "toggleMenu()", 157 "QPE/TaskBar", "toggleMenu()",
156 "QPE/TaskBar", "toggleStartMenu()" }, 158 "QPE/TaskBar", "toggleStartMenu()" },
157 { Model_iPAQ_H38xx | Model_iPAQ_H39xx, 159 { Model_iPAQ_H38xx | Model_iPAQ_H39xx,
158 Qt::Key_F13, QT_TRANSLATE_NOOP("Button", "Mail Button"), 160 Qt::Key_F13, QT_TRANSLATE_NOOP("Button", "Mail Button"),
159 "devicebuttons/ipaq_mail", 161 "devicebuttons/ipaq_mail",
160 "mail", "raise()", 162 "mail", "raise()",
161 "mail", "newMail()" }, 163 "mail", "newMail()" },
162 { Model_iPAQ_H31xx | Model_iPAQ_H36xx | Model_iPAQ_H37xx | Model_iPAQ_H38xx | Model_iPAQ_H39xx, 164 { Model_iPAQ_H31xx | Model_iPAQ_H36xx | Model_iPAQ_H37xx | Model_iPAQ_H38xx | Model_iPAQ_H39xx,
163 Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Home Button"), 165 Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Home Button"),
164 "devicebuttons/ipaq_home", 166 "devicebuttons/ipaq_home",
165 "QPE/Launcher", "home()", 167 "QPE/Launcher", "home()",
166 "buttonsettings", "raise()" }, 168 "buttonsettings", "raise()" },
167 { Model_iPAQ_H31xx | Model_iPAQ_H36xx | Model_iPAQ_H37xx | Model_iPAQ_H38xx | Model_iPAQ_H39xx, 169 { Model_iPAQ_H31xx | Model_iPAQ_H36xx | Model_iPAQ_H37xx | Model_iPAQ_H38xx | Model_iPAQ_H39xx,
168 Qt::Key_F24, QT_TRANSLATE_NOOP("Button", "Record Button"), 170 Qt::Key_F24, QT_TRANSLATE_NOOP("Button", "Record Button"),
169 "devicebuttons/ipaq_record", 171 "devicebuttons/ipaq_record",
170 "QPE/VMemo", "toggleRecord()", 172 "QPE/VMemo", "toggleRecord()",
171 "sound", "raise()" }, 173 "sound", "raise()" },
172}; 174};
173 175
174struct z_button { 176struct z_button {
175 Qt::Key code; 177 Qt::Key code;
176 char *utext; 178 char *utext;
177 char *pix; 179 char *pix;
178 char *fpressedservice; 180 char *fpressedservice;
179 char *fpressedaction; 181 char *fpressedaction;
180 char *fheldservice; 182 char *fheldservice;
181 char *fheldaction; 183 char *fheldaction;
182} z_buttons [] = { 184} z_buttons [] = {
183 { Qt::Key_F9, QT_TRANSLATE_NOOP("Button", "Calendar Button"), 185 { Qt::Key_F9, QT_TRANSLATE_NOOP("Button", "Calendar Button"),
184 "devicebuttons/z_calendar", 186 "devicebuttons/z_calendar",
185 "datebook", "nextView()", 187 "datebook", "nextView()",
186 "today", "raise()" }, 188 "today", "raise()" },
187 { Qt::Key_F10, QT_TRANSLATE_NOOP("Button", "Contacts Button"), 189 { Qt::Key_F10, QT_TRANSLATE_NOOP("Button", "Contacts Button"),
188 "devicebuttons/z_contact", 190 "devicebuttons/z_contact",
189 "addressbook", "raise()", 191 "addressbook", "raise()",
190 "addressbook", "beamBusinessCard()" }, 192 "addressbook", "beamBusinessCard()" },
191 { Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Home Button"), 193 { Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Home Button"),
192 "devicebuttons/z_home", 194 "devicebuttons/z_home",
193 "QPE/Launcher", "home()", 195 "QPE/Launcher", "home()",
194 "buttonsettings", "raise()" }, 196 "buttonsettings", "raise()" },
195 { Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Menu Button"), 197 { Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Menu Button"),
196 "devicebuttons/z_menu", 198 "devicebuttons/z_menu",
197 "QPE/TaskBar", "toggleMenu()", 199 "QPE/TaskBar", "toggleMenu()",
198 "QPE/TaskBar", "toggleStartMenu()" }, 200 "QPE/TaskBar", "toggleStartMenu()" },
199 { Qt::Key_F13, QT_TRANSLATE_NOOP("Button", "Mail Button"), 201 { Qt::Key_F13, QT_TRANSLATE_NOOP("Button", "Mail Button"),
200 "devicebuttons/z_mail", 202 "devicebuttons/z_mail",
201 "mail", "raise()", 203 "mail", "raise()",
202 "mail", "newMail()" }, 204 "mail", "newMail()" },
203}; 205};
204 206
205static QCString makeChannel ( const char *str ) 207static QCString makeChannel ( const char *str )
206{ 208{
207 if ( str && !::strchr ( str, '/' )) 209 if ( str && !::strchr ( str, '/' ))
208 return QCString ( "QPE/Application/" ) + str; 210 return QCString ( "QPE/Application/" ) + str;
209 else 211 else
210 return str; 212 return str;
211} 213}
212 214
213 215
214 216
215 217
216ODevice *ODevice::inst ( ) 218ODevice *ODevice::inst ( )
217{ 219{
218 static ODevice *dev = 0; 220 static ODevice *dev = 0;
219 221
220 if ( !dev ) { 222 if ( !dev ) {
221 if ( QFile::exists ( "/proc/hal/model" )) 223 if ( QFile::exists ( "/proc/hal/model" ))
222 dev = new iPAQ ( ); 224 dev = new iPAQ ( );
223 else if ( QFile::exists ( "/dev/sharp_buz" ) || QFile::exists ( "/dev/sharp_led" )) 225 else if ( QFile::exists ( "/dev/sharp_buz" ) || QFile::exists ( "/dev/sharp_led" ))
224 dev = new Zaurus ( ); 226 dev = new Zaurus ( );
225 else 227 else
226 dev = new ODevice ( ); 228 dev = new ODevice ( );
227 229
228 dev-> init ( ); 230 dev-> init ( );
229 } 231 }
230 return dev; 232 return dev;
231} 233}
232 234
233 235
234/************************************************** 236/**************************************************
235 * 237 *
236 * common 238 * common
237 * 239 *
238 **************************************************/ 240 **************************************************/
239 241
240 242
241ODevice::ODevice ( ) 243ODevice::ODevice ( )
242{ 244{
243 d = new ODeviceData; 245 d = new ODeviceData;
244 246
245 d-> m_qwsserver = qApp ? ( qApp-> type ( ) == QApplication::GuiServer ) : false; 247 d-> m_qwsserver = qApp ? ( qApp-> type ( ) == QApplication::GuiServer ) : false;
246 248
247 d-> m_modelstr = "Unknown"; 249 d-> m_modelstr = "Unknown";
248 d-> m_model = Model_Unknown; 250 d-> m_model = Model_Unknown;
249 d-> m_vendorstr = "Unknown"; 251 d-> m_vendorstr = "Unknown";
250 d-> m_vendor = Vendor_Unknown; 252 d-> m_vendor = Vendor_Unknown;
251 d-> m_systemstr = "Unknown"; 253 d-> m_systemstr = "Unknown";
252 d-> m_system = System_Unknown; 254 d-> m_system = System_Unknown;
253 d-> m_sysverstr = "0.0"; 255 d-> m_sysverstr = "0.0";
254 d-> m_rotation = Rot0; 256 d-> m_rotation = Rot0;
255 257
256 d-> m_holdtime = 1000; // 1000ms 258 d-> m_holdtime = 1000; // 1000ms
257 259 d-> m_buttons = 0;
258 QCopChannel *sysch = new QCopChannel ( "QPE/System", this );
259 connect ( sysch, SIGNAL( received( const QCString &, const QByteArray & )), this, SLOT( systemMessage ( const QCString &, const QByteArray & )));
260} 260}
261 261
262void ODevice::systemMessage ( const QCString &msg, const QByteArray & ) 262void ODevice::systemMessage ( const QCString &msg, const QByteArray & )
263{ 263{
264 if ( msg == "deviceButtonMappingChanged()" ) { 264 if ( msg == "deviceButtonMappingChanged()" ) {
265 reloadButtonMapping ( ); 265 reloadButtonMapping ( );
266 } 266 }
267} 267}
268 268
269void ODevice::init ( ) 269void ODevice::init ( )
270{ 270{
271}
272
273void ODevice::initButtons ( )
274{
275 if ( d-> m_buttons )
276 return;
277
271 // Simulation uses iPAQ 3660 device buttons 278 // Simulation uses iPAQ 3660 device buttons
272 279
280 qDebug ( "init Buttons" );
281 d-> m_buttons = new QValueList <ODeviceButton>;
282
273 for ( uint i = 0; i < ( sizeof( ipaq_buttons ) / sizeof( i_button )); i++ ) { 283 for ( uint i = 0; i < ( sizeof( ipaq_buttons ) / sizeof( i_button )); i++ ) {
274 i_button *ib = ipaq_buttons + i; 284 i_button *ib = ipaq_buttons + i;
275 ODeviceButton b; 285 ODeviceButton b;
276 286
277 if (( ib-> model & Model_iPAQ_H36xx ) == Model_iPAQ_H36xx ) { 287 if (( ib-> model & Model_iPAQ_H36xx ) == Model_iPAQ_H36xx ) {
278 b. setKeycode ( ib-> code ); 288 b. setKeycode ( ib-> code );
279 b. setUserText ( QObject::tr ( "Button", ib-> utext )); 289 b. setUserText ( QObject::tr ( "Button", ib-> utext ));
280 b. setPixmap ( Resource::loadPixmap ( ib-> pix )); 290 b. setPixmap ( Resource::loadPixmap ( ib-> pix ));
281 b. setFactoryPresetPressedAction ( OQCopMessage ( makeChannel ( ib-> fpressedservice ), ib-> fpressedaction )); 291 b. setFactoryPresetPressedAction ( OQCopMessage ( makeChannel ( ib-> fpressedservice ), ib-> fpressedaction ));
282 b. setFactoryPresetHeldAction ( OQCopMessage ( makeChannel ( ib-> fheldservice ), ib-> fheldaction )); 292 b. setFactoryPresetHeldAction ( OQCopMessage ( makeChannel ( ib-> fheldservice ), ib-> fheldaction ));
283 d-> m_buttons. append ( b ); 293 d-> m_buttons-> append ( b );
284 } 294 }
285 } 295 }
286 reloadButtonMapping ( ); 296 reloadButtonMapping ( );
297
298 QCopChannel *sysch = new QCopChannel ( "QPE/System", this );
299 connect ( sysch, SIGNAL( received( const QCString &, const QByteArray & )), this, SLOT( systemMessage ( const QCString &, const QByteArray & )));
287} 300}
288 301
289ODevice::~ODevice ( ) 302ODevice::~ODevice ( )
290{ 303{
291 delete d; 304 delete d;
292} 305}
293 306
294bool ODevice::setSoftSuspend ( bool /*soft*/ ) 307bool ODevice::setSoftSuspend ( bool /*soft*/ )
295{ 308{
296 return false; 309 return false;
297} 310}
298 311
299//#include <linux/apm_bios.h> 312//#include <linux/apm_bios.h>
300 313
301#define APM_IOC_SUSPEND OD_IO( 'A', 2 ) 314#define APM_IOC_SUSPEND OD_IO( 'A', 2 )
302 315
303 316
304bool ODevice::suspend ( ) 317bool ODevice::suspend ( )
305{ 318{
306 if ( !d-> m_qwsserver ) // only qwsserver is allowed to suspend 319 if ( !d-> m_qwsserver ) // only qwsserver is allowed to suspend
307 return false; 320 return false;
308 321
309 if ( d-> m_model == Model_Unknown ) // better don't suspend in qvfb / on unkown devices 322 if ( d-> m_model == Model_Unknown ) // better don't suspend in qvfb / on unkown devices
310 return false; 323 return false;
311 324
312 bool res = false; 325 bool res = false;
313 326
314 struct timeval tvs, tvn; 327 struct timeval tvs, tvn;
315 ::gettimeofday ( &tvs, 0 ); 328 ::gettimeofday ( &tvs, 0 );
316 329
317 ::sync ( ); // flush fs caches 330 ::sync ( ); // flush fs caches
318 res = ( ::system ( "apm --suspend" ) == 0 ); 331 res = ( ::system ( "apm --suspend" ) == 0 );
319 332
320 // This is needed because the iPAQ apm implementation is asynchronous and we 333 // This is needed because the iPAQ apm implementation is asynchronous and we
321 // can not be sure when exactly the device is really suspended 334 // can not be sure when exactly the device is really suspended
322 // This can be deleted as soon as a stable familiar with a synchronous apm implementation exists. 335 // This can be deleted as soon as a stable familiar with a synchronous apm implementation exists.
323 336
324 if ( res ) { 337 if ( res ) {
325 do { // wait at most 1.5 sec: either suspend didn't work or the device resumed 338 do { // wait at most 1.5 sec: either suspend didn't work or the device resumed
326 ::usleep ( 200 * 1000 ); 339 ::usleep ( 200 * 1000 );
327 ::gettimeofday ( &tvn, 0 ); 340 ::gettimeofday ( &tvn, 0 );
328 } while ((( tvn. tv_sec - tvs. tv_sec ) * 1000 + ( tvn. tv_usec - tvs. tv_usec ) / 1000 ) < 1500 ); 341 } while ((( tvn. tv_sec - tvs. tv_sec ) * 1000 + ( tvn. tv_usec - tvs. tv_usec ) / 1000 ) < 1500 );
329 } 342 }
330 343
331 return res; 344 return res;
332} 345}
333 346
334//#include <linux/fb.h> better not rely on kernel headers in userspace ... 347//#include <linux/fb.h> better not rely on kernel headers in userspace ...
335 348
336#define FBIOBLANK OD_IO( 'F', 0x11 ) // 0x4611 349#define FBIOBLANK OD_IO( 'F', 0x11 ) // 0x4611
337 350
338/* VESA Blanking Levels */ 351/* VESA Blanking Levels */
339#define VESA_NO_BLANKING 0 352#define VESA_NO_BLANKING 0
340#define VESA_VSYNC_SUSPEND 1 353#define VESA_VSYNC_SUSPEND 1
341#define VESA_HSYNC_SUSPEND 2 354#define VESA_HSYNC_SUSPEND 2
342#define VESA_POWERDOWN 3 355#define VESA_POWERDOWN 3
343 356
344 357
345bool ODevice::setDisplayStatus ( bool on ) 358bool ODevice::setDisplayStatus ( bool on )
346{ 359{
347 if ( d-> m_model == Model_Unknown ) 360 if ( d-> m_model == Model_Unknown )
348 return false; 361 return false;
349 362
350 bool res = false; 363 bool res = false;
351 int fd; 364 int fd;
352 365
353 if (( fd = ::open ( "/dev/fb0", O_RDWR )) >= 0 ) { 366 if (( fd = ::open ( "/dev/fb0", O_RDWR )) >= 0 ) {
354 res = ( ::ioctl ( fd, FBIOBLANK, on ? VESA_NO_BLANKING : VESA_POWERDOWN ) == 0 ); 367 res = ( ::ioctl ( fd, FBIOBLANK, on ? VESA_NO_BLANKING : VESA_POWERDOWN ) == 0 );
355 ::close ( fd ); 368 ::close ( fd );
356 } 369 }
357 return res; 370 return res;
358} 371}
359 372
360bool ODevice::setDisplayBrightness ( int ) 373bool ODevice::setDisplayBrightness ( int )
361{ 374{
362 return false; 375 return false;
363} 376}
364 377
365int ODevice::displayBrightnessResolution ( ) const 378int ODevice::displayBrightnessResolution ( ) const
366{ 379{
367 return 16; 380 return 16;
368} 381}
369 382
370QString ODevice::vendorString ( ) const 383QString ODevice::vendorString ( ) const
371{ 384{
372 return d-> m_vendorstr; 385 return d-> m_vendorstr;
373} 386}
374 387
375OVendor ODevice::vendor ( ) const 388OVendor ODevice::vendor ( ) const
376{ 389{
377 return d-> m_vendor; 390 return d-> m_vendor;
378} 391}
379 392
380QString ODevice::modelString ( ) const 393QString ODevice::modelString ( ) const
381{ 394{
382 return d-> m_modelstr; 395 return d-> m_modelstr;
383} 396}
384 397
385OModel ODevice::model ( ) const 398OModel ODevice::model ( ) const
386{ 399{
387 return d-> m_model; 400 return d-> m_model;
388} 401}
389 402
390QString ODevice::systemString ( ) const 403QString ODevice::systemString ( ) const
391{ 404{
392 return d-> m_systemstr; 405 return d-> m_systemstr;
393} 406}
394 407
395OSystem ODevice::system ( ) const 408OSystem ODevice::system ( ) const
396{ 409{
397 return d-> m_system; 410 return d-> m_system;
398} 411}
399 412
400QString ODevice::systemVersionString ( ) const 413QString ODevice::systemVersionString ( ) const
401{ 414{
402 return d-> m_sysverstr; 415 return d-> m_sysverstr;
403} 416}
404 417
405Transformation ODevice::rotation ( ) const 418Transformation ODevice::rotation ( ) const
406{ 419{
407 return d-> m_rotation; 420 return d-> m_rotation;
408} 421}
409 422
410void ODevice::alarmSound ( ) 423void ODevice::alarmSound ( )
411{ 424{
412#ifndef QT_NO_SOUND 425#ifndef QT_NO_SOUND
413 static Sound snd ( "alarm" ); 426 static Sound snd ( "alarm" );
414 427
415 if ( snd. isFinished ( )) 428 if ( snd. isFinished ( ))
416 snd. play ( ); 429 snd. play ( );
417#endif 430#endif
418} 431}
419 432
420void ODevice::keySound ( ) 433void ODevice::keySound ( )
421{ 434{
422#ifndef QT_NO_SOUND 435#ifndef QT_NO_SOUND
423 static Sound snd ( "keysound" ); 436 static Sound snd ( "keysound" );
424 437
425 if ( snd. isFinished ( )) 438 if ( snd. isFinished ( ))
426 snd. play ( ); 439 snd. play ( );
427#endif 440#endif
428} 441}
429 442
430void ODevice::touchSound ( ) 443void ODevice::touchSound ( )
431{ 444{
432 445
433#ifndef QT_NO_SOUND 446#ifndef QT_NO_SOUND
434 static Sound snd ( "touchsound" ); 447 static Sound snd ( "touchsound" );
435 448
436 if ( snd. isFinished ( )) 449 if ( snd. isFinished ( ))
437 snd. play ( ); 450 snd. play ( );
438#endif 451#endif
439} 452}
440 453
441 454
442QValueList <OLed> ODevice::ledList ( ) const 455QValueList <OLed> ODevice::ledList ( ) const
443{ 456{
444 return QValueList <OLed> ( ); 457 return QValueList <OLed> ( );
445} 458}
446 459
447QValueList <OLedState> ODevice::ledStateList ( OLed /*which*/ ) const 460QValueList <OLedState> ODevice::ledStateList ( OLed /*which*/ ) const
448{ 461{
449 return QValueList <OLedState> ( ); 462 return QValueList <OLedState> ( );
450} 463}
451 464
452OLedState ODevice::ledState ( OLed /*which*/ ) const 465OLedState ODevice::ledState ( OLed /*which*/ ) const
453{ 466{
454 return Led_Off; 467 return Led_Off;
455} 468}
456 469
457bool ODevice::setLedState ( OLed /*which*/, OLedState /*st*/ ) 470bool ODevice::setLedState ( OLed /*which*/, OLedState /*st*/ )
458{ 471{
459 return false; 472 return false;
460} 473}
461 474
462bool ODevice::hasLightSensor ( ) const 475bool ODevice::hasLightSensor ( ) const
463{ 476{
464 return false; 477 return false;
465} 478}
466 479
467int ODevice::readLightSensor ( ) 480int ODevice::readLightSensor ( )
468{ 481{
469 return -1; 482 return -1;
470} 483}
471 484
472int ODevice::lightSensorResolution ( ) const 485int ODevice::lightSensorResolution ( ) const
473{ 486{
474 return 0; 487 return 0;
475} 488}
476 489
477const QValueList <ODeviceButton> &ODevice::buttons ( ) const 490const QValueList <ODeviceButton> &ODevice::buttons ( )
478{ 491{
479 return d-> m_buttons; 492 initButtons ( );
493
494 return *d-> m_buttons;
480} 495}
481 496
482uint ODevice::buttonHoldTime ( ) const 497uint ODevice::buttonHoldTime ( ) const
483{ 498{
484 return d-> m_holdtime; 499 return d-> m_holdtime;
485} 500}
486 501
487const ODeviceButton *ODevice::buttonForKeycode ( ushort code ) 502const ODeviceButton *ODevice::buttonForKeycode ( ushort code )
488{ 503{
489 for ( QValueListConstIterator<ODeviceButton> it = d-> m_buttons. begin ( ); it != d-> m_buttons. end ( ); ++it ) { 504 initButtons ( );
505
506 for ( QValueListConstIterator<ODeviceButton> it = d-> m_buttons-> begin ( ); it != d-> m_buttons-> end ( ); ++it ) {
490 if ( (*it). keycode ( ) == code ) 507 if ( (*it). keycode ( ) == code )
491 return &(*it); 508 return &(*it);
492 } 509 }
493 return 0; 510 return 0;
494} 511}
495 512
496void ODevice::reloadButtonMapping ( ) 513void ODevice::reloadButtonMapping ( )
497{ 514{
515 initButtons ( );
516
498 Config cfg ( "ButtonSettings" ); 517 Config cfg ( "ButtonSettings" );
499 518
500 for ( uint i = 0; i < d-> m_buttons. count ( ); i++ ) { 519 for ( uint i = 0; i < d-> m_buttons-> count ( ); i++ ) {
501 ODeviceButton &b = d-> m_buttons [i]; 520 ODeviceButton &b = ( *d-> m_buttons ) [i];
502 QString group = "Button" + QString::number ( i ); 521 QString group = "Button" + QString::number ( i );
503 522
504 QCString pch, hch; 523 QCString pch, hch;
505 QCString pm, hm; 524 QCString pm, hm;
506 QByteArray pdata, hdata; 525 QByteArray pdata, hdata;
507 526
508 if ( cfg. hasGroup ( group )) { 527 if ( cfg. hasGroup ( group )) {
509 cfg. setGroup ( group ); 528 cfg. setGroup ( group );
510 pch = cfg. readEntry ( "PressedActionChannel" ). latin1 ( ); 529 pch = cfg. readEntry ( "PressedActionChannel" ). latin1 ( );
511 pm = cfg. readEntry ( "PressedActionMessage" ). latin1 ( ); 530 pm = cfg. readEntry ( "PressedActionMessage" ). latin1 ( );
512 // pdata = decodeBase64 ( buttonFile. readEntry ( "PressedActionArgs" )); 531 // pdata = decodeBase64 ( buttonFile. readEntry ( "PressedActionArgs" ));
513 532
514 hch = cfg. readEntry ( "HeldActionChannel" ). latin1 ( ); 533 hch = cfg. readEntry ( "HeldActionChannel" ). latin1 ( );
515 hm = cfg. readEntry ( "HeldActionMessage" ). latin1 ( ); 534 hm = cfg. readEntry ( "HeldActionMessage" ). latin1 ( );
516 // hdata = decodeBase64 ( buttonFile. readEntry ( "HeldActionArgs" )); 535 // hdata = decodeBase64 ( buttonFile. readEntry ( "HeldActionArgs" ));
517 } 536 }
518 537
519 b. setPressedAction ( OQCopMessage ( pch, pm, pdata )); 538 b. setPressedAction ( OQCopMessage ( pch, pm, pdata ));
520 539
521 b. setHeldAction ( OQCopMessage ( hch, hm, hdata )); 540 b. setHeldAction ( OQCopMessage ( hch, hm, hdata ));
522 } 541 }
523} 542}
524 543
525void ODevice::remapPressedAction ( int button, const OQCopMessage &action ) 544void ODevice::remapPressedAction ( int button, const OQCopMessage &action )
526{ 545{
546 initButtons ( );
547
527 QString mb_chan; 548 QString mb_chan;
528 549
529 if ( button >= (int) d-> m_buttons. count ( )) 550 if ( button >= (int) d-> m_buttons-> count ( ))
530 return; 551 return;
531
532 552
533 ODeviceButton &b = d-> m_buttons [button]; 553 ODeviceButton &b = ( *d-> m_buttons ) [button];
534 b. setPressedAction ( action ); 554 b. setPressedAction ( action );
535 555
536 mb_chan=b. pressedAction ( ). channel ( ); 556 mb_chan=b. pressedAction ( ). channel ( );
537 557
538 Config buttonFile ( "ButtonSettings" ); 558 Config buttonFile ( "ButtonSettings" );
539 buttonFile. setGroup ( "Button" + QString::number ( button )); 559 buttonFile. setGroup ( "Button" + QString::number ( button ));
540 buttonFile. writeEntry ( "PressedActionChannel", (const char*) mb_chan); 560 buttonFile. writeEntry ( "PressedActionChannel", (const char*) mb_chan);
541 buttonFile. writeEntry ( "PressedActionMessage", (const char*) b. pressedAction ( ). message ( )); 561 buttonFile. writeEntry ( "PressedActionMessage", (const char*) b. pressedAction ( ). message ( ));
542 562
543 //buttonFile. writeEntry ( "PressedActionArgs", encodeBase64 ( b. pressedAction ( ). data ( ))); 563 //buttonFile. writeEntry ( "PressedActionArgs", encodeBase64 ( b. pressedAction ( ). data ( )));
544 564
545 QCopEnvelope ( "QPE/System", "deviceButtonMappingChanged()" ); 565 QCopEnvelope ( "QPE/System", "deviceButtonMappingChanged()" );
546} 566}
547 567
548void ODevice::remapHeldAction ( int button, const OQCopMessage &action ) 568void ODevice::remapHeldAction ( int button, const OQCopMessage &action )
549{ 569{
550 if ( button >= (int) d-> m_buttons. count ( )) 570 initButtons ( );
571
572 if ( button >= (int) d-> m_buttons-> count ( ))
551 return; 573 return;
552 574
553 ODeviceButton &b = d-> m_buttons [button]; 575 ODeviceButton &b = ( *d-> m_buttons ) [button];
554 b. setHeldAction ( action ); 576 b. setHeldAction ( action );
555 577
556 Config buttonFile ( "ButtonSettings" ); 578 Config buttonFile ( "ButtonSettings" );
557 buttonFile. setGroup ( "Button" + QString::number ( button )); 579 buttonFile. setGroup ( "Button" + QString::number ( button ));
558 buttonFile. writeEntry ( "HeldActionChannel", (const char *) b. heldAction ( ). channel ( )); 580 buttonFile. writeEntry ( "HeldActionChannel", (const char *) b. heldAction ( ). channel ( ));
559 buttonFile. writeEntry ( "HeldActionMessage", (const char *) b. heldAction ( ). message ( )); 581 buttonFile. writeEntry ( "HeldActionMessage", (const char *) b. heldAction ( ). message ( ));
560 582
561 //buttonFile. writeEntry ( "HeldActionArgs", decodeBase64 ( b. heldAction ( ). data ( ))); 583 //buttonFile. writeEntry ( "HeldActionArgs", decodeBase64 ( b. heldAction ( ). data ( )));
562 584
563 QCopEnvelope ( "QPE/System", "deviceButtonMappingChanged()" ); 585 QCopEnvelope ( "QPE/System", "deviceButtonMappingChanged()" );
564} 586}
565 587
566 588
567 589
568 590
569/************************************************** 591/**************************************************
570 * 592 *
571 * iPAQ 593 * iPAQ
572 * 594 *
573 **************************************************/ 595 **************************************************/
574 596
575void iPAQ::init ( ) 597void iPAQ::init ( )
576{ 598{
577 d-> m_vendorstr = "HP"; 599 d-> m_vendorstr = "HP";
578 d-> m_vendor = Vendor_HP; 600 d-> m_vendor = Vendor_HP;
579 601
580 QFile f ( "/proc/hal/model" ); 602 QFile f ( "/proc/hal/model" );
581 603
582 if ( f. open ( IO_ReadOnly )) { 604 if ( f. open ( IO_ReadOnly )) {
583 QTextStream ts ( &f ); 605 QTextStream ts ( &f );
584 606
585 d-> m_modelstr = "H" + ts. readLine ( ); 607 d-> m_modelstr = "H" + ts. readLine ( );
586 608
587 if ( d-> m_modelstr == "H3100" ) 609 if ( d-> m_modelstr == "H3100" )
588 d-> m_model = Model_iPAQ_H31xx; 610 d-> m_model = Model_iPAQ_H31xx;
589 else if ( d-> m_modelstr == "H3600" ) 611 else if ( d-> m_modelstr == "H3600" )
590 d-> m_model = Model_iPAQ_H36xx; 612 d-> m_model = Model_iPAQ_H36xx;
591 else if ( d-> m_modelstr == "H3700" ) 613 else if ( d-> m_modelstr == "H3700" )
592 d-> m_model = Model_iPAQ_H37xx; 614 d-> m_model = Model_iPAQ_H37xx;
593 else if ( d-> m_modelstr == "H3800" ) 615 else if ( d-> m_modelstr == "H3800" )
594 d-> m_model = Model_iPAQ_H38xx; 616 d-> m_model = Model_iPAQ_H38xx;
595 else if ( d-> m_modelstr == "H3900" ) 617 else if ( d-> m_modelstr == "H3900" )
596 d-> m_model = Model_iPAQ_H39xx; 618 d-> m_model = Model_iPAQ_H39xx;
597 else 619 else
598 d-> m_model = Model_Unknown; 620 d-> m_model = Model_Unknown;
599 621
600 f. close ( ); 622 f. close ( );
601 } 623 }
602 624
603 switch ( d-> m_model ) { 625 switch ( d-> m_model ) {
604 case Model_iPAQ_H31xx: 626 case Model_iPAQ_H31xx:
605 case Model_iPAQ_H38xx: 627 case Model_iPAQ_H38xx:
606 d-> m_rotation = Rot90; 628 d-> m_rotation = Rot90;
607 break; 629 break;
608 case Model_iPAQ_H36xx: 630 case Model_iPAQ_H36xx:
609 case Model_iPAQ_H37xx: 631 case Model_iPAQ_H37xx:
610 case Model_iPAQ_H39xx: 632 case Model_iPAQ_H39xx:
611 default: 633 default:
612 d-> m_rotation = Rot270; 634 d-> m_rotation = Rot270;
613 break; 635 break;
614 } 636 }
615 637
616 f. setName ( "/etc/familiar-version" ); 638 f. setName ( "/etc/familiar-version" );
617 if ( f. open ( IO_ReadOnly )) { 639 if ( f. open ( IO_ReadOnly )) {
618 d-> m_systemstr = "Familiar"; 640 d-> m_systemstr = "Familiar";
619 d-> m_system = System_Familiar; 641 d-> m_system = System_Familiar;
620 642
621 QTextStream ts ( &f ); 643 QTextStream ts ( &f );
622 d-> m_sysverstr = ts. readLine ( ). mid ( 10 ); 644 d-> m_sysverstr = ts. readLine ( ). mid ( 10 );
623 645
624 f. close ( ); 646 f. close ( );
625 } 647 }
626 648
627 m_leds [0] = m_leds [1] = Led_Off; 649 m_leds [0] = m_leds [1] = Led_Off;
628 650
629 m_power_timer = 0; 651 m_power_timer = 0;
630 652
653 if ( d-> m_qwsserver )
654 QWSServer::setKeyboardFilter ( this );
655}
656
657void iPAQ::initButtons ( )
658{
659 if ( d-> m_buttons )
660 return;
661
662 d-> m_buttons = new QValueList <ODeviceButton>;
663
631 for ( uint i = 0; i < ( sizeof( ipaq_buttons ) / sizeof( i_button )); i++ ) { 664 for ( uint i = 0; i < ( sizeof( ipaq_buttons ) / sizeof( i_button )); i++ ) {
632 i_button *ib = ipaq_buttons + i; 665 i_button *ib = ipaq_buttons + i;
633 ODeviceButton b; 666 ODeviceButton b;
634 667
635 if (( ib-> model & d-> m_model ) == d-> m_model ) { 668 if (( ib-> model & d-> m_model ) == d-> m_model ) {
636 b. setKeycode ( ib-> code ); 669 b. setKeycode ( ib-> code );
637 b. setUserText ( QObject::tr ( "Button", ib-> utext )); 670 b. setUserText ( QObject::tr ( "Button", ib-> utext ));
638 b. setPixmap ( Resource::loadPixmap ( ib-> pix )); 671 b. setPixmap ( Resource::loadPixmap ( ib-> pix ));
639 b. setFactoryPresetPressedAction ( OQCopMessage ( makeChannel ( ib-> fpressedservice ), ib-> fpressedaction )); 672 b. setFactoryPresetPressedAction ( OQCopMessage ( makeChannel ( ib-> fpressedservice ), ib-> fpressedaction ));
640 b. setFactoryPresetHeldAction ( OQCopMessage ( makeChannel ( ib-> fheldservice ), ib-> fheldaction )); 673 b. setFactoryPresetHeldAction ( OQCopMessage ( makeChannel ( ib-> fheldservice ), ib-> fheldaction ));
641 674
642 d-> m_buttons. append ( b ); 675 d-> m_buttons-> append ( b );
643 } 676 }
644 } 677 }
645 reloadButtonMapping ( ); 678 reloadButtonMapping ( );
646 679
647 if ( d-> m_qwsserver ) 680 QCopChannel *sysch = new QCopChannel ( "QPE/System", this );
648 QWSServer::setKeyboardFilter ( this ); 681 connect ( sysch, SIGNAL( received( const QCString &, const QByteArray & )), this, SLOT( systemMessage ( const QCString &, const QByteArray & )));
649} 682}
650 683
684
651//#include <linux/h3600_ts.h> // including kernel headers is evil ... 685//#include <linux/h3600_ts.h> // including kernel headers is evil ...
652 686
653typedef struct { 687typedef struct {
654 unsigned char OffOnBlink; /* 0=off 1=on 2=Blink */ 688 unsigned char OffOnBlink; /* 0=off 1=on 2=Blink */
655 unsigned char TotalTime; /* Units of 5 seconds */ 689 unsigned char TotalTime; /* Units of 5 seconds */
656 unsigned char OnTime; /* units of 100m/s */ 690 unsigned char OnTime; /* units of 100m/s */
657 unsigned char OffTime; /* units of 100m/s */ 691 unsigned char OffTime; /* units of 100m/s */
658} LED_IN; 692} LED_IN;
659 693
660typedef struct { 694typedef struct {
661 unsigned char mode; 695 unsigned char mode;
662 unsigned char pwr; 696 unsigned char pwr;
663 unsigned char brightness; 697 unsigned char brightness;
664} FLITE_IN; 698} FLITE_IN;
665 699
666#define LED_ON OD_IOW( 'f', 5, LED_IN ) 700#define LED_ON OD_IOW( 'f', 5, LED_IN )
667#define FLITE_ON OD_IOW( 'f', 7, FLITE_IN ) 701#define FLITE_ON OD_IOW( 'f', 7, FLITE_IN )
668 702
669 703
670QValueList <OLed> iPAQ::ledList ( ) const 704QValueList <OLed> iPAQ::ledList ( ) const
671{ 705{
672 QValueList <OLed> vl; 706 QValueList <OLed> vl;
673 vl << Led_Power; 707 vl << Led_Power;
674 708
675 if ( d-> m_model == Model_iPAQ_H38xx ) 709 if ( d-> m_model == Model_iPAQ_H38xx )
676 vl << Led_BlueTooth; 710 vl << Led_BlueTooth;
677 return vl; 711 return vl;
678} 712}
679 713
680QValueList <OLedState> iPAQ::ledStateList ( OLed l ) const 714QValueList <OLedState> iPAQ::ledStateList ( OLed l ) const
681{ 715{
682 QValueList <OLedState> vl; 716 QValueList <OLedState> vl;
683 717
684 if ( l == Led_Power ) 718 if ( l == Led_Power )
685 vl << Led_Off << Led_On << Led_BlinkSlow << Led_BlinkFast; 719 vl << Led_Off << Led_On << Led_BlinkSlow << Led_BlinkFast;
686 else if ( l == Led_BlueTooth && d-> m_model == Model_iPAQ_H38xx ) 720 else if ( l == Led_BlueTooth && d-> m_model == Model_iPAQ_H38xx )
687 vl << Led_Off; // << Led_On << ??? 721 vl << Led_Off; // << Led_On << ???
688 722
689 return vl; 723 return vl;
690} 724}
691 725
692OLedState iPAQ::ledState ( OLed l ) const 726OLedState iPAQ::ledState ( OLed l ) const
693 { 727 {
694 switch ( l ) { 728 switch ( l ) {
695 case Led_Power: 729 case Led_Power:
696 return m_leds [0]; 730 return m_leds [0];
697 case Led_BlueTooth: 731 case Led_BlueTooth:
698 return m_leds [1]; 732 return m_leds [1];
699 default: 733 default:
700 return Led_Off; 734 return Led_Off;
701 } 735 }
702} 736}
703 737
704bool iPAQ::setLedState ( OLed l, OLedState st ) 738bool iPAQ::setLedState ( OLed l, OLedState st )
705{ 739{
706 static int fd = ::open ( "/dev/touchscreen/0", O_RDWR | O_NONBLOCK ); 740 static int fd = ::open ( "/dev/touchscreen/0", O_RDWR | O_NONBLOCK );
707 741
708 if ( l == Led_Power ) { 742 if ( l == Led_Power ) {
709 if ( fd >= 0 ) { 743 if ( fd >= 0 ) {
710 LED_IN leds; 744 LED_IN leds;
711 ::memset ( &leds, 0, sizeof( leds )); 745 ::memset ( &leds, 0, sizeof( leds ));
712 leds. TotalTime = 0; 746 leds. TotalTime = 0;
713 leds. OnTime = 0; 747 leds. OnTime = 0;
714 leds. OffTime = 1; 748 leds. OffTime = 1;
715 leds. OffOnBlink = 2; 749 leds. OffOnBlink = 2;
716 750
717 switch ( st ) { 751 switch ( st ) {
718 case Led_Off : leds. OffOnBlink = 0; break; 752 case Led_Off : leds. OffOnBlink = 0; break;
719 case Led_On : leds. OffOnBlink = 1; break; 753 case Led_On : leds. OffOnBlink = 1; break;
720 case Led_BlinkSlow: leds. OnTime = 10; leds. OffTime = 10; break; 754 case Led_BlinkSlow: leds. OnTime = 10; leds. OffTime = 10; break;
721 case Led_BlinkFast: leds. OnTime = 5; leds. OffTime = 5; break; 755 case Led_BlinkFast: leds. OnTime = 5; leds. OffTime = 5; break;
722 } 756 }
723 757
724 if ( ::ioctl ( fd, LED_ON, &leds ) >= 0 ) { 758 if ( ::ioctl ( fd, LED_ON, &leds ) >= 0 ) {
725 m_leds [0] = st; 759 m_leds [0] = st;
726 return true; 760 return true;
727 } 761 }
728 } 762 }
729 } 763 }
730 return false; 764 return false;
731} 765}
732 766
733 767
734bool iPAQ::filter ( int /*unicode*/, int keycode, int modifiers, bool isPress, bool autoRepeat ) 768bool iPAQ::filter ( int /*unicode*/, int keycode, int modifiers, bool isPress, bool autoRepeat )
735{ 769{
736 int newkeycode = keycode; 770 int newkeycode = keycode;
737 771
738 switch ( keycode ) { 772 switch ( keycode ) {
739 // H38xx/H39xx have no "Q" key anymore - this is now the Mail key 773 // H38xx/H39xx have no "Q" key anymore - this is now the Mail key
740 case HardKey_Menu: { 774 case HardKey_Menu: {
741 if (( d-> m_model == Model_iPAQ_H38xx ) || 775 if (( d-> m_model == Model_iPAQ_H38xx ) ||
742 ( d-> m_model == Model_iPAQ_H39xx )) { 776 ( d-> m_model == Model_iPAQ_H39xx )) {
743 newkeycode = HardKey_Mail; 777 newkeycode = HardKey_Mail;
744 } 778 }
745 break; 779 break;
746 } 780 }
747 781
748 // Rotate cursor keys 180° 782 // Rotate cursor keys 180°
749 case Key_Left : 783 case Key_Left :
750 case Key_Right: 784 case Key_Right:
751 case Key_Up : 785 case Key_Up :
752 case Key_Down : { 786 case Key_Down : {
753 if (( d-> m_model == Model_iPAQ_H31xx ) || 787 if (( d-> m_model == Model_iPAQ_H31xx ) ||
754 ( d-> m_model == Model_iPAQ_H38xx )) { 788 ( d-> m_model == Model_iPAQ_H38xx )) {
755 newkeycode = Key_Left + ( keycode - Key_Left + 2 ) % 4; 789 newkeycode = Key_Left + ( keycode - Key_Left + 2 ) % 4;
756 } 790 }
757 break; 791 break;
758 } 792 }
759 793
760 // map Power Button short/long press to F34/F35 794 // map Power Button short/long press to F34/F35
761 case Key_SysReq: { 795 case Key_SysReq: {
762 if ( isPress ) { 796 if ( isPress ) {
763 if ( m_power_timer ) 797 if ( m_power_timer )
764 killTimer ( m_power_timer ); 798 killTimer ( m_power_timer );
765 m_power_timer = startTimer ( 500 ); 799 m_power_timer = startTimer ( 500 );
766 } 800 }
767 else if ( m_power_timer ) { 801 else if ( m_power_timer ) {
768 killTimer ( m_power_timer ); 802 killTimer ( m_power_timer );
769 m_power_timer = 0; 803 m_power_timer = 0;
770 QWSServer::sendKeyEvent ( -1, HardKey_Suspend, 0, true, false ); 804 QWSServer::sendKeyEvent ( -1, HardKey_Suspend, 0, true, false );
771 QWSServer::sendKeyEvent ( -1, HardKey_Suspend, 0, false, false ); 805 QWSServer::sendKeyEvent ( -1, HardKey_Suspend, 0, false, false );
772 } 806 }
773 newkeycode = Key_unknown; 807 newkeycode = Key_unknown;
774 break; 808 break;
775 } 809 }
776 } 810 }
777 811
778 if ( newkeycode != keycode ) { 812 if ( newkeycode != keycode ) {
779 if ( newkeycode != Key_unknown ) 813 if ( newkeycode != Key_unknown )
780 QWSServer::sendKeyEvent ( -1, newkeycode, modifiers, isPress, autoRepeat ); 814 QWSServer::sendKeyEvent ( -1, newkeycode, modifiers, isPress, autoRepeat );
781 return true; 815 return true;
782 } 816 }
783 else 817 else
784 return false; 818 return false;
785} 819}
786 820
787void iPAQ::timerEvent ( QTimerEvent * ) 821void iPAQ::timerEvent ( QTimerEvent * )
788{ 822{
789 killTimer ( m_power_timer ); 823 killTimer ( m_power_timer );
790 m_power_timer = 0; 824 m_power_timer = 0;
791 QWSServer::sendKeyEvent ( -1, HardKey_Backlight, 0, true, false ); 825 QWSServer::sendKeyEvent ( -1, HardKey_Backlight, 0, true, false );
792 QWSServer::sendKeyEvent ( -1, HardKey_Backlight, 0, false, false ); 826 QWSServer::sendKeyEvent ( -1, HardKey_Backlight, 0, false, false );
793} 827}
794 828
795 829
796void iPAQ::alarmSound ( ) 830void iPAQ::alarmSound ( )
797{ 831{
798#ifndef QT_NO_SOUND 832#ifndef QT_NO_SOUND
799 static Sound snd ( "alarm" ); 833 static Sound snd ( "alarm" );
800 int fd; 834 int fd;
801 int vol; 835 int vol;
802 bool vol_reset = false; 836 bool vol_reset = false;
803 837
804 if (( fd = ::open ( "/dev/sound/mixer", O_RDWR )) >= 0 ) { 838 if (( fd = ::open ( "/dev/sound/mixer", O_RDWR )) >= 0 ) {
805 if ( ::ioctl ( fd, MIXER_READ( 0 ), &vol ) >= 0 ) { 839 if ( ::ioctl ( fd, MIXER_READ( 0 ), &vol ) >= 0 ) {
806 Config cfg ( "qpe" ); 840 Config cfg ( "qpe" );
807 cfg. setGroup ( "Volume" ); 841 cfg. setGroup ( "Volume" );
808 842
809 int volalarm = cfg. readNumEntry ( "AlarmPercent", 50 ); 843 int volalarm = cfg. readNumEntry ( "AlarmPercent", 50 );
810 if ( volalarm < 0 ) 844 if ( volalarm < 0 )
811 volalarm = 0; 845 volalarm = 0;
812 else if ( volalarm > 100 ) 846 else if ( volalarm > 100 )
813 volalarm = 100; 847 volalarm = 100;
814 volalarm |= ( volalarm << 8 ); 848 volalarm |= ( volalarm << 8 );
815 849
816 if ( ::ioctl ( fd, MIXER_WRITE( 0 ), &volalarm ) >= 0 ) 850 if ( ::ioctl ( fd, MIXER_WRITE( 0 ), &volalarm ) >= 0 )
817 vol_reset = true; 851 vol_reset = true;
818 } 852 }
819 } 853 }
820 854
821 snd. play ( ); 855 snd. play ( );
822 while ( !snd. isFinished ( )) 856 while ( !snd. isFinished ( ))
823 qApp-> processEvents ( ); 857 qApp-> processEvents ( );
824 858
825 if ( fd >= 0 ) { 859 if ( fd >= 0 ) {
826 if ( vol_reset ) 860 if ( vol_reset )
827 ::ioctl ( fd, MIXER_WRITE( 0 ), &vol ); 861 ::ioctl ( fd, MIXER_WRITE( 0 ), &vol );
828 ::close ( fd ); 862 ::close ( fd );
829 } 863 }
830#endif 864#endif
831} 865}
832 866
833 867
834bool iPAQ::setSoftSuspend ( bool soft ) 868bool iPAQ::setSoftSuspend ( bool soft )
835{ 869{
836 bool res = false; 870 bool res = false;
837 int fd; 871 int fd;
838 872
839 if (( fd = ::open ( "/proc/sys/ts/suspend_button_mode", O_WRONLY )) >= 0 ) { 873 if (( fd = ::open ( "/proc/sys/ts/suspend_button_mode", O_WRONLY )) >= 0 ) {
840 if ( ::write ( fd, soft ? "1" : "0", 1 ) == 1 ) 874 if ( ::write ( fd, soft ? "1" : "0", 1 ) == 1 )
841 res = true; 875 res = true;
842 else 876 else
843 ::perror ( "write to /proc/sys/ts/suspend_button_mode" ); 877 ::perror ( "write to /proc/sys/ts/suspend_button_mode" );
844 878
845 ::close ( fd ); 879 ::close ( fd );
846 } 880 }
847 else 881 else
848 ::perror ( "/proc/sys/ts/suspend_button_mode" ); 882 ::perror ( "/proc/sys/ts/suspend_button_mode" );
849 883
850 return res; 884 return res;
851} 885}
852 886
853 887
854bool iPAQ::setDisplayBrightness ( int bright ) 888bool iPAQ::setDisplayBrightness ( int bright )
855{ 889{
856 bool res = false; 890 bool res = false;
857 int fd; 891 int fd;
858 892
859 if ( bright > 255 ) 893 if ( bright > 255 )
860 bright = 255; 894 bright = 255;
861 if ( bright < 0 ) 895 if ( bright < 0 )
862 bright = 0; 896 bright = 0;
863 897
864 if (( fd = ::open ( "/dev/touchscreen/0", O_WRONLY )) >= 0 ) { 898 if (( fd = ::open ( "/dev/touchscreen/0", O_WRONLY )) >= 0 ) {
865 FLITE_IN bl; 899 FLITE_IN bl;
866 bl. mode = 1; 900 bl. mode = 1;
867 bl. pwr = bright ? 1 : 0; 901 bl. pwr = bright ? 1 : 0;
868 bl. brightness = ( bright * ( displayBrightnessResolution ( ) - 1 ) + 127 ) / 255; 902 bl. brightness = ( bright * ( displayBrightnessResolution ( ) - 1 ) + 127 ) / 255;
869 res = ( ::ioctl ( fd, FLITE_ON, &bl ) == 0 ); 903 res = ( ::ioctl ( fd, FLITE_ON, &bl ) == 0 );
870 ::close ( fd ); 904 ::close ( fd );
871 } 905 }
872 return res; 906 return res;
873} 907}
874 908
875int iPAQ::displayBrightnessResolution ( ) const 909int iPAQ::displayBrightnessResolution ( ) const
876{ 910{
877 switch ( model ( )) { 911 switch ( model ( )) {
878 case Model_iPAQ_H31xx: 912 case Model_iPAQ_H31xx:
879 case Model_iPAQ_H36xx: 913 case Model_iPAQ_H36xx:
880 case Model_iPAQ_H37xx: 914 case Model_iPAQ_H37xx:
881 return 128; // really 256, but >128 could damage the LCD 915 return 128; // really 256, but >128 could damage the LCD
882 916
883 case Model_iPAQ_H38xx: 917 case Model_iPAQ_H38xx:
884 case Model_iPAQ_H39xx: 918 case Model_iPAQ_H39xx:
885 return 64; 919 return 64;
886 920
887 default: 921 default:
888 return 2; 922 return 2;
889 } 923 }
890} 924}
891 925
892 926
893bool iPAQ::hasLightSensor ( ) const 927bool iPAQ::hasLightSensor ( ) const
894{ 928{
895 return true; 929 return true;
896} 930}
897 931
898int iPAQ::readLightSensor ( ) 932int iPAQ::readLightSensor ( )
899{ 933{
900 int fd; 934 int fd;
901 int val = -1; 935 int val = -1;
902 936
903 if (( fd = ::open ( "/proc/hal/light_sensor", O_RDONLY )) >= 0 ) { 937 if (( fd = ::open ( "/proc/hal/light_sensor", O_RDONLY )) >= 0 ) {
904 char buffer [8]; 938 char buffer [8];
905 939
906 if ( ::read ( fd, buffer, 5 ) == 5 ) { 940 if ( ::read ( fd, buffer, 5 ) == 5 ) {
907 char *endptr; 941 char *endptr;
908 942
909 buffer [4] = 0; 943 buffer [4] = 0;
910 val = ::strtol ( buffer + 2, &endptr, 16 ); 944 val = ::strtol ( buffer + 2, &endptr, 16 );
911 945
912 if ( *endptr != 0 ) 946 if ( *endptr != 0 )
913 val = -1; 947 val = -1;
914 } 948 }
915 ::close ( fd ); 949 ::close ( fd );
916 } 950 }
917 951
918 return val; 952 return val;
919} 953}
920 954
921int iPAQ::lightSensorResolution ( ) const 955int iPAQ::lightSensorResolution ( ) const
922{ 956{
923 return 256; 957 return 256;
924} 958}
925 959
926/************************************************** 960/**************************************************
927 * 961 *
928 * Zaurus 962 * Zaurus
929 * 963 *
930 **************************************************/ 964 **************************************************/
931 965
932 966
933 967
934void Zaurus::init ( ) 968void Zaurus::init ( )
935{ 969{
936 d-> m_vendorstr = "Sharp"; 970 d-> m_vendorstr = "Sharp";
937 d-> m_vendor = Vendor_Sharp; 971 d-> m_vendor = Vendor_Sharp;
938 972
939 QFile f ( "/proc/filesystems" ); 973 QFile f ( "/proc/filesystems" );
940 974
941 if ( f. open ( IO_ReadOnly ) && ( QTextStream ( &f ). read ( ). find ( "\tjffs2\n" ) >= 0 )) { 975 if ( f. open ( IO_ReadOnly ) && ( QTextStream ( &f ). read ( ). find ( "\tjffs2\n" ) >= 0 )) {
942 d-> m_vendorstr = "OpenZaurus Team"; 976 d-> m_vendorstr = "OpenZaurus Team";
943 d-> m_systemstr = "OpenZaurus"; 977 d-> m_systemstr = "OpenZaurus";
944 d-> m_system = System_OpenZaurus; 978 d-> m_system = System_OpenZaurus;
945 979
946 f. close ( ); 980 f. close ( );
947 981
948 f. setName ( "/etc/oz_version" ); 982 f. setName ( "/etc/oz_version" );
949 if ( f. open ( IO_ReadOnly )) { 983 if ( f. open ( IO_ReadOnly )) {
950 QTextStream ts ( &f ); 984 QTextStream ts ( &f );
951 d-> m_sysverstr = ts. readLine ( );//. mid ( 10 ); 985 d-> m_sysverstr = ts. readLine ( );//. mid ( 10 );
952 f. close ( ); 986 f. close ( );
953 } 987 }
954 } 988 }
955 else { 989 else {
956 d-> m_systemstr = "Zaurus"; 990 d-> m_systemstr = "Zaurus";
957 d-> m_system = System_Zaurus; 991 d-> m_system = System_Zaurus;
958 } 992 }
959 993
960 f. setName ( "/proc/deviceinfo/product" ); 994 f. setName ( "/proc/deviceinfo/product" );
961 if ( f. open ( IO_ReadOnly ) ) { 995 if ( f. open ( IO_ReadOnly ) ) {
962 QTextStream ts ( &f ); 996 QTextStream ts ( &f );
963 QString model = ts. readLine ( ); 997 QString model = ts. readLine ( );
964 f. close ( ); 998 f. close ( );
965 999
966 d-> m_modelstr = QString("Zaurus ") + model; 1000 d-> m_modelstr = QString("Zaurus ") + model;
967 if ( model == "SL-5500" ) 1001 if ( model == "SL-5500" )
968 d-> m_model = Model_Zaurus_SL5500; 1002 d-> m_model = Model_Zaurus_SL5500;
969 else if ( model == "SL-C700" ) 1003 else if ( model == "SL-C700" )
970 d-> m_model = Model_Zaurus_SLC700; 1004 d-> m_model = Model_Zaurus_SLC700;
971 else if ( model == "SL-A300" ) 1005 else if ( model == "SL-A300" )
972 d-> m_model = Model_Zaurus_SLA300; 1006 d-> m_model = Model_Zaurus_SLA300;
973 else if ( model == "SL-B600" || model == "SL-5600" ) 1007 else if ( model == "SL-B600" || model == "SL-5600" )
974 d-> m_model = Model_Zaurus_SLB600; 1008 d-> m_model = Model_Zaurus_SLB600;
975 else 1009 else
976 d-> m_model = Model_Zaurus_SL5000; 1010 d-> m_model = Model_Zaurus_SL5000;
977 } 1011 }
978 else { 1012 else {
979 d-> m_model = Model_Zaurus_SL5000; 1013 d-> m_model = Model_Zaurus_SL5000;
980 d-> m_modelstr = "Zaurus (model unknown)"; 1014 d-> m_modelstr = "Zaurus (model unknown)";
981 } 1015 }
982 1016
983 switch ( d-> m_model ) { 1017 switch ( d-> m_model ) {
984 case Model_Zaurus_SLC700: 1018 case Model_Zaurus_SLC700:
985 /* note for C700, we must check the display rotation 1019 /* note for C700, we must check the display rotation
986 * sensor to set an appropriate value 1020 * sensor to set an appropriate value
987 */ 1021 */
988 case Model_Zaurus_SLA300: 1022 case Model_Zaurus_SLA300:
989 case Model_Zaurus_SLB600: 1023 case Model_Zaurus_SLB600:
990 case Model_Zaurus_SL5500: 1024 case Model_Zaurus_SL5500:
991 case Model_Zaurus_SL5000: 1025 case Model_Zaurus_SL5000:
992 default: 1026 default:
993 d-> m_rotation = Rot270; 1027 d-> m_rotation = Rot270;
994 break; 1028 break;
995 } 1029 }
1030 m_leds [0] = Led_Off;
1031}
1032
1033void Zaurus::initButtons ( )
1034{
1035 if ( d-> m_buttons )
1036 return;
1037
1038 d-> m_buttons = new QValueList <ODeviceButton>;
996 1039
997 for ( uint i = 0; i < ( sizeof( z_buttons ) / sizeof( z_button )); i++ ) { 1040 for ( uint i = 0; i < ( sizeof( z_buttons ) / sizeof( z_button )); i++ ) {
998 z_button *zb = z_buttons + i; 1041 z_button *zb = z_buttons + i;
999 ODeviceButton b; 1042 ODeviceButton b;
1000 1043
1001 b. setKeycode ( zb-> code ); 1044 b. setKeycode ( zb-> code );
1002 b. setUserText ( QObject::tr ( "Button", zb-> utext )); 1045 b. setUserText ( QObject::tr ( "Button", zb-> utext ));
1003 b. setPixmap ( Resource::loadPixmap ( zb-> pix )); 1046 b. setPixmap ( Resource::loadPixmap ( zb-> pix ));
1004 b. setFactoryPresetPressedAction ( OQCopMessage ( makeChannel ( zb-> fpressedservice ), zb-> fpressedaction )); 1047 b. setFactoryPresetPressedAction ( OQCopMessage ( makeChannel ( zb-> fpressedservice ), zb-> fpressedaction ));
1005 b. setFactoryPresetHeldAction ( OQCopMessage ( makeChannel ( zb-> fheldservice ), zb-> fheldaction )); 1048 b. setFactoryPresetHeldAction ( OQCopMessage ( makeChannel ( zb-> fheldservice ), zb-> fheldaction ));
1006 1049
1007 d-> m_buttons. append ( b ); 1050 d-> m_buttons-> append ( b );
1008 } 1051 }
1052
1009 reloadButtonMapping ( ); 1053 reloadButtonMapping ( );
1010 1054
1011 m_leds [0] = Led_Off; 1055 QCopChannel *sysch = new QCopChannel ( "QPE/System", this );
1056 connect ( sysch, SIGNAL( received( const QCString &, const QByteArray & )), this, SLOT( systemMessage ( const QCString &, const QByteArray & )));
1012} 1057}
1013 1058
1014#include <unistd.h> 1059#include <unistd.h>
1015#include <fcntl.h> 1060#include <fcntl.h>
1016#include <sys/ioctl.h> 1061#include <sys/ioctl.h>
1017 1062
1018//#include <asm/sharp_char.h> // including kernel headers is evil ... 1063//#include <asm/sharp_char.h> // including kernel headers is evil ...
1019 1064
1020#define SHARP_DEV_IOCTL_COMMAND_START 0x5680 1065#define SHARP_DEV_IOCTL_COMMAND_START 0x5680
1021 1066
1022 #defineSHARP_BUZZER_IOCTL_START (SHARP_DEV_IOCTL_COMMAND_START) 1067 #defineSHARP_BUZZER_IOCTL_START (SHARP_DEV_IOCTL_COMMAND_START)
1023#define SHARP_BUZZER_MAKESOUND (SHARP_BUZZER_IOCTL_START) 1068#define SHARP_BUZZER_MAKESOUND (SHARP_BUZZER_IOCTL_START)
1024 1069
1025#define SHARP_BUZ_TOUCHSOUND 1 /* touch panel sound */ 1070#define SHARP_BUZ_TOUCHSOUND 1 /* touch panel sound */
1026#define SHARP_BUZ_KEYSOUND 2 /* key sound */ 1071#define SHARP_BUZ_KEYSOUND 2 /* key sound */
1027#define SHARP_BUZ_SCHEDULE_ALARM 11 /* schedule alarm */ 1072#define SHARP_BUZ_SCHEDULE_ALARM 11 /* schedule alarm */
1028 1073
1029/* --- for SHARP_BUZZER device --- */ 1074/* --- for SHARP_BUZZER device --- */
1030 1075
1031 //#defineSHARP_BUZZER_IOCTL_START (SHARP_DEV_IOCTL_COMMAND_START) 1076 //#defineSHARP_BUZZER_IOCTL_START (SHARP_DEV_IOCTL_COMMAND_START)
1032//#define SHARP_BUZZER_MAKESOUND (SHARP_BUZZER_IOCTL_START) 1077//#define SHARP_BUZZER_MAKESOUND (SHARP_BUZZER_IOCTL_START)
1033 1078
1034#define SHARP_BUZZER_SETVOLUME (SHARP_BUZZER_IOCTL_START+1) 1079#define SHARP_BUZZER_SETVOLUME (SHARP_BUZZER_IOCTL_START+1)
1035#define SHARP_BUZZER_GETVOLUME (SHARP_BUZZER_IOCTL_START+2) 1080#define SHARP_BUZZER_GETVOLUME (SHARP_BUZZER_IOCTL_START+2)
1036#define SHARP_BUZZER_ISSUPPORTED (SHARP_BUZZER_IOCTL_START+3) 1081#define SHARP_BUZZER_ISSUPPORTED (SHARP_BUZZER_IOCTL_START+3)
1037#define SHARP_BUZZER_SETMUTE (SHARP_BUZZER_IOCTL_START+4) 1082#define SHARP_BUZZER_SETMUTE (SHARP_BUZZER_IOCTL_START+4)
1038#define SHARP_BUZZER_STOPSOUND (SHARP_BUZZER_IOCTL_START+5) 1083#define SHARP_BUZZER_STOPSOUND (SHARP_BUZZER_IOCTL_START+5)
1039 1084
1040//#define SHARP_BUZ_TOUCHSOUND 1 /* touch panel sound */ 1085//#define SHARP_BUZ_TOUCHSOUND 1 /* touch panel sound */
1041//#define SHARP_BUZ_KEYSOUND 2 /* key sound */ 1086//#define SHARP_BUZ_KEYSOUND 2 /* key sound */
1042 1087
1043//#define SHARP_PDA_ILLCLICKSOUND 3 /* illegal click */ 1088//#define SHARP_PDA_ILLCLICKSOUND 3 /* illegal click */
1044//#define SHARP_PDA_WARNSOUND 4 /* warning occurred */ 1089//#define SHARP_PDA_WARNSOUND 4 /* warning occurred */
1045//#define SHARP_PDA_ERRORSOUND 5 /* error occurred */ 1090//#define SHARP_PDA_ERRORSOUND 5 /* error occurred */
1046//#define SHARP_PDA_CRITICALSOUND 6 /* critical error occurred */ 1091//#define SHARP_PDA_CRITICALSOUND 6 /* critical error occurred */
1047//#define SHARP_PDA_SYSSTARTSOUND 7 /* system start */ 1092//#define SHARP_PDA_SYSSTARTSOUND 7 /* system start */
1048//#define SHARP_PDA_SYSTEMENDSOUND 8 /* system shutdown */ 1093//#define SHARP_PDA_SYSTEMENDSOUND 8 /* system shutdown */
1049//#define SHARP_PDA_APPSTART 9 /* application start */ 1094//#define SHARP_PDA_APPSTART 9 /* application start */
1050//#define SHARP_PDA_APPQUIT 10 /* application ends */ 1095//#define SHARP_PDA_APPQUIT 10 /* application ends */
1051 1096
1052//#define SHARP_BUZ_SCHEDULE_ALARM 11 /* schedule alarm */ 1097//#define SHARP_BUZ_SCHEDULE_ALARM 11 /* schedule alarm */
1053//#define SHARP_BUZ_DAILY_ALARM 12 /* daily alarm */ 1098//#define SHARP_BUZ_DAILY_ALARM 12 /* daily alarm */
1054//#define SHARP_BUZ_GOT_PHONE_CALL 13 /* phone call sound */ 1099//#define SHARP_BUZ_GOT_PHONE_CALL 13 /* phone call sound */
1055//#define SHARP_BUZ_GOT_MAIL 14 /* mail sound */ 1100//#define SHARP_BUZ_GOT_MAIL 14 /* mail sound */
1056// 1101//
1057 1102
1058 #defineSHARP_LED_IOCTL_START (SHARP_DEV_IOCTL_COMMAND_START) 1103 #defineSHARP_LED_IOCTL_START (SHARP_DEV_IOCTL_COMMAND_START)
1059#define SHARP_LED_SETSTATUS (SHARP_LED_IOCTL_START+1) 1104#define SHARP_LED_SETSTATUS (SHARP_LED_IOCTL_START+1)
1060 1105
1061typedef struct sharp_led_status { 1106typedef struct sharp_led_status {
1062 int which; /* select which LED status is wanted. */ 1107 int which; /* select which LED status is wanted. */
1063 int status; /* set new led status if you call SHARP_LED_SETSTATUS */ 1108 int status; /* set new led status if you call SHARP_LED_SETSTATUS */
1064} sharp_led_status; 1109} sharp_led_status;
1065 1110
1066#define SHARP_LED_MAIL_EXISTS 9 /* mail status (exists or not) */ 1111#define SHARP_LED_MAIL_EXISTS 9 /* mail status (exists or not) */
1067 1112
1068#define LED_MAIL_NO_UNREAD_MAIL 0 /* for SHARP_LED_MAIL_EXISTS */ 1113#define LED_MAIL_NO_UNREAD_MAIL 0 /* for SHARP_LED_MAIL_EXISTS */
1069#define LED_MAIL_NEWMAIL_EXISTS 1 /* for SHARP_LED_MAIL_EXISTS */ 1114#define LED_MAIL_NEWMAIL_EXISTS 1 /* for SHARP_LED_MAIL_EXISTS */
1070#define LED_MAIL_UNREAD_MAIL_EX 2 /* for SHARP_LED_MAIL_EXISTS */ 1115#define LED_MAIL_UNREAD_MAIL_EX 2 /* for SHARP_LED_MAIL_EXISTS */
1071 1116
1072// #include <asm/sharp_apm.h> // including kernel headers is evil ... 1117// #include <asm/sharp_apm.h> // including kernel headers is evil ...
1073 1118
1074#define APM_IOCGEVTSRC OD_IOR( 'A', 203, int ) 1119#define APM_IOCGEVTSRC OD_IOR( 'A', 203, int )
1075#define APM_IOCSEVTSRC OD_IORW( 'A', 204, int ) 1120#define APM_IOCSEVTSRC OD_IORW( 'A', 204, int )
1076#define APM_EVT_POWER_BUTTON (1 << 0) 1121#define APM_EVT_POWER_BUTTON (1 << 0)
1077 1122
1078#define FL_IOCTL_STEP_CONTRAST 100 1123#define FL_IOCTL_STEP_CONTRAST 100
1079 1124
1080 1125
1081void Zaurus::buzzer ( int sound ) 1126void Zaurus::buzzer ( int sound )
1082{ 1127{
1083 static int fd = ::open ( "/dev/sharp_buz", O_RDWR|O_NONBLOCK ); 1128 static int fd = ::open ( "/dev/sharp_buz", O_RDWR|O_NONBLOCK );
1084 1129
1085 if ( fd >= 0 ) 1130 if ( fd >= 0 )
1086 ::ioctl ( fd, SHARP_BUZZER_MAKESOUND, sound ); 1131 ::ioctl ( fd, SHARP_BUZZER_MAKESOUND, sound );
1087} 1132}
1088 1133
1089 1134
1090void Zaurus::alarmSound ( ) 1135void Zaurus::alarmSound ( )
1091{ 1136{
1092 buzzer ( SHARP_BUZ_SCHEDULE_ALARM ); 1137 buzzer ( SHARP_BUZ_SCHEDULE_ALARM );
1093} 1138}
1094 1139
1095void Zaurus::touchSound ( ) 1140void Zaurus::touchSound ( )
1096{ 1141{
1097 buzzer ( SHARP_BUZ_TOUCHSOUND ); 1142 buzzer ( SHARP_BUZ_TOUCHSOUND );
1098} 1143}
1099 1144
1100void Zaurus::keySound ( ) 1145void Zaurus::keySound ( )
1101{ 1146{
1102 buzzer ( SHARP_BUZ_KEYSOUND ); 1147 buzzer ( SHARP_BUZ_KEYSOUND );
1103} 1148}
1104 1149
1105 1150
1106QValueList <OLed> Zaurus::ledList ( ) const 1151QValueList <OLed> Zaurus::ledList ( ) const
1107{ 1152{
1108 QValueList <OLed> vl; 1153 QValueList <OLed> vl;
1109 vl << Led_Mail; 1154 vl << Led_Mail;
1110 return vl; 1155 return vl;
1111} 1156}
1112 1157
1113QValueList <OLedState> Zaurus::ledStateList ( OLed l ) const 1158QValueList <OLedState> Zaurus::ledStateList ( OLed l ) const
1114{ 1159{
1115 QValueList <OLedState> vl; 1160 QValueList <OLedState> vl;
1116 1161
1117 if ( l == Led_Mail ) 1162 if ( l == Led_Mail )
1118 vl << Led_Off << Led_On << Led_BlinkSlow; 1163 vl << Led_Off << Led_On << Led_BlinkSlow;
1119 return vl; 1164 return vl;
1120} 1165}
1121 1166
1122OLedState Zaurus::ledState ( OLed which ) const 1167OLedState Zaurus::ledState ( OLed which ) const
1123{ 1168{
1124 if ( which == Led_Mail ) 1169 if ( which == Led_Mail )
1125 return m_leds [0]; 1170 return m_leds [0];
1126 else 1171 else
1127 return Led_Off; 1172 return Led_Off;
1128} 1173}
1129 1174
1130bool Zaurus::setLedState ( OLed which, OLedState st ) 1175bool Zaurus::setLedState ( OLed which, OLedState st )
1131{ 1176{
1132 static int fd = ::open ( "/dev/sharp_led", O_RDWR|O_NONBLOCK ); 1177 static int fd = ::open ( "/dev/sharp_led", O_RDWR|O_NONBLOCK );
1133 1178
1134 if ( which == Led_Mail ) { 1179 if ( which == Led_Mail ) {
1135 if ( fd >= 0 ) { 1180 if ( fd >= 0 ) {
1136 struct sharp_led_status leds; 1181 struct sharp_led_status leds;
1137 ::memset ( &leds, 0, sizeof( leds )); 1182 ::memset ( &leds, 0, sizeof( leds ));
1138 leds. which = SHARP_LED_MAIL_EXISTS; 1183 leds. which = SHARP_LED_MAIL_EXISTS;
1139 bool ok = true; 1184 bool ok = true;
1140 1185
1141 switch ( st ) { 1186 switch ( st ) {
1142 case Led_Off : leds. status = LED_MAIL_NO_UNREAD_MAIL; break; 1187 case Led_Off : leds. status = LED_MAIL_NO_UNREAD_MAIL; break;
1143 case Led_On : leds. status = LED_MAIL_NEWMAIL_EXISTS; break; 1188 case Led_On : leds. status = LED_MAIL_NEWMAIL_EXISTS; break;
1144 case Led_BlinkSlow: leds. status = LED_MAIL_UNREAD_MAIL_EX; break; 1189 case Led_BlinkSlow: leds. status = LED_MAIL_UNREAD_MAIL_EX; break;
1145 default : ok = false; 1190 default : ok = false;
1146 } 1191 }
1147 1192
1148 if ( ok && ( ::ioctl ( fd, SHARP_LED_SETSTATUS, &leds ) >= 0 )) { 1193 if ( ok && ( ::ioctl ( fd, SHARP_LED_SETSTATUS, &leds ) >= 0 )) {
1149 m_leds [0] = st; 1194 m_leds [0] = st;
1150 return true; 1195 return true;
1151 } 1196 }
1152 } 1197 }
1153 } 1198 }
1154 return false; 1199 return false;
1155} 1200}
1156 1201
1157bool Zaurus::setSoftSuspend ( bool soft ) 1202bool Zaurus::setSoftSuspend ( bool soft )
1158{ 1203{
1159 bool res = false; 1204 bool res = false;
1160 int fd; 1205 int fd;
1161 1206
1162 if ((( fd = ::open ( "/dev/apm_bios", O_RDWR )) >= 0 ) || 1207 if ((( fd = ::open ( "/dev/apm_bios", O_RDWR )) >= 0 ) ||
1163 (( fd = ::open ( "/dev/misc/apm_bios",O_RDWR )) >= 0 )) { 1208 (( fd = ::open ( "/dev/misc/apm_bios",O_RDWR )) >= 0 )) {
1164 1209
1165 int sources = ::ioctl ( fd, APM_IOCGEVTSRC, 0 ); // get current event sources 1210 int sources = ::ioctl ( fd, APM_IOCGEVTSRC, 0 ); // get current event sources
1166 1211
1167 if ( sources >= 0 ) { 1212 if ( sources >= 0 ) {
1168 if ( soft ) 1213 if ( soft )
1169 sources &= ~APM_EVT_POWER_BUTTON; 1214 sources &= ~APM_EVT_POWER_BUTTON;
1170 else 1215 else
1171 sources |= APM_EVT_POWER_BUTTON; 1216 sources |= APM_EVT_POWER_BUTTON;
1172 1217
1173 if ( ::ioctl ( fd, APM_IOCSEVTSRC, sources ) >= 0 ) // set new event sources 1218 if ( ::ioctl ( fd, APM_IOCSEVTSRC, sources ) >= 0 ) // set new event sources
1174 res = true; 1219 res = true;
1175 else 1220 else
1176 perror ( "APM_IOCGEVTSRC" ); 1221 perror ( "APM_IOCGEVTSRC" );
1177 } 1222 }
1178 else 1223 else
1179 perror ( "APM_IOCGEVTSRC" ); 1224 perror ( "APM_IOCGEVTSRC" );
1180 1225
1181 ::close ( fd ); 1226 ::close ( fd );
1182 } 1227 }
1183 else 1228 else
1184 perror ( "/dev/apm_bios or /dev/misc/apm_bios" ); 1229 perror ( "/dev/apm_bios or /dev/misc/apm_bios" );
1185 1230
1186 return res; 1231 return res;
1187} 1232}
1188 1233
1189 1234
1190bool Zaurus::setDisplayBrightness ( int bright ) 1235bool Zaurus::setDisplayBrightness ( int bright )
1191{ 1236{
1192 bool res = false; 1237 bool res = false;
1193 int fd; 1238 int fd;
1194 1239
1195 if ( bright > 255 ) 1240 if ( bright > 255 )
1196 bright = 255; 1241 bright = 255;
1197 if ( bright < 0 ) 1242 if ( bright < 0 )
1198 bright = 0; 1243 bright = 0;
1199 1244
1200 if (( fd = ::open ( "/dev/fl", O_WRONLY )) >= 0 ) { 1245 if (( fd = ::open ( "/dev/fl", O_WRONLY )) >= 0 ) {
1201 int bl = ( bright * 4 + 127 ) / 255; // only 4 steps on zaurus 1246 int bl = ( bright * 4 + 127 ) / 255; // only 4 steps on zaurus
1202 if ( bright && !bl ) 1247 if ( bright && !bl )
1203 bl = 1; 1248 bl = 1;
diff --git a/libopie/odevice.h b/libopie/odevice.h
index 575e1fe..ff578d8 100644
--- a/libopie/odevice.h
+++ b/libopie/odevice.h
@@ -1,198 +1,199 @@
1/* This file is part of the OPIE libraries 1/* This file is part of the OPIE libraries
2 Copyright (C) 2002 Robert Griebl (sandman@handhelds.org) 2 Copyright (C) 2002 Robert Griebl (sandman@handhelds.org)
3 3
4 This library is free software; you can redistribute it and/or 4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Library General Public 5 modify it under the terms of the GNU Library General Public
6 License as published by the Free Software Foundation; either 6 License as published by the Free Software Foundation; either
7 version 2 of the License, or (at your option) any later version. 7 version 2 of the License, or (at your option) any later version.
8 8
9 This library is distributed in the hope that it will be useful, 9 This library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of 10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Library General Public License for more details. 12 Library General Public License for more details.
13 13
14 You should have received a copy of the GNU Library General Public License 14 You should have received a copy of the GNU Library General Public License
15 along with this library; see the file COPYING.LIB. If not, write to 15 along with this library; see the file COPYING.LIB. If not, write to
16 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 16 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17 Boston, MA 02111-1307, USA. 17 Boston, MA 02111-1307, USA.
18*/ 18*/
19 19
20#ifndef _LIBOPIE_ODEVICE_H_ 20#ifndef _LIBOPIE_ODEVICE_H_
21#define _LIBOPIE_ODEVICE_H_ 21#define _LIBOPIE_ODEVICE_H_
22 22
23#include <qobject.h> 23#include <qobject.h>
24#include <qstring.h> 24#include <qstring.h>
25#include <qnamespace.h> 25#include <qnamespace.h>
26 26
27#include <opie/odevicebutton.h> 27#include <opie/odevicebutton.h>
28 28
29#include <qpe/qpeapplication.h> /* for Transformation enum.. */ 29#include <qpe/qpeapplication.h> /* for Transformation enum.. */
30 30
31class ODeviceData; 31class ODeviceData;
32 32
33namespace Opie { 33namespace Opie {
34 34
35enum OModel { 35enum OModel {
36 Model_Unknown, 36 Model_Unknown,
37 37
38 Model_Series_Mask = 0xff000000, 38 Model_Series_Mask = 0xff000000,
39 39
40 Model_iPAQ = ( 1 << 24 ), 40 Model_iPAQ = ( 1 << 24 ),
41 41
42 Model_iPAQ_All = ( Model_iPAQ | 0xffffff ), 42 Model_iPAQ_All = ( Model_iPAQ | 0xffffff ),
43 Model_iPAQ_H31xx = ( Model_iPAQ | 0x000001 ), 43 Model_iPAQ_H31xx = ( Model_iPAQ | 0x000001 ),
44 Model_iPAQ_H36xx = ( Model_iPAQ | 0x000002 ), 44 Model_iPAQ_H36xx = ( Model_iPAQ | 0x000002 ),
45 Model_iPAQ_H37xx = ( Model_iPAQ | 0x000004 ), 45 Model_iPAQ_H37xx = ( Model_iPAQ | 0x000004 ),
46 Model_iPAQ_H38xx = ( Model_iPAQ | 0x000008 ), 46 Model_iPAQ_H38xx = ( Model_iPAQ | 0x000008 ),
47 Model_iPAQ_H39xx = ( Model_iPAQ | 0x000010 ), 47 Model_iPAQ_H39xx = ( Model_iPAQ | 0x000010 ),
48 48
49 Model_Zaurus = ( 2 << 24 ), 49 Model_Zaurus = ( 2 << 24 ),
50 50
51 Model_Zaurus_SL5000 = ( Model_Zaurus | 0x000001 ), 51 Model_Zaurus_SL5000 = ( Model_Zaurus | 0x000001 ),
52 Model_Zaurus_SL5500 = ( Model_Zaurus | 0x000002 ), 52 Model_Zaurus_SL5500 = ( Model_Zaurus | 0x000002 ),
53 Model_Zaurus_SLA300 = ( Model_Zaurus | 0x000003 ), 53 Model_Zaurus_SLA300 = ( Model_Zaurus | 0x000003 ),
54 Model_Zaurus_SLB600 = ( Model_Zaurus | 0x000004 ), 54 Model_Zaurus_SLB600 = ( Model_Zaurus | 0x000004 ),
55 Model_Zaurus_SLC700 = ( Model_Zaurus | 0x000005 ), 55 Model_Zaurus_SLC700 = ( Model_Zaurus | 0x000005 ),
56}; 56};
57 57
58 enum OVendor { 58 enum OVendor {
59 Vendor_Unknown, 59 Vendor_Unknown,
60 60
61 Vendor_HP, 61 Vendor_HP,
62 Vendor_Sharp 62 Vendor_Sharp
63 }; 63 };
64 64
65enum OSystem { 65enum OSystem {
66 System_Unknown, 66 System_Unknown,
67 67
68 System_Familiar, 68 System_Familiar,
69 System_Zaurus, 69 System_Zaurus,
70 System_OpenZaurus 70 System_OpenZaurus
71}; 71};
72 72
73enum OLedState { 73enum OLedState {
74 Led_Off, 74 Led_Off,
75 Led_On, 75 Led_On,
76 Led_BlinkSlow, 76 Led_BlinkSlow,
77 Led_BlinkFast 77 Led_BlinkFast
78}; 78};
79 79
80enum OLed { 80enum OLed {
81 Led_Mail, 81 Led_Mail,
82 Led_Power, 82 Led_Power,
83 Led_BlueTooth 83 Led_BlueTooth
84}; 84};
85 85
86enum OHardKey { 86enum OHardKey {
87 HardKey_Datebook = Qt::Key_F9, 87 HardKey_Datebook = Qt::Key_F9,
88 HardKey_Contacts = Qt::Key_F10, 88 HardKey_Contacts = Qt::Key_F10,
89 HardKey_Menu = Qt::Key_F11, 89 HardKey_Menu = Qt::Key_F11,
90 HardKey_Home = Qt::Key_F12, 90 HardKey_Home = Qt::Key_F12,
91 HardKey_Mail = Qt::Key_F13, 91 HardKey_Mail = Qt::Key_F13,
92 HardKey_Record = Qt::Key_F24, 92 HardKey_Record = Qt::Key_F24,
93 HardKey_Suspend = Qt::Key_F34, 93 HardKey_Suspend = Qt::Key_F34,
94 HardKey_Backlight = Qt::Key_F35, 94 HardKey_Backlight = Qt::Key_F35,
95}; 95};
96 96
97class ODevice : public QObject { 97class ODevice : public QObject {
98 Q_OBJECT 98 Q_OBJECT
99 99
100private: 100private:
101 ODevice ( const ODevice & ); 101 ODevice ( const ODevice & );
102 102
103protected: 103protected:
104 ODevice ( ); 104 ODevice ( );
105 virtual void init ( ); 105 virtual void init ( );
106 virtual void initButtons ( );
106 107
107 ODeviceData *d; 108 ODeviceData *d;
108 109
109public: 110public:
110 virtual ~ODevice ( ); 111 virtual ~ODevice ( );
111 112
112 static ODevice *inst ( ); 113 static ODevice *inst ( );
113 114
114// information 115// information
115 116
116 QString modelString ( ) const; 117 QString modelString ( ) const;
117 OModel model ( ) const; 118 OModel model ( ) const;
118 inline OModel series ( ) const { return (OModel) ( model ( ) & Model_Series_Mask ); } 119 inline OModel series ( ) const { return (OModel) ( model ( ) & Model_Series_Mask ); }
119 120
120 QString vendorString ( ) const; 121 QString vendorString ( ) const;
121 OVendor vendor ( ) const; 122 OVendor vendor ( ) const;
122 123
123 QString systemString ( ) const; 124 QString systemString ( ) const;
124 OSystem system ( ) const; 125 OSystem system ( ) const;
125 126
126 QString systemVersionString ( ) const; 127 QString systemVersionString ( ) const;
127 128
128 Transformation rotation ( ) const; 129 Transformation rotation ( ) const;
129 130
130 // system 131 // system
131 132
132 virtual bool setSoftSuspend ( bool on ); 133 virtual bool setSoftSuspend ( bool on );
133 virtual bool suspend ( ); 134 virtual bool suspend ( );
134 135
135 virtual bool setDisplayStatus ( bool on ); 136 virtual bool setDisplayStatus ( bool on );
136 virtual bool setDisplayBrightness ( int brightness ); 137 virtual bool setDisplayBrightness ( int brightness );
137 virtual int displayBrightnessResolution ( ) const; 138 virtual int displayBrightnessResolution ( ) const;
138 139
139// input / output 140// input / output
140 141
141 virtual void alarmSound ( ); 142 virtual void alarmSound ( );
142 virtual void keySound ( ); 143 virtual void keySound ( );
143 virtual void touchSound ( ); 144 virtual void touchSound ( );
144 145
145 virtual QValueList <OLed> ledList ( ) const; 146 virtual QValueList <OLed> ledList ( ) const;
146 virtual QValueList <OLedState> ledStateList ( OLed led ) const; 147 virtual QValueList <OLedState> ledStateList ( OLed led ) const;
147 virtual OLedState ledState ( OLed led ) const; 148 virtual OLedState ledState ( OLed led ) const;
148 virtual bool setLedState ( OLed led, OLedState st ); 149 virtual bool setLedState ( OLed led, OLedState st );
149 150
150 virtual bool hasLightSensor ( ) const; 151 virtual bool hasLightSensor ( ) const;
151 virtual int readLightSensor ( ); 152 virtual int readLightSensor ( );
152 virtual int lightSensorResolution ( ) const; 153 virtual int lightSensorResolution ( ) const;
153 154
154 /** 155 /**
155 * Returns the available buttons on this device. The number and location 156 * Returns the available buttons on this device. The number and location
156 * of buttons will vary depending on the device. Button numbers will be assigned 157 * of buttons will vary depending on the device. Button numbers will be assigned
157 * by the device manufacturer and will be from most preferred button to least preffered 158 * by the device manufacturer and will be from most preferred button to least preffered
158 * button. Note that this list only contains "user mappable" buttons. 159 * button. Note that this list only contains "user mappable" buttons.
159 */ 160 */
160 const QValueList<ODeviceButton> &buttons ( ) const; 161 const QValueList<ODeviceButton> &buttons ( );
161 162
162 /** 163 /**
163 * Returns the DeviceButton for the \a keyCode. If \a keyCode is not found, it 164 * Returns the DeviceButton for the \a keyCode. If \a keyCode is not found, it
164 * returns 0L 165 * returns 0L
165 */ 166 */
166 const ODeviceButton *buttonForKeycode ( ushort keyCode ); 167 const ODeviceButton *buttonForKeycode ( ushort keyCode );
167 168
168 /** 169 /**
169 * Reassigns the pressed action for \a button. To return to the factory 170 * Reassigns the pressed action for \a button. To return to the factory
170 * default pass an empty string as \a qcopMessage. 171 * default pass an empty string as \a qcopMessage.
171 */ 172 */
172 void remapPressedAction ( int button, const OQCopMessage &qcopMessage ); 173 void remapPressedAction ( int button, const OQCopMessage &qcopMessage );
173 174
174 /** 175 /**
175 * Reassigns the held action for \a button. To return to the factory 176 * Reassigns the held action for \a button. To return to the factory
176 * default pass an empty string as \a qcopMessage. 177 * default pass an empty string as \a qcopMessage.
177 */ 178 */
178 void remapHeldAction ( int button, const OQCopMessage &qcopMessage ); 179 void remapHeldAction ( int button, const OQCopMessage &qcopMessage );
179 180
180 /** 181 /**
181 * How long (in ms) you have to press a button for a "hold" action 182 * How long (in ms) you have to press a button for a "hold" action
182 */ 183 */
183 uint buttonHoldTime ( ) const; 184 uint buttonHoldTime ( ) const;
184 185
185 signals: 186 signals:
186 void buttonMappingChanged ( ); 187 void buttonMappingChanged ( );
187 188
188 private slots: 189 private slots:
189 void systemMessage ( const QCString &, const QByteArray & ); 190 void systemMessage ( const QCString &, const QByteArray & );
190 191
191protected: 192protected:
192 void reloadButtonMapping ( ); 193 void reloadButtonMapping ( );
193}; 194};
194 195
195} 196}
196 197
197#endif 198#endif
198 199