summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opiecore/device/odevice.cpp8
-rw-r--r--libopie2/opiecore/device/odevice.h12
-rw-r--r--libopie2/opiecore/device/odevice_ipaq.cpp2
-rw-r--r--libopie2/opiecore/device/odevice_ipaq.h2
-rw-r--r--libopie2/opiecore/device/odevice_simpad.cpp2
-rw-r--r--libopie2/opiecore/device/odevice_simpad.h2
-rw-r--r--libopie2/opiecore/device/odevice_zaurus.cpp6
-rw-r--r--libopie2/opiecore/device/odevice_zaurus.h6
8 files changed, 21 insertions, 19 deletions
diff --git a/libopie2/opiecore/device/odevice.cpp b/libopie2/opiecore/device/odevice.cpp
index 6c8432f..72b9ac7 100644
--- a/libopie2/opiecore/device/odevice.cpp
+++ b/libopie2/opiecore/device/odevice.cpp
@@ -261,221 +261,221 @@ int ODevice::displayBrightnessResolution() const
261/** 261/**
262* This sets the display contrast 262* This sets the display contrast
263* @param p The contrast to be set on a scale from 0 to 255 263* @param p The contrast to be set on a scale from 0 to 255
264* @return success or failure 264* @return success or failure
265*/ 265*/
266bool ODevice::setDisplayContrast ( int p) 266bool ODevice::setDisplayContrast ( int p)
267{ 267{
268 Q_UNUSED( p ) 268 Q_UNUSED( p )
269 return false; 269 return false;
270} 270}
271 271
272/** 272/**
273* @return return the max value for the brightness settings slider 273* @return return the max value for the brightness settings slider
274* or 0 if the device doesn't support setting of a contrast 274* or 0 if the device doesn't support setting of a contrast
275*/ 275*/
276int ODevice::displayContrastResolution() const 276int ODevice::displayContrastResolution() const
277{ 277{
278 return 0; 278 return 0;
279} 279}
280 280
281/** 281/**
282* This returns the vendor as string 282* This returns the vendor as string
283* @return Vendor as QString 283* @return Vendor as QString
284*/ 284*/
285QString ODevice::vendorString() const 285QString ODevice::vendorString() const
286{ 286{
287 return d->m_vendorstr; 287 return d->m_vendorstr;
288} 288}
289 289
290/** 290/**
291* This returns the vendor as one of the values of OVendor 291* This returns the vendor as one of the values of OVendor
292* @return OVendor 292* @return OVendor
293*/ 293*/
294OVendor ODevice::vendor() const 294OVendor ODevice::vendor() const
295{ 295{
296 return d->m_vendor; 296 return d->m_vendor;
297} 297}
298 298
299/** 299/**
300* This returns the model as a string 300* This returns the model as a string
301* @return A string representing the model 301* @return A string representing the model
302*/ 302*/
303QString ODevice::modelString() const 303QString ODevice::modelString() const
304{ 304{
305 return d->m_modelstr; 305 return d->m_modelstr;
306} 306}
307 307
308/** 308/**
309* This does return the OModel used 309* This does return the OModel used
310*/ 310*/
311OModel ODevice::model() const 311OModel ODevice::model() const
312{ 312{
313 return d->m_model; 313 return d->m_model;
314} 314}
315 315
316/** 316/**
317* This does return the systen name 317* This does return the systen name
318*/ 318*/
319QString ODevice::systemString() const 319QString ODevice::systemString() const
320{ 320{
321 return d->m_systemstr; 321 return d->m_systemstr;
322} 322}
323 323
324/** 324/**
325* Return System as OSystem value 325* Return System as OSystem value
326*/ 326*/
327OSystem ODevice::system() const 327OSystem ODevice::system() const
328{ 328{
329 return d->m_system; 329 return d->m_system;
330} 330}
331 331
332/** 332/**
333* @return the version string of the base system 333* @return the version string of the base system
334*/ 334*/
335QString ODevice::systemVersionString() const 335QString ODevice::systemVersionString() const
336{ 336{
337 return d->m_sysverstr; 337 return d->m_sysverstr;
338} 338}
339 339
340/** 340/**
341* @return the current Transformation 341* @return the current Transformation
342*/ 342*/
343Transformation ODevice::rotation() const 343Transformation ODevice::rotation() const
344{ 344{
345 return d->m_rotation; 345 return d->m_rotation;
346} 346}
347 347
348/** 348/**
349* @return the current rotation direction 349* @return the current rotation direction
350*/ 350*/
351ODirection ODevice::direction() const 351ODirection ODevice::direction() const
352{ 352{
353 return d->m_direction; 353 return d->m_direction;
354} 354}
355 355
356/** 356/**
357* This plays an alarmSound 357* This plays an alarm sound
358*/ 358*/
359void ODevice::alarmSound() 359void ODevice::playAlarmSound()
360{ 360{
361#ifndef QT_NO_SOUND 361#ifndef QT_NO_SOUND
362 static Sound snd ( "alarm" ); 362 static Sound snd ( "alarm" );
363 363
364 if ( snd. isFinished()) 364 if ( snd. isFinished())
365 snd. play(); 365 snd. play();
366#endif 366#endif
367} 367}
368 368
369/** 369/**
370* This plays a key sound 370* This plays a key sound
371*/ 371*/
372void ODevice::keySound() 372void ODevice::playKeySound()
373{ 373{
374#ifndef QT_NO_SOUND 374#ifndef QT_NO_SOUND
375 static Sound snd ( "keysound" ); 375 static Sound snd ( "keysound" );
376 376
377 if ( snd. isFinished()) 377 if ( snd. isFinished())
378 snd. play(); 378 snd. play();
379#endif 379#endif
380} 380}
381 381
382/** 382/**
383* This plays a touch sound 383* This plays a touch sound
384*/ 384*/
385void ODevice::touchSound() 385void ODevice::playTouchSound()
386{ 386{
387#ifndef QT_NO_SOUND 387#ifndef QT_NO_SOUND
388 static Sound snd ( "touchsound" ); 388 static Sound snd ( "touchsound" );
389 389
390 if ( snd. isFinished()) 390 if ( snd. isFinished())
391 snd. play(); 391 snd. play();
392#endif 392#endif
393} 393}
394 394
395/** 395/**
396* This method will return a list of leds 396* This method will return a list of leds
397* available on this device 397* available on this device
398* @return a list of LEDs. 398* @return a list of LEDs.
399*/ 399*/
400QValueList <OLed> ODevice::ledList() const 400QValueList <OLed> ODevice::ledList() const
401{ 401{
402 return QValueList <OLed>(); 402 return QValueList <OLed>();
403} 403}
404 404
405/** 405/**
406* This does return the state of the LEDs 406* This does return the state of the LEDs
407*/ 407*/
408QValueList <OLedState> ODevice::ledStateList ( OLed /*which*/ ) const 408QValueList <OLedState> ODevice::ledStateList ( OLed /*which*/ ) const
409{ 409{
410 return QValueList <OLedState>(); 410 return QValueList <OLedState>();
411} 411}
412 412
413/** 413/**
414* @return the state for a given OLed 414* @return the state for a given OLed
415*/ 415*/
416OLedState ODevice::ledState ( OLed /*which*/ ) const 416OLedState ODevice::ledState ( OLed /*which*/ ) const
417{ 417{
418 return Led_Off; 418 return Led_Off;
419} 419}
420 420
421/** 421/**
422* Set the state for a LED 422* Set the state for a LED
423* @param which Which OLed to use 423* @param which Which OLed to use
424* @param st The state to set 424* @param st The state to set
425* @return success or failure 425* @return success or failure
426*/ 426*/
427bool ODevice::setLedState ( OLed which, OLedState st ) 427bool ODevice::setLedState ( OLed which, OLedState st )
428{ 428{
429 Q_UNUSED( which ) 429 Q_UNUSED( which )
430 Q_UNUSED( st ) 430 Q_UNUSED( st )
431 return false; 431 return false;
432} 432}
433 433
434/** 434/**
435* @return if the device has a light sensor 435* @return if the device has a light sensor
436*/ 436*/
437bool ODevice::hasLightSensor() const 437bool ODevice::hasLightSensor() const
438{ 438{
439 return false; 439 return false;
440} 440}
441 441
442/** 442/**
443* @return a value from the light sensor 443* @return a value from the light sensor
444*/ 444*/
445int ODevice::readLightSensor() 445int ODevice::readLightSensor()
446{ 446{
447 return -1; 447 return -1;
448} 448}
449 449
450/** 450/**
451* @return the light sensor resolution 451* @return the light sensor resolution
452*/ 452*/
453int ODevice::lightSensorResolution() const 453int ODevice::lightSensorResolution() const
454{ 454{
455 return 0; 455 return 0;
456} 456}
457 457
458/** 458/**
459* @return if the device has a hinge sensor 459* @return if the device has a hinge sensor
460*/ 460*/
461bool ODevice::hasHingeSensor() const 461bool ODevice::hasHingeSensor() const
462{ 462{
463 return false; 463 return false;
464} 464}
465 465
466/** 466/**
467* @return a value from the hinge sensor 467* @return a value from the hinge sensor
468*/ 468*/
469OHingeStatus ODevice::readHingeSensor() 469OHingeStatus ODevice::readHingeSensor()
470{ 470{
471 return CASE_UNKNOWN; 471 return CASE_UNKNOWN;
472} 472}
473 473
474/** 474/**
475* @return a list with CPU frequencies supported by the hardware 475* @return a list with CPU frequencies supported by the hardware
476*/ 476*/
477const QStrList &ODevice::allowedCpuFrequencies() const 477const QStrList &ODevice::allowedCpuFrequencies() const
478{ 478{
479 return *d->m_cpu_frequencies; 479 return *d->m_cpu_frequencies;
480} 480}
481 481
diff --git a/libopie2/opiecore/device/odevice.h b/libopie2/opiecore/device/odevice.h
index 8ae7ffa..791ccb3 100644
--- a/libopie2/opiecore/device/odevice.h
+++ b/libopie2/opiecore/device/odevice.h
@@ -132,198 +132,200 @@ enum OLed {
132 Led_BlueTooth 132 Led_BlueTooth
133}; 133};
134 134
135enum OHardKey { 135enum OHardKey {
136 HardKey_Datebook = Qt::Key_F9, 136 HardKey_Datebook = Qt::Key_F9,
137 HardKey_Contacts = Qt::Key_F10, 137 HardKey_Contacts = Qt::Key_F10,
138 HardKey_Menu = Qt::Key_F11, 138 HardKey_Menu = Qt::Key_F11,
139 HardKey_Home = Qt::Key_F12, 139 HardKey_Home = Qt::Key_F12,
140 HardKey_Mail = Qt::Key_F13, 140 HardKey_Mail = Qt::Key_F13,
141 HardKey_Record = Qt::Key_F24, 141 HardKey_Record = Qt::Key_F24,
142 HardKey_Suspend = Qt::Key_F34, 142 HardKey_Suspend = Qt::Key_F34,
143 HardKey_Backlight = Qt::Key_F35, 143 HardKey_Backlight = Qt::Key_F35,
144 HardKey_Action = Qt::Key_F10, 144 HardKey_Action = Qt::Key_F10,
145 HardKey_OK = Qt::Key_F11, 145 HardKey_OK = Qt::Key_F11,
146 HardKey_End = Qt::Key_F12, 146 HardKey_End = Qt::Key_F12,
147}; 147};
148 148
149enum ODirection { 149enum ODirection {
150 CW = 0, 150 CW = 0,
151 CCW = 1, 151 CCW = 1,
152 Flip = 2, 152 Flip = 2,
153}; 153};
154 154
155enum OHingeStatus { 155enum OHingeStatus {
156 CASE_CLOSED = 3, 156 CASE_CLOSED = 3,
157 CASE_PORTRAIT = 2, 157 CASE_PORTRAIT = 2,
158 CASE_LANDSCAPE = 0, 158 CASE_LANDSCAPE = 0,
159 CASE_UNKNOWN = 1, 159 CASE_UNKNOWN = 1,
160}; 160};
161 161
162/** 162/**
163 * A singleton which gives informations about device specefic option 163 * A singleton which gives informations about device specefic option
164 * like the Hardware used, LEDs, the Base Distribution and 164 * like the Hardware used, LEDs, the Base Distribution and
165 * hardware key mappings. 165 * hardware key mappings.
166 * 166 *
167 * @short A small class for device specefic options 167 * @short A small class for device specefic options
168 * @see QObject 168 * @see QObject
169 * @author Robert Griebl 169 * @author Robert Griebl
170 * @version 1.0 170 * @version 1.0
171 */ 171 */
172class ODevice : public QObject 172class ODevice : public QObject
173{ 173{
174 Q_OBJECT 174 Q_OBJECT
175 175
176private: 176private:
177 /* disable copy */ 177 /* disable copy */
178 ODevice ( const ODevice & ); 178 ODevice ( const ODevice & );
179 179
180protected: 180protected:
181 ODevice(); 181 ODevice();
182 virtual void init(); 182 virtual void init();
183 virtual void initButtons(); 183 virtual void initButtons();
184 184
185 ODeviceData *d; 185 ODeviceData *d;
186 186
187public: 187public:
188 // sandman do we want to allow destructions? -zecke? 188 // sandman do we want to allow destructions? -zecke?
189 virtual ~ODevice(); 189 virtual ~ODevice();
190 190
191 static ODevice *inst(); 191 static ODevice *inst();
192 192
193 // information 193 // information
194 194
195 QString modelString() const; 195 QString modelString() const;
196 OModel model() const; 196 OModel model() const;
197 inline OModel series() const { return (OModel) ( model() & Model_Series_Mask ); } 197 inline OModel series() const { return (OModel) ( model() & Model_Series_Mask ); }
198 198
199 QString vendorString() const; 199 QString vendorString() const;
200 OVendor vendor() const; 200 OVendor vendor() const;
201 201
202 QString systemString() const; 202 QString systemString() const;
203 OSystem system() const; 203 OSystem system() const;
204 204
205 QString systemVersionString() const; 205 QString systemVersionString() const;
206 206
207 virtual Transformation rotation() const; 207 virtual Transformation rotation() const;
208 virtual ODirection direction() const; 208 virtual ODirection direction() const;
209 209
210 // system 210 // system
211 211
212 virtual bool setSoftSuspend ( bool on ); 212 virtual bool setSoftSuspend ( bool on );
213 virtual bool suspend(); 213 virtual bool suspend();
214 214
215 virtual bool setDisplayStatus ( bool on ); 215 virtual bool setDisplayStatus ( bool on );
216 virtual bool setDisplayBrightness ( int brightness ); 216 virtual bool setDisplayBrightness ( int brightness );
217 virtual int displayBrightnessResolution() const; 217 virtual int displayBrightnessResolution() const;
218 virtual bool setDisplayContrast ( int contrast ); 218 virtual bool setDisplayContrast ( int contrast );
219 virtual int displayContrastResolution() const; 219 virtual int displayContrastResolution() const;
220 220
221 // don't add new virtual methods, use this: 221 // don't add new virtual methods, use this:
222 ///*virtual */ void boo(int i ) { return virtual_hook(1,&i); }; 222 ///*virtual */ void boo(int i ) { return virtual_hook(1,&i); };
223 // and in your subclass do do overwrite 223 // and in your subclass do do overwrite
224 //protected virtual int virtual_hook(int, void *) 224 //protected virtual int virtual_hook(int, void *)
225 // which is defined below 225 // which is defined below
226 226
227 // input / output 227 // input / output
228 //FIXME playAlarmSound and al might be better -zecke 228 virtual void playAlarmSound();
229 virtual void alarmSound(); 229 virtual void playKeySound();
230 virtual void keySound(); 230 virtual void playTouchSound();
231 virtual void touchSound();
232 231
233 virtual QValueList <OLed> ledList() const; 232 virtual QValueList <OLed> ledList() const;
234 virtual QValueList <OLedState> ledStateList ( OLed led ) const; 233 virtual QValueList <OLedState> ledStateList ( OLed led ) const;
235 virtual OLedState ledState ( OLed led ) const; 234 virtual OLedState ledState ( OLed led ) const;
236 virtual bool setLedState ( OLed led, OLedState st ); 235 virtual bool setLedState ( OLed led, OLedState st );
237 236
238 virtual bool hasLightSensor() const; 237 virtual bool hasLightSensor() const;
239 virtual int readLightSensor(); 238 virtual int readLightSensor();
240 virtual int lightSensorResolution() const; 239 virtual int lightSensorResolution() const;
241 240
242 virtual bool hasHingeSensor() const; 241 virtual bool hasHingeSensor() const;
243 virtual OHingeStatus readHingeSensor(); 242 virtual OHingeStatus readHingeSensor();
244 243
245 const QStrList &allowedCpuFrequencies() const; 244 const QStrList &allowedCpuFrequencies() const;
246 bool setCurrentCpuFrequency(uint index); 245 bool setCurrentCpuFrequency(uint index);
247 246
248 /** 247 /**
249 * Returns the available buttons on this device. The number and location 248 * Returns the available buttons on this device. The number and location
250 * of buttons will vary depending on the device. Button numbers will be assigned 249 * of buttons will vary depending on the device. Button numbers will be assigned
251 * by the device manufacturer and will be from most preferred button to least preffered 250 * by the device manufacturer and will be from most preferred button to least preffered
252 * button. Note that this list only contains "user mappable" buttons. 251 * button. Note that this list only contains "user mappable" buttons.
252 *
253 * @todo Make method const and take care of calling initButtons or make that const too
254 *
253 */ 255 */
254 const QValueList<ODeviceButton> &buttons() /* ### make const */; 256 const QValueList<ODeviceButton> &buttons();
255 257
256 /** 258 /**
257 * Returns the DeviceButton for the \a keyCode. If \a keyCode is not found, it 259 * Returns the DeviceButton for the \a keyCode. If \a keyCode is not found, it
258 * returns 0L 260 * returns 0L
259 */ 261 */
260 const ODeviceButton *buttonForKeycode ( ushort keyCode ); 262 const ODeviceButton *buttonForKeycode ( ushort keyCode );
261 263
262 /** 264 /**
263 * Reassigns the pressed action for \a button. To return to the factory 265 * Reassigns the pressed action for \a button. To return to the factory
264 * default pass an empty string as \a qcopMessage. 266 * default pass an empty string as \a qcopMessage.
265 */ 267 */
266 void remapPressedAction ( int button, const OQCopMessage &qcopMessage ); 268 void remapPressedAction ( int button, const OQCopMessage &qcopMessage );
267 269
268 /** 270 /**
269 * Reassigns the held action for \a button. To return to the factory 271 * Reassigns the held action for \a button. To return to the factory
270 * default pass an empty string as \a qcopMessage. 272 * default pass an empty string as \a qcopMessage.
271 */ 273 */
272 void remapHeldAction ( int button, const OQCopMessage &qcopMessage ); 274 void remapHeldAction ( int button, const OQCopMessage &qcopMessage );
273 275
274 /** 276 /**
275 * How long (in ms) you have to press a button for a "hold" action 277 * How long (in ms) you have to press a button for a "hold" action
276 */ 278 */
277 uint buttonHoldTime() const; 279 uint buttonHoldTime() const;
278 280
279signals: 281signals:
280 void buttonMappingChanged(); 282 void buttonMappingChanged();
281 283
282private slots: 284private slots:
283 void systemMessage ( const QCString &, const QByteArray & ); 285 void systemMessage ( const QCString &, const QByteArray & );
284 286
285protected: 287protected:
286 void reloadButtonMapping(); 288 void reloadButtonMapping();
287 /* ugly virtual hook */ 289 /* ugly virtual hook */
288 virtual void virtual_hook( int id, void* data ); 290 virtual void virtual_hook( int id, void* data );
289}; 291};
290 292
291class ODeviceData { 293class ODeviceData {
292 294
293 public: 295 public:
294 QString m_vendorstr; 296 QString m_vendorstr;
295 OVendor m_vendor; 297 OVendor m_vendor;
296 298
297 QString m_modelstr; 299 QString m_modelstr;
298 OModel m_model; 300 OModel m_model;
299 301
300 QString m_systemstr; 302 QString m_systemstr;
301 OSystem m_system; 303 OSystem m_system;
302 304
303 QString m_sysverstr; 305 QString m_sysverstr;
304 306
305 Transformation m_rotation; 307 Transformation m_rotation;
306 ODirection m_direction; 308 ODirection m_direction;
307 309
308 QValueList <ODeviceButton> *m_buttons; 310 QValueList <ODeviceButton> *m_buttons;
309 uint m_holdtime; 311 uint m_holdtime;
310 QStrList *m_cpu_frequencies; 312 QStrList *m_cpu_frequencies;
311}; 313};
312 314
313} 315}
314 316
315static inline bool isQWS() 317static inline bool isQWS()
316{ 318{
317 return qApp ? ( qApp->type() == QApplication::GuiServer ) : false; 319 return qApp ? ( qApp->type() == QApplication::GuiServer ) : false;
318} 320}
319 321
320static QCString makeChannel ( const char *str ) 322static QCString makeChannel ( const char *str )
321{ 323{
322 if ( str && !::strchr ( str, '/' )) 324 if ( str && !::strchr ( str, '/' ))
323 return QCString ( "QPE/Application/" ) + str; 325 return QCString ( "QPE/Application/" ) + str;
324 else 326 else
325 return str; 327 return str;
326} 328}
327 329
328#endif 330#endif
329 331
diff --git a/libopie2/opiecore/device/odevice_ipaq.cpp b/libopie2/opiecore/device/odevice_ipaq.cpp
index d68bce1..d20ea4d 100644
--- a/libopie2/opiecore/device/odevice_ipaq.cpp
+++ b/libopie2/opiecore/device/odevice_ipaq.cpp
@@ -249,193 +249,193 @@ OLedState iPAQ::ledState ( OLed l ) const
249 } 249 }
250} 250}
251 251
252bool iPAQ::setLedState ( OLed l, OLedState st ) 252bool iPAQ::setLedState ( OLed l, OLedState st )
253{ 253{
254 static int fd = ::open ( "/dev/touchscreen/0", O_RDWR | O_NONBLOCK ); 254 static int fd = ::open ( "/dev/touchscreen/0", O_RDWR | O_NONBLOCK );
255 255
256 if ( l == Led_Power ) { 256 if ( l == Led_Power ) {
257 if ( fd >= 0 ) { 257 if ( fd >= 0 ) {
258 LED_IN leds; 258 LED_IN leds;
259 ::memset ( &leds, 0, sizeof( leds )); 259 ::memset ( &leds, 0, sizeof( leds ));
260 leds. TotalTime = 0; 260 leds. TotalTime = 0;
261 leds. OnTime = 0; 261 leds. OnTime = 0;
262 leds. OffTime = 1; 262 leds. OffTime = 1;
263 leds. OffOnBlink = 2; 263 leds. OffOnBlink = 2;
264 264
265 switch ( st ) { 265 switch ( st ) {
266 case Led_Off : leds. OffOnBlink = 0; break; 266 case Led_Off : leds. OffOnBlink = 0; break;
267 case Led_On : leds. OffOnBlink = 1; break; 267 case Led_On : leds. OffOnBlink = 1; break;
268 case Led_BlinkSlow: leds. OnTime = 10; leds. OffTime = 10; break; 268 case Led_BlinkSlow: leds. OnTime = 10; leds. OffTime = 10; break;
269 case Led_BlinkFast: leds. OnTime = 5; leds. OffTime = 5; break; 269 case Led_BlinkFast: leds. OnTime = 5; leds. OffTime = 5; break;
270 } 270 }
271 271
272 if ( ::ioctl ( fd, LED_ON, &leds ) >= 0 ) { 272 if ( ::ioctl ( fd, LED_ON, &leds ) >= 0 ) {
273 m_leds [0] = st; 273 m_leds [0] = st;
274 return true; 274 return true;
275 } 275 }
276 } 276 }
277 } 277 }
278 return false; 278 return false;
279} 279}
280 280
281 281
282bool iPAQ::filter ( int /*unicode*/, int keycode, int modifiers, bool isPress, bool autoRepeat ) 282bool iPAQ::filter ( int /*unicode*/, int keycode, int modifiers, bool isPress, bool autoRepeat )
283{ 283{
284 int newkeycode = keycode; 284 int newkeycode = keycode;
285 285
286 switch ( keycode ) { 286 switch ( keycode ) {
287 // H38xx/H39xx have no "Q" key anymore - this is now the Mail key 287 // H38xx/H39xx have no "Q" key anymore - this is now the Mail key
288 case HardKey_Menu: { 288 case HardKey_Menu: {
289 if (( d->m_model == Model_iPAQ_H38xx ) || 289 if (( d->m_model == Model_iPAQ_H38xx ) ||
290 ( d->m_model == Model_iPAQ_H39xx ) || 290 ( d->m_model == Model_iPAQ_H39xx ) ||
291 ( d->m_model == Model_iPAQ_H5xxx)) { 291 ( d->m_model == Model_iPAQ_H5xxx)) {
292 newkeycode = HardKey_Mail; 292 newkeycode = HardKey_Mail;
293 } 293 }
294 break; 294 break;
295 } 295 }
296 296
297 // Rotate cursor keys 180° 297 // Rotate cursor keys 180°
298 case Key_Left : 298 case Key_Left :
299 case Key_Right: 299 case Key_Right:
300 case Key_Up : 300 case Key_Up :
301 case Key_Down : { 301 case Key_Down : {
302 if (( d->m_model == Model_iPAQ_H31xx ) || 302 if (( d->m_model == Model_iPAQ_H31xx ) ||
303 ( d->m_model == Model_iPAQ_H38xx )) { 303 ( d->m_model == Model_iPAQ_H38xx )) {
304 newkeycode = Key_Left + ( keycode - Key_Left + 2 ) % 4; 304 newkeycode = Key_Left + ( keycode - Key_Left + 2 ) % 4;
305 } 305 }
306 break; 306 break;
307 } 307 }
308 308
309 // map Power Button short/long press to F34/F35 309 // map Power Button short/long press to F34/F35
310 case Key_SysReq: { 310 case Key_SysReq: {
311 if ( isPress ) { 311 if ( isPress ) {
312 if ( m_power_timer ) 312 if ( m_power_timer )
313 killTimer ( m_power_timer ); 313 killTimer ( m_power_timer );
314 m_power_timer = startTimer ( 500 ); 314 m_power_timer = startTimer ( 500 );
315 } 315 }
316 else if ( m_power_timer ) { 316 else if ( m_power_timer ) {
317 killTimer ( m_power_timer ); 317 killTimer ( m_power_timer );
318 m_power_timer = 0; 318 m_power_timer = 0;
319 QWSServer::sendKeyEvent ( -1, HardKey_Suspend, 0, true, false ); 319 QWSServer::sendKeyEvent ( -1, HardKey_Suspend, 0, true, false );
320 QWSServer::sendKeyEvent ( -1, HardKey_Suspend, 0, false, false ); 320 QWSServer::sendKeyEvent ( -1, HardKey_Suspend, 0, false, false );
321 } 321 }
322 newkeycode = Key_unknown; 322 newkeycode = Key_unknown;
323 break; 323 break;
324 } 324 }
325 } 325 }
326 326
327 if ( newkeycode != keycode ) { 327 if ( newkeycode != keycode ) {
328 if ( newkeycode != Key_unknown ) 328 if ( newkeycode != Key_unknown )
329 QWSServer::sendKeyEvent ( -1, newkeycode, modifiers, isPress, autoRepeat ); 329 QWSServer::sendKeyEvent ( -1, newkeycode, modifiers, isPress, autoRepeat );
330 return true; 330 return true;
331 } 331 }
332 else 332 else
333 return false; 333 return false;
334} 334}
335 335
336void iPAQ::timerEvent ( QTimerEvent * ) 336void iPAQ::timerEvent ( QTimerEvent * )
337{ 337{
338 killTimer ( m_power_timer ); 338 killTimer ( m_power_timer );
339 m_power_timer = 0; 339 m_power_timer = 0;
340 QWSServer::sendKeyEvent ( -1, HardKey_Backlight, 0, true, false ); 340 QWSServer::sendKeyEvent ( -1, HardKey_Backlight, 0, true, false );
341 QWSServer::sendKeyEvent ( -1, HardKey_Backlight, 0, false, false ); 341 QWSServer::sendKeyEvent ( -1, HardKey_Backlight, 0, false, false );
342} 342}
343 343
344 344
345void iPAQ::alarmSound() 345void iPAQ::playAlarmSound()
346{ 346{
347#ifndef QT_NO_SOUND 347#ifndef QT_NO_SOUND
348 static Sound snd ( "alarm" ); 348 static Sound snd ( "alarm" );
349 int fd; 349 int fd;
350 int vol; 350 int vol;
351 bool vol_reset = false; 351 bool vol_reset = false;
352 352
353 if (( fd = ::open ( "/dev/sound/mixer", O_RDWR )) >= 0 ) { 353 if (( fd = ::open ( "/dev/sound/mixer", O_RDWR )) >= 0 ) {
354 if ( ::ioctl ( fd, MIXER_READ( 0 ), &vol ) >= 0 ) { 354 if ( ::ioctl ( fd, MIXER_READ( 0 ), &vol ) >= 0 ) {
355 Config cfg ( "qpe" ); 355 Config cfg ( "qpe" );
356 cfg. setGroup ( "Volume" ); 356 cfg. setGroup ( "Volume" );
357 357
358 int volalarm = cfg. readNumEntry ( "AlarmPercent", 50 ); 358 int volalarm = cfg. readNumEntry ( "AlarmPercent", 50 );
359 if ( volalarm < 0 ) 359 if ( volalarm < 0 )
360 volalarm = 0; 360 volalarm = 0;
361 else if ( volalarm > 100 ) 361 else if ( volalarm > 100 )
362 volalarm = 100; 362 volalarm = 100;
363 volalarm |= ( volalarm << 8 ); 363 volalarm |= ( volalarm << 8 );
364 364
365 if ( ::ioctl ( fd, MIXER_WRITE( 0 ), &volalarm ) >= 0 ) 365 if ( ::ioctl ( fd, MIXER_WRITE( 0 ), &volalarm ) >= 0 )
366 vol_reset = true; 366 vol_reset = true;
367 } 367 }
368 } 368 }
369 369
370 snd. play(); 370 snd. play();
371 while ( !snd. isFinished()) 371 while ( !snd. isFinished())
372 qApp->processEvents(); 372 qApp->processEvents();
373 373
374 if ( fd >= 0 ) { 374 if ( fd >= 0 ) {
375 if ( vol_reset ) 375 if ( vol_reset )
376 ::ioctl ( fd, MIXER_WRITE( 0 ), &vol ); 376 ::ioctl ( fd, MIXER_WRITE( 0 ), &vol );
377 ::close ( fd ); 377 ::close ( fd );
378 } 378 }
379#endif 379#endif
380} 380}
381 381
382 382
383bool iPAQ::setSoftSuspend ( bool soft ) 383bool iPAQ::setSoftSuspend ( bool soft )
384{ 384{
385 bool res = false; 385 bool res = false;
386 int fd; 386 int fd;
387 387
388 if (( fd = ::open ( "/proc/sys/ts/suspend_button_mode", O_WRONLY )) >= 0 ) { 388 if (( fd = ::open ( "/proc/sys/ts/suspend_button_mode", O_WRONLY )) >= 0 ) {
389 if ( ::write ( fd, soft ? "1" : "0", 1 ) == 1 ) 389 if ( ::write ( fd, soft ? "1" : "0", 1 ) == 1 )
390 res = true; 390 res = true;
391 else 391 else
392 ::perror ( "write to /proc/sys/ts/suspend_button_mode" ); 392 ::perror ( "write to /proc/sys/ts/suspend_button_mode" );
393 393
394 ::close ( fd ); 394 ::close ( fd );
395 } 395 }
396 else 396 else
397 ::perror ( "/proc/sys/ts/suspend_button_mode" ); 397 ::perror ( "/proc/sys/ts/suspend_button_mode" );
398 398
399 return res; 399 return res;
400} 400}
401 401
402 402
403bool iPAQ::setDisplayBrightness ( int bright ) 403bool iPAQ::setDisplayBrightness ( int bright )
404{ 404{
405 bool res = false; 405 bool res = false;
406 int fd; 406 int fd;
407 407
408 if ( bright > 255 ) 408 if ( bright > 255 )
409 bright = 255; 409 bright = 255;
410 if ( bright < 0 ) 410 if ( bright < 0 )
411 bright = 0; 411 bright = 0;
412 412
413 if (( fd = ::open ( "/dev/touchscreen/0", O_WRONLY )) >= 0 ) { 413 if (( fd = ::open ( "/dev/touchscreen/0", O_WRONLY )) >= 0 ) {
414 FLITE_IN bl; 414 FLITE_IN bl;
415 bl. mode = 1; 415 bl. mode = 1;
416 bl. pwr = bright ? 1 : 0; 416 bl. pwr = bright ? 1 : 0;
417 bl. brightness = ( bright * ( displayBrightnessResolution() - 1 ) + 127 ) / 255; 417 bl. brightness = ( bright * ( displayBrightnessResolution() - 1 ) + 127 ) / 255;
418 res = ( ::ioctl ( fd, FLITE_ON, &bl ) == 0 ); 418 res = ( ::ioctl ( fd, FLITE_ON, &bl ) == 0 );
419 ::close ( fd ); 419 ::close ( fd );
420 } 420 }
421 return res; 421 return res;
422} 422}
423 423
424int iPAQ::displayBrightnessResolution() const 424int iPAQ::displayBrightnessResolution() const
425{ 425{
426 switch ( model()) { 426 switch ( model()) {
427 case Model_iPAQ_H31xx: 427 case Model_iPAQ_H31xx:
428 case Model_iPAQ_H36xx: 428 case Model_iPAQ_H36xx:
429 case Model_iPAQ_H37xx: 429 case Model_iPAQ_H37xx:
430 return 128; // really 256, but >128 could damage the LCD 430 return 128; // really 256, but >128 could damage the LCD
431 431
432 case Model_iPAQ_H38xx: 432 case Model_iPAQ_H38xx:
433 case Model_iPAQ_H39xx: 433 case Model_iPAQ_H39xx:
434 return 64; 434 return 64;
435 case Model_iPAQ_H5xxx: 435 case Model_iPAQ_H5xxx:
436 return 255; 436 return 255;
437 437
438 default: 438 default:
439 return 2; 439 return 2;
440 } 440 }
441} 441}
diff --git a/libopie2/opiecore/device/odevice_ipaq.h b/libopie2/opiecore/device/odevice_ipaq.h
index baf7215..f512344 100644
--- a/libopie2/opiecore/device/odevice_ipaq.h
+++ b/libopie2/opiecore/device/odevice_ipaq.h
@@ -1,84 +1,84 @@
1/* 1/*
2                 This file is part of the Opie Project 2                 This file is part of the Opie Project
3              Copyright (C) The Opie Team <opie-devel@handhelds.org> 3              Copyright (C) The Opie Team <opie-devel@handhelds.org>
4 =. 4 =.
5 .=l. 5 .=l.
6           .>+-= 6           .>+-=
7 _;:,     .>    :=|. This program is free software; you can 7 _;:,     .>    :=|. This program is free software; you can
8.> <`_,   >  .   <= redistribute it and/or modify it under 8.> <`_,   >  .   <= redistribute it and/or modify it under
9:`=1 )Y*s>-.--   : the terms of the GNU Library General Public 9:`=1 )Y*s>-.--   : the terms of the GNU Library General Public
10.="- .-=="i,     .._ License as published by the Free Software 10.="- .-=="i,     .._ License as published by the Free Software
11 - .   .-<_>     .<> Foundation; either version 2 of the License, 11 - .   .-<_>     .<> Foundation; either version 2 of the License,
12     ._= =}       : or (at your option) any later version. 12     ._= =}       : or (at your option) any later version.
13    .%`+i>       _;_. 13    .%`+i>       _;_.
14    .i_,=:_.      -<s. This program is distributed in the hope that 14    .i_,=:_.      -<s. This program is distributed in the hope that
15     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY; 15     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
16    : ..    .:,     . . . without even the implied warranty of 16    : ..    .:,     . . . without even the implied warranty of
17    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A 17    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
18  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU 18  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
19..}^=.=       =       ; Library General Public License for more 19..}^=.=       =       ; Library General Public License for more
20++=   -.     .`     .: details. 20++=   -.     .`     .: details.
21 :     =  ...= . :.=- 21 :     =  ...= . :.=-
22 -.   .:....=;==+<; You should have received a copy of the GNU 22 -.   .:....=;==+<; You should have received a copy of the GNU
23  -_. . .   )=.  = Library General Public License along with 23  -_. . .   )=.  = Library General Public License along with
24    --        :-=` this library; see the file COPYING.LIB. 24    --        :-=` this library; see the file COPYING.LIB.
25 If not, write to the Free Software Foundation, 25 If not, write to the Free Software Foundation,
26 Inc., 59 Temple Place - Suite 330, 26 Inc., 59 Temple Place - Suite 330,
27 Boston, MA 02111-1307, USA. 27 Boston, MA 02111-1307, USA.
28*/ 28*/
29 29
30#ifndef ODEVICE_IPAQ 30#ifndef ODEVICE_IPAQ
31#define ODEVICE_IPAQ 31#define ODEVICE_IPAQ
32 32
33#include "odevice.h" 33#include "odevice.h"
34 34
35/* QT */ 35/* QT */
36#include <qwindowsystem_qws.h> 36#include <qwindowsystem_qws.h>
37 37
38using namespace Opie; 38using namespace Opie;
39 39
40class iPAQ : public ODevice, public QWSServer::KeyboardFilter 40class iPAQ : public ODevice, public QWSServer::KeyboardFilter
41{ 41{
42 42
43 protected: 43 protected:
44 virtual void init(); 44 virtual void init();
45 virtual void initButtons(); 45 virtual void initButtons();
46 46
47 public: 47 public:
48 virtual bool setSoftSuspend( bool soft ); 48 virtual bool setSoftSuspend( bool soft );
49 49
50 virtual bool setDisplayBrightness( int b ); 50 virtual bool setDisplayBrightness( int b );
51 virtual int displayBrightnessResolution() const; 51 virtual int displayBrightnessResolution() const;
52 52
53 virtual void alarmSound(); 53 virtual void playAlarmSound();
54 54
55 virtual QValueList <OLed> ledList() const; 55 virtual QValueList <OLed> ledList() const;
56 virtual QValueList <OLedState> ledStateList( OLed led ) const; 56 virtual QValueList <OLedState> ledStateList( OLed led ) const;
57 virtual OLedState ledState( OLed led ) const; 57 virtual OLedState ledState( OLed led ) const;
58 virtual bool setLedState( OLed led, OLedState st ); 58 virtual bool setLedState( OLed led, OLedState st );
59 59
60 virtual bool hasLightSensor() const; 60 virtual bool hasLightSensor() const;
61 virtual int readLightSensor(); 61 virtual int readLightSensor();
62 virtual int lightSensorResolution() const; 62 virtual int lightSensorResolution() const;
63 63
64 protected: 64 protected:
65 virtual bool filter( int unicode, int keycode, int modifiers, bool isPress, bool autoRepeat ); 65 virtual bool filter( int unicode, int keycode, int modifiers, bool isPress, bool autoRepeat );
66 virtual void timerEvent( QTimerEvent *te ); 66 virtual void timerEvent( QTimerEvent *te );
67 67
68 int m_power_timer; 68 int m_power_timer;
69 69
70 OLedState m_leds [2]; 70 OLedState m_leds [2];
71}; 71};
72 72
73struct i_button { 73struct i_button {
74 uint model; 74 uint model;
75 Qt::Key code; 75 Qt::Key code;
76 char *utext; 76 char *utext;
77 char *pix; 77 char *pix;
78 char *fpressedservice; 78 char *fpressedservice;
79 char *fpressedaction; 79 char *fpressedaction;
80 char *fheldservice; 80 char *fheldservice;
81 char *fheldaction; 81 char *fheldaction;
82}; 82};
83 83
84#endif 84#endif
diff --git a/libopie2/opiecore/device/odevice_simpad.cpp b/libopie2/opiecore/device/odevice_simpad.cpp
index a2cd419..4397b78 100644
--- a/libopie2/opiecore/device/odevice_simpad.cpp
+++ b/libopie2/opiecore/device/odevice_simpad.cpp
@@ -188,193 +188,193 @@ void SIMpad::initButtons()
188 } 188 }
189 reloadButtonMapping(); 189 reloadButtonMapping();
190 190
191 QCopChannel *sysch = new QCopChannel ( "QPE/System", this ); 191 QCopChannel *sysch = new QCopChannel ( "QPE/System", this );
192 connect ( sysch, SIGNAL( received( const QCString &, const QByteArray & )), this, SLOT( systemMessage ( const QCString &, const QByteArray & ))); 192 connect ( sysch, SIGNAL( received( const QCString &, const QByteArray & )), this, SLOT( systemMessage ( const QCString &, const QByteArray & )));
193} 193}
194 194
195// SIMpad boardcontrol register CS3 195// SIMpad boardcontrol register CS3
196#define SIMPAD_BOARDCONTROL "/proc/cs3" 196#define SIMPAD_BOARDCONTROL "/proc/cs3"
197#define SIMPAD_VCC_5V_EN 0x0001 // For 5V PCMCIA 197#define SIMPAD_VCC_5V_EN 0x0001 // For 5V PCMCIA
198#define SIMPAD_VCC_3V_EN 0x0002 // FOR 3.3V PCMCIA 198#define SIMPAD_VCC_3V_EN 0x0002 // FOR 3.3V PCMCIA
199#define SIMPAD_EN1 0x0004 // This is only for EPROM's 199#define SIMPAD_EN1 0x0004 // This is only for EPROM's
200#define SIMPAD_EN0 0x0008 // Both should be enable for 3.3V or 5V 200#define SIMPAD_EN0 0x0008 // Both should be enable for 3.3V or 5V
201#define SIMPAD_DISPLAY_ON 0x0010 201#define SIMPAD_DISPLAY_ON 0x0010
202#define SIMPAD_PCMCIA_BUFF_DIS 0x0020 202#define SIMPAD_PCMCIA_BUFF_DIS 0x0020
203#define SIMPAD_MQ_RESET 0x0040 203#define SIMPAD_MQ_RESET 0x0040
204#define SIMPAD_PCMCIA_RESET 0x0080 204#define SIMPAD_PCMCIA_RESET 0x0080
205#define SIMPAD_DECT_POWER_ON 0x0100 205#define SIMPAD_DECT_POWER_ON 0x0100
206#define SIMPAD_IRDA_SD 0x0200 // Shutdown for powersave 206#define SIMPAD_IRDA_SD 0x0200 // Shutdown for powersave
207#define SIMPAD_RS232_ON 0x0400 207#define SIMPAD_RS232_ON 0x0400
208#define SIMPAD_SD_MEDIAQ 0x0800 // Shutdown for powersave 208#define SIMPAD_SD_MEDIAQ 0x0800 // Shutdown for powersave
209#define SIMPAD_LED2_ON 0x1000 209#define SIMPAD_LED2_ON 0x1000
210#define SIMPAD_IRDA_MODE 0x2000 // Fast/Slow IrDA mode 210#define SIMPAD_IRDA_MODE 0x2000 // Fast/Slow IrDA mode
211#define SIMPAD_ENABLE_5V 0x4000 // Enable 5V circuit 211#define SIMPAD_ENABLE_5V 0x4000 // Enable 5V circuit
212#define SIMPAD_RESET_SIMCARD 0x8000 212#define SIMPAD_RESET_SIMCARD 0x8000
213 213
214//SIMpad touchscreen backlight strength control 214//SIMpad touchscreen backlight strength control
215#define SIMPAD_BACKLIGHT_CONTROL "/proc/driver/mq200/registers/PWM_CONTROL" 215#define SIMPAD_BACKLIGHT_CONTROL "/proc/driver/mq200/registers/PWM_CONTROL"
216#define SIMPAD_BACKLIGHT_MASK 0x00a10044 216#define SIMPAD_BACKLIGHT_MASK 0x00a10044
217 217
218QValueList <OLed> SIMpad::ledList() const 218QValueList <OLed> SIMpad::ledList() const
219{ 219{
220 QValueList <OLed> vl; 220 QValueList <OLed> vl;
221 vl << Led_Power; //FIXME which LED is LED2 ? The green one or the amber one? 221 vl << Led_Power; //FIXME which LED is LED2 ? The green one or the amber one?
222 //vl << Led_Mail; //TODO find out if LED1 is accessible anyway 222 //vl << Led_Mail; //TODO find out if LED1 is accessible anyway
223 return vl; 223 return vl;
224} 224}
225 225
226QValueList <OLedState> SIMpad::ledStateList ( OLed l ) const 226QValueList <OLedState> SIMpad::ledStateList ( OLed l ) const
227{ 227{
228 QValueList <OLedState> vl; 228 QValueList <OLedState> vl;
229 229
230 if ( l == Led_Power ) //FIXME which LED is LED2 ? The green one or the amber one? 230 if ( l == Led_Power ) //FIXME which LED is LED2 ? The green one or the amber one?
231 vl << Led_Off << Led_On; 231 vl << Led_Off << Led_On;
232 //else if ( l == Led_Mail ) //TODO find out if LED1 is accessible anyway 232 //else if ( l == Led_Mail ) //TODO find out if LED1 is accessible anyway
233 //vl << Led_Off; 233 //vl << Led_Off;
234 return vl; 234 return vl;
235} 235}
236 236
237OLedState SIMpad::ledState ( OLed l ) const 237OLedState SIMpad::ledState ( OLed l ) const
238{ 238{
239 switch ( l ) { 239 switch ( l ) {
240 case Led_Power: 240 case Led_Power:
241 return m_leds [0]; 241 return m_leds [0];
242 //case Led_Mail: 242 //case Led_Mail:
243 //return m_leds [1]; 243 //return m_leds [1];
244 default: 244 default:
245 return Led_Off; 245 return Led_Off;
246 } 246 }
247} 247}
248 248
249bool SIMpad::setLedState ( OLed l, OLedState st ) 249bool SIMpad::setLedState ( OLed l, OLedState st )
250{ 250{
251#if 0 251#if 0
252 static int fd = ::open ( SIMPAD_BOARDCONTROL, O_RDWR | O_NONBLOCK ); 252 static int fd = ::open ( SIMPAD_BOARDCONTROL, O_RDWR | O_NONBLOCK );
253 253
254 /*TODO Implement this like that: 254 /*TODO Implement this like that:
255 read from cs3 255 read from cs3
256 && with SIMPAD_LED2_ON 256 && with SIMPAD_LED2_ON
257 write to cs3 */ 257 write to cs3 */
258 m_leds [0] = st; 258 m_leds [0] = st;
259 return true; 259 return true;
260 } 260 }
261 } 261 }
262 } 262 }
263 263
264#endif 264#endif
265 return false; 265 return false;
266} 266}
267 267
268 268
269bool SIMpad::filter ( int /*unicode*/, int keycode, int modifiers, bool isPress, bool autoRepeat ) 269bool SIMpad::filter ( int /*unicode*/, int keycode, int modifiers, bool isPress, bool autoRepeat )
270{ 270{
271 //TODO 271 //TODO
272 return false; 272 return false;
273} 273}
274 274
275void SIMpad::timerEvent ( QTimerEvent * ) 275void SIMpad::timerEvent ( QTimerEvent * )
276{ 276{
277 killTimer ( m_power_timer ); 277 killTimer ( m_power_timer );
278 m_power_timer = 0; 278 m_power_timer = 0;
279 QWSServer::sendKeyEvent ( -1, HardKey_Backlight, 0, true, false ); 279 QWSServer::sendKeyEvent ( -1, HardKey_Backlight, 0, true, false );
280 QWSServer::sendKeyEvent ( -1, HardKey_Backlight, 0, false, false ); 280 QWSServer::sendKeyEvent ( -1, HardKey_Backlight, 0, false, false );
281} 281}
282 282
283 283
284void SIMpad::alarmSound() 284void SIMpad::playAlarmSound()
285{ 285{
286#ifndef QT_NO_SOUND 286#ifndef QT_NO_SOUND
287 static Sound snd ( "alarm" ); 287 static Sound snd ( "alarm" );
288 int fd; 288 int fd;
289 int vol; 289 int vol;
290 bool vol_reset = false; 290 bool vol_reset = false;
291 291
292 if (( fd = ::open ( "/dev/sound/mixer", O_RDWR )) >= 0 ) { 292 if (( fd = ::open ( "/dev/sound/mixer", O_RDWR )) >= 0 ) {
293 if ( ::ioctl ( fd, MIXER_READ( 0 ), &vol ) >= 0 ) { 293 if ( ::ioctl ( fd, MIXER_READ( 0 ), &vol ) >= 0 ) {
294 Config cfg ( "qpe" ); 294 Config cfg ( "qpe" );
295 cfg. setGroup ( "Volume" ); 295 cfg. setGroup ( "Volume" );
296 296
297 int volalarm = cfg. readNumEntry ( "AlarmPercent", 50 ); 297 int volalarm = cfg. readNumEntry ( "AlarmPercent", 50 );
298 if ( volalarm < 0 ) 298 if ( volalarm < 0 )
299 volalarm = 0; 299 volalarm = 0;
300 else if ( volalarm > 100 ) 300 else if ( volalarm > 100 )
301 volalarm = 100; 301 volalarm = 100;
302 volalarm |= ( volalarm << 8 ); 302 volalarm |= ( volalarm << 8 );
303 303
304 if ( ::ioctl ( fd, MIXER_WRITE( 0 ), &volalarm ) >= 0 ) 304 if ( ::ioctl ( fd, MIXER_WRITE( 0 ), &volalarm ) >= 0 )
305 vol_reset = true; 305 vol_reset = true;
306 } 306 }
307 } 307 }
308 308
309 snd. play(); 309 snd. play();
310 while ( !snd. isFinished()) 310 while ( !snd. isFinished())
311 qApp->processEvents(); 311 qApp->processEvents();
312 312
313 if ( fd >= 0 ) { 313 if ( fd >= 0 ) {
314 if ( vol_reset ) 314 if ( vol_reset )
315 ::ioctl ( fd, MIXER_WRITE( 0 ), &vol ); 315 ::ioctl ( fd, MIXER_WRITE( 0 ), &vol );
316 ::close ( fd ); 316 ::close ( fd );
317 } 317 }
318#endif 318#endif
319} 319}
320 320
321 321
322bool SIMpad::suspend() // Must override because SIMpad does NOT have apm 322bool SIMpad::suspend() // Must override because SIMpad does NOT have apm
323{ 323{
324 qDebug( "ODevice for SIMpad: suspend()" ); 324 qDebug( "ODevice for SIMpad: suspend()" );
325 if ( !isQWS( ) ) // only qwsserver is allowed to suspend 325 if ( !isQWS( ) ) // only qwsserver is allowed to suspend
326 return false; 326 return false;
327 327
328 bool res = false; 328 bool res = false;
329 329
330 struct timeval tvs, tvn; 330 struct timeval tvs, tvn;
331 ::gettimeofday ( &tvs, 0 ); 331 ::gettimeofday ( &tvs, 0 );
332 332
333 ::sync(); // flush fs caches 333 ::sync(); // flush fs caches
334 res = ( ::system ( "cat /dev/fb/0 >/tmp/.buffer; echo > /proc/sys/pm/suspend; cat /tmp/.buffer >/dev/fb/0" ) == 0 ); //TODO make better :) 334 res = ( ::system ( "cat /dev/fb/0 >/tmp/.buffer; echo > /proc/sys/pm/suspend; cat /tmp/.buffer >/dev/fb/0" ) == 0 ); //TODO make better :)
335 335
336 return res; 336 return res;
337} 337}
338 338
339 339
340bool SIMpad::setSoftSuspend ( bool soft ) 340bool SIMpad::setSoftSuspend ( bool soft )
341{ 341{
342 qDebug( "ODevice for SIMpad: UNHANDLED setSoftSuspend(%s)", soft? "on" : "off" ); 342 qDebug( "ODevice for SIMpad: UNHANDLED setSoftSuspend(%s)", soft? "on" : "off" );
343 return false; 343 return false;
344} 344}
345 345
346 346
347bool SIMpad::setDisplayStatus ( bool on ) 347bool SIMpad::setDisplayStatus ( bool on )
348{ 348{
349 qDebug( "ODevice for SIMpad: setDisplayStatus(%s)", on? "on" : "off" ); 349 qDebug( "ODevice for SIMpad: setDisplayStatus(%s)", on? "on" : "off" );
350 350
351 bool res = false; 351 bool res = false;
352 int fd; 352 int fd;
353 353
354 QString cmdline = QString().sprintf( "echo %s > /proc/cs3", on ? "0xd41a" : "0xd40a" ); //TODO make better :) 354 QString cmdline = QString().sprintf( "echo %s > /proc/cs3", on ? "0xd41a" : "0xd40a" ); //TODO make better :)
355 355
356 res = ( ::system( (const char*) cmdline ) == 0 ); 356 res = ( ::system( (const char*) cmdline ) == 0 );
357 357
358 return res; 358 return res;
359} 359}
360 360
361 361
362bool SIMpad::setDisplayBrightness ( int bright ) 362bool SIMpad::setDisplayBrightness ( int bright )
363{ 363{
364 qDebug( "ODevice for SIMpad: setDisplayBrightness( %d )", bright ); 364 qDebug( "ODevice for SIMpad: setDisplayBrightness( %d )", bright );
365 bool res = false; 365 bool res = false;
366 int fd; 366 int fd;
367 367
368 if ( bright > 255 ) 368 if ( bright > 255 )
369 bright = 255; 369 bright = 255;
370 if ( bright < 1 ) 370 if ( bright < 1 )
371 bright = 0; 371 bright = 0;
372 372
373 if (( fd = ::open ( SIMPAD_BACKLIGHT_CONTROL, O_WRONLY )) >= 0 ) { 373 if (( fd = ::open ( SIMPAD_BACKLIGHT_CONTROL, O_WRONLY )) >= 0 ) {
374 int value = 255 - bright; 374 int value = 255 - bright;
375 const int mask = SIMPAD_BACKLIGHT_MASK; 375 const int mask = SIMPAD_BACKLIGHT_MASK;
376 value = value << 8; 376 value = value << 8;
377 value += mask; 377 value += mask;
378 char writeCommand[100]; 378 char writeCommand[100];
379 const int count = sprintf( writeCommand, "0x%x\n", value ); 379 const int count = sprintf( writeCommand, "0x%x\n", value );
380 res = ( ::write ( fd, writeCommand, count ) != -1 ); 380 res = ( ::write ( fd, writeCommand, count ) != -1 );
diff --git a/libopie2/opiecore/device/odevice_simpad.h b/libopie2/opiecore/device/odevice_simpad.h
index 615effc..3287ee8 100644
--- a/libopie2/opiecore/device/odevice_simpad.h
+++ b/libopie2/opiecore/device/odevice_simpad.h
@@ -1,81 +1,81 @@
1/* 1/*
2                 This file is part of the Opie Project 2                 This file is part of the Opie Project
3              Copyright (C) The Opie Team <opie-devel@handhelds.org> 3              Copyright (C) The Opie Team <opie-devel@handhelds.org>
4 =. 4 =.
5 .=l. 5 .=l.
6           .>+-= 6           .>+-=
7 _;:,     .>    :=|. This program is free software; you can 7 _;:,     .>    :=|. This program is free software; you can
8.> <`_,   >  .   <= redistribute it and/or modify it under 8.> <`_,   >  .   <= redistribute it and/or modify it under
9:`=1 )Y*s>-.--   : the terms of the GNU Library General Public 9:`=1 )Y*s>-.--   : the terms of the GNU Library General Public
10.="- .-=="i,     .._ License as published by the Free Software 10.="- .-=="i,     .._ License as published by the Free Software
11 - .   .-<_>     .<> Foundation; either version 2 of the License, 11 - .   .-<_>     .<> Foundation; either version 2 of the License,
12     ._= =}       : or (at your option) any later version. 12     ._= =}       : or (at your option) any later version.
13    .%`+i>       _;_. 13    .%`+i>       _;_.
14    .i_,=:_.      -<s. This program is distributed in the hope that 14    .i_,=:_.      -<s. This program is distributed in the hope that
15     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY; 15     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
16    : ..    .:,     . . . without even the implied warranty of 16    : ..    .:,     . . . without even the implied warranty of
17    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A 17    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
18  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU 18  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
19..}^=.=       =       ; Library General Public License for more 19..}^=.=       =       ; Library General Public License for more
20++=   -.     .`     .: details. 20++=   -.     .`     .: details.
21 :     =  ...= . :.=- 21 :     =  ...= . :.=-
22 -.   .:....=;==+<; You should have received a copy of the GNU 22 -.   .:....=;==+<; You should have received a copy of the GNU
23  -_. . .   )=.  = Library General Public License along with 23  -_. . .   )=.  = Library General Public License along with
24    --        :-=` this library; see the file COPYING.LIB. 24    --        :-=` this library; see the file COPYING.LIB.
25 If not, write to the Free Software Foundation, 25 If not, write to the Free Software Foundation,
26 Inc., 59 Temple Place - Suite 330, 26 Inc., 59 Temple Place - Suite 330,
27 Boston, MA 02111-1307, USA. 27 Boston, MA 02111-1307, USA.
28*/ 28*/
29 29
30#ifndef ODEVICE_SIMPAD 30#ifndef ODEVICE_SIMPAD
31#define ODEVICE_SIMPAD 31#define ODEVICE_SIMPAD
32 32
33#include <opie2/odevice.h> 33#include <opie2/odevice.h>
34 34
35/* QT */ 35/* QT */
36#include <qwindowsystem_qws.h> 36#include <qwindowsystem_qws.h>
37 37
38using namespace Opie; 38using namespace Opie;
39 39
40class SIMpad : public ODevice, public QWSServer::KeyboardFilter 40class SIMpad : public ODevice, public QWSServer::KeyboardFilter
41{ 41{
42 protected: 42 protected:
43 virtual void init(); 43 virtual void init();
44 virtual void initButtons(); 44 virtual void initButtons();
45 45
46 public: 46 public:
47 virtual bool setSoftSuspend( bool soft ); 47 virtual bool setSoftSuspend( bool soft );
48 virtual bool suspend(); 48 virtual bool suspend();
49 49
50 virtual bool setDisplayStatus( bool on ); 50 virtual bool setDisplayStatus( bool on );
51 virtual bool setDisplayBrightness( int b ); 51 virtual bool setDisplayBrightness( int b );
52 virtual int displayBrightnessResolution() const; 52 virtual int displayBrightnessResolution() const;
53 53
54 virtual void alarmSound(); 54 virtual void playAlarmSound();
55 55
56 virtual QValueList <OLed> ledList() const; 56 virtual QValueList <OLed> ledList() const;
57 virtual QValueList <OLedState> ledStateList( OLed led ) const; 57 virtual QValueList <OLedState> ledStateList( OLed led ) const;
58 virtual OLedState ledState( OLed led ) const; 58 virtual OLedState ledState( OLed led ) const;
59 virtual bool setLedState( OLed led, OLedState st ); 59 virtual bool setLedState( OLed led, OLedState st );
60 60
61 protected: 61 protected:
62 virtual bool filter( int unicode, int keycode, int modifiers, bool isPress, bool autoRepeat ); 62 virtual bool filter( int unicode, int keycode, int modifiers, bool isPress, bool autoRepeat );
63 virtual void timerEvent( QTimerEvent *te ); 63 virtual void timerEvent( QTimerEvent *te );
64 64
65 int m_power_timer; 65 int m_power_timer;
66 66
67 OLedState m_leds [1]; 67 OLedState m_leds [1];
68}; 68};
69 69
70struct s_button { 70struct s_button {
71 uint model; 71 uint model;
72 Qt::Key code; 72 Qt::Key code;
73 char *utext; 73 char *utext;
74 char *pix; 74 char *pix;
75 char *fpressedservice; 75 char *fpressedservice;
76 char *fpressedaction; 76 char *fpressedaction;
77 char *fheldservice; 77 char *fheldservice;
78 char *fheldaction; 78 char *fheldaction;
79}; 79};
80 80
81#endif 81#endif
diff --git a/libopie2/opiecore/device/odevice_zaurus.cpp b/libopie2/opiecore/device/odevice_zaurus.cpp
index 78bc62e..8bff770 100644
--- a/libopie2/opiecore/device/odevice_zaurus.cpp
+++ b/libopie2/opiecore/device/odevice_zaurus.cpp
@@ -306,203 +306,203 @@ void Zaurus::initButtons()
306#define SHARP_IOCTL_GET_ROTATION 0x413c 306#define SHARP_IOCTL_GET_ROTATION 0x413c
307 307
308typedef struct sharp_led_status { 308typedef struct sharp_led_status {
309int which; /* select which LED status is wanted. */ 309int which; /* select which LED status is wanted. */
310int status; /* set new led status if you call SHARP_LED_SETSTATUS */ 310int status; /* set new led status if you call SHARP_LED_SETSTATUS */
311} sharp_led_status; 311} sharp_led_status;
312 312
313#define SHARP_LED_MAIL_EXISTS 9 /* mail status (exists or not) */ 313#define SHARP_LED_MAIL_EXISTS 9 /* mail status (exists or not) */
314 314
315#define LED_MAIL_NO_UNREAD_MAIL 0 /* for SHARP_LED_MAIL_EXISTS */ 315#define LED_MAIL_NO_UNREAD_MAIL 0 /* for SHARP_LED_MAIL_EXISTS */
316#define LED_MAIL_NEWMAIL_EXISTS 1 /* for SHARP_LED_MAIL_EXISTS */ 316#define LED_MAIL_NEWMAIL_EXISTS 1 /* for SHARP_LED_MAIL_EXISTS */
317#define LED_MAIL_UNREAD_MAIL_EX 2 /* for SHARP_LED_MAIL_EXISTS */ 317#define LED_MAIL_UNREAD_MAIL_EX 2 /* for SHARP_LED_MAIL_EXISTS */
318 318
319// #include <asm/sharp_apm.h> // including kernel headers is evil ... 319// #include <asm/sharp_apm.h> // including kernel headers is evil ...
320 320
321#define APM_IOCGEVTSRC OD_IOR( 'A', 203, int ) 321#define APM_IOCGEVTSRC OD_IOR( 'A', 203, int )
322#define APM_IOCSEVTSRC OD_IORW( 'A', 204, int ) 322#define APM_IOCSEVTSRC OD_IORW( 'A', 204, int )
323#define APM_EVT_POWER_BUTTON (1 << 0) 323#define APM_EVT_POWER_BUTTON (1 << 0)
324 324
325#define FL_IOCTL_STEP_CONTRAST 100 325#define FL_IOCTL_STEP_CONTRAST 100
326 326
327 327
328void Zaurus::buzzer ( int sound ) 328void Zaurus::buzzer ( int sound )
329{ 329{
330#ifndef QT_NO_SOUND 330#ifndef QT_NO_SOUND
331 QString soundname; 331 QString soundname;
332 332
333 // Not all devices have real sound 333 // Not all devices have real sound
334 if ( d->m_model == Model_Zaurus_SLC7x0 334 if ( d->m_model == Model_Zaurus_SLC7x0
335 || d->m_model == Model_Zaurus_SLB600 ){ 335 || d->m_model == Model_Zaurus_SLB600 ){
336 336
337 switch ( sound ){ 337 switch ( sound ){
338 case SHARP_BUZ_SCHEDULE_ALARM: 338 case SHARP_BUZ_SCHEDULE_ALARM:
339 soundname = "alarm"; 339 soundname = "alarm";
340 break; 340 break;
341 case SHARP_BUZ_TOUCHSOUND: 341 case SHARP_BUZ_TOUCHSOUND:
342 soundname = "touchsound"; 342 soundname = "touchsound";
343 break; 343 break;
344 case SHARP_BUZ_KEYSOUND: 344 case SHARP_BUZ_KEYSOUND:
345 soundname = "keysound"; 345 soundname = "keysound";
346 break; 346 break;
347 default: 347 default:
348 soundname = "alarm"; 348 soundname = "alarm";
349 349
350 } 350 }
351 } 351 }
352 352
353 // If a soundname is defined, we expect that this device has 353 // If a soundname is defined, we expect that this device has
354 // sound capabilities.. Otherwise we expect to have the buzzer 354 // sound capabilities.. Otherwise we expect to have the buzzer
355 // device.. 355 // device..
356 if ( !soundname.isEmpty() ){ 356 if ( !soundname.isEmpty() ){
357 int fd; 357 int fd;
358 int vol; 358 int vol;
359 bool vol_reset = false; 359 bool vol_reset = false;
360 360
361 Sound snd ( soundname ); 361 Sound snd ( soundname );
362 362
363 if (( fd = ::open ( "/dev/sound/mixer", O_RDWR )) >= 0 ) { 363 if (( fd = ::open ( "/dev/sound/mixer", O_RDWR )) >= 0 ) {
364 if ( ::ioctl ( fd, MIXER_READ( 0 ), &vol ) >= 0 ) { 364 if ( ::ioctl ( fd, MIXER_READ( 0 ), &vol ) >= 0 ) {
365 Config cfg ( "qpe" ); 365 Config cfg ( "qpe" );
366 cfg. setGroup ( "Volume" ); 366 cfg. setGroup ( "Volume" );
367 367
368 int volalarm = cfg. readNumEntry ( "AlarmPercent", 50 ); 368 int volalarm = cfg. readNumEntry ( "AlarmPercent", 50 );
369 if ( volalarm < 0 ) 369 if ( volalarm < 0 )
370 volalarm = 0; 370 volalarm = 0;
371 else if ( volalarm > 100 ) 371 else if ( volalarm > 100 )
372 volalarm = 100; 372 volalarm = 100;
373 volalarm |= ( volalarm << 8 ); 373 volalarm |= ( volalarm << 8 );
374 374
375 if ( ::ioctl ( fd, MIXER_WRITE( 0 ), &volalarm ) >= 0 ) 375 if ( ::ioctl ( fd, MIXER_WRITE( 0 ), &volalarm ) >= 0 )
376 vol_reset = true; 376 vol_reset = true;
377 } 377 }
378 } 378 }
379 379
380 snd. play(); 380 snd. play();
381 while ( !snd. isFinished()) 381 while ( !snd. isFinished())
382 qApp->processEvents(); 382 qApp->processEvents();
383 383
384 if ( fd >= 0 ) { 384 if ( fd >= 0 ) {
385 if ( vol_reset ) 385 if ( vol_reset )
386 ::ioctl ( fd, MIXER_WRITE( 0 ), &vol ); 386 ::ioctl ( fd, MIXER_WRITE( 0 ), &vol );
387 ::close ( fd ); 387 ::close ( fd );
388 } 388 }
389 } else { 389 } else {
390 int fd = ::open ( "/dev/sharp_buz", O_WRONLY|O_NONBLOCK ); 390 int fd = ::open ( "/dev/sharp_buz", O_WRONLY|O_NONBLOCK );
391 391
392 if ( fd >= 0 ) { 392 if ( fd >= 0 ) {
393 ::ioctl ( fd, SHARP_BUZZER_MAKESOUND, sound ); 393 ::ioctl ( fd, SHARP_BUZZER_MAKESOUND, sound );
394 ::close ( fd ); 394 ::close ( fd );
395 } 395 }
396 396
397 } 397 }
398#endif 398#endif
399} 399}
400 400
401 401
402void Zaurus::alarmSound() 402void Zaurus::playAlarmSound()
403{ 403{
404 buzzer ( SHARP_BUZ_SCHEDULE_ALARM ); 404 buzzer ( SHARP_BUZ_SCHEDULE_ALARM );
405} 405}
406 406
407void Zaurus::touchSound() 407void Zaurus::playTouchSound()
408{ 408{
409 buzzer ( SHARP_BUZ_TOUCHSOUND ); 409 buzzer ( SHARP_BUZ_TOUCHSOUND );
410} 410}
411 411
412void Zaurus::keySound() 412void Zaurus::playKeySound()
413{ 413{
414 buzzer ( SHARP_BUZ_KEYSOUND ); 414 buzzer ( SHARP_BUZ_KEYSOUND );
415} 415}
416 416
417 417
418QValueList <OLed> Zaurus::ledList() const 418QValueList <OLed> Zaurus::ledList() const
419{ 419{
420 QValueList <OLed> vl; 420 QValueList <OLed> vl;
421 vl << Led_Mail; 421 vl << Led_Mail;
422 return vl; 422 return vl;
423} 423}
424 424
425QValueList <OLedState> Zaurus::ledStateList ( OLed l ) const 425QValueList <OLedState> Zaurus::ledStateList ( OLed l ) const
426{ 426{
427 QValueList <OLedState> vl; 427 QValueList <OLedState> vl;
428 428
429 if ( l == Led_Mail ) 429 if ( l == Led_Mail )
430 vl << Led_Off << Led_On << Led_BlinkSlow; 430 vl << Led_Off << Led_On << Led_BlinkSlow;
431 return vl; 431 return vl;
432} 432}
433 433
434OLedState Zaurus::ledState ( OLed which ) const 434OLedState Zaurus::ledState ( OLed which ) const
435{ 435{
436 if ( which == Led_Mail ) 436 if ( which == Led_Mail )
437 return m_leds [0]; 437 return m_leds [0];
438 else 438 else
439 return Led_Off; 439 return Led_Off;
440} 440}
441 441
442bool Zaurus::setLedState ( OLed which, OLedState st ) 442bool Zaurus::setLedState ( OLed which, OLedState st )
443{ 443{
444 if (!m_embedix) // Currently not supported on non_embedix kernels 444 if (!m_embedix) // Currently not supported on non_embedix kernels
445 return false; 445 return false;
446 446
447 static int fd = ::open ( "/dev/sharp_led", O_RDWR|O_NONBLOCK ); 447 static int fd = ::open ( "/dev/sharp_led", O_RDWR|O_NONBLOCK );
448 448
449 if ( which == Led_Mail ) { 449 if ( which == Led_Mail ) {
450 if ( fd >= 0 ) { 450 if ( fd >= 0 ) {
451 struct sharp_led_status leds; 451 struct sharp_led_status leds;
452 ::memset ( &leds, 0, sizeof( leds )); 452 ::memset ( &leds, 0, sizeof( leds ));
453 leds. which = SHARP_LED_MAIL_EXISTS; 453 leds. which = SHARP_LED_MAIL_EXISTS;
454 bool ok = true; 454 bool ok = true;
455 455
456 switch ( st ) { 456 switch ( st ) {
457 case Led_Off : leds. status = LED_MAIL_NO_UNREAD_MAIL; break; 457 case Led_Off : leds. status = LED_MAIL_NO_UNREAD_MAIL; break;
458 case Led_On : leds. status = LED_MAIL_NEWMAIL_EXISTS; break; 458 case Led_On : leds. status = LED_MAIL_NEWMAIL_EXISTS; break;
459 case Led_BlinkSlow: leds. status = LED_MAIL_UNREAD_MAIL_EX; break; 459 case Led_BlinkSlow: leds. status = LED_MAIL_UNREAD_MAIL_EX; break;
460 default : ok = false; 460 default : ok = false;
461 } 461 }
462 462
463 if ( ok && ( ::ioctl ( fd, SHARP_LED_SETSTATUS, &leds ) >= 0 )) { 463 if ( ok && ( ::ioctl ( fd, SHARP_LED_SETSTATUS, &leds ) >= 0 )) {
464 m_leds [0] = st; 464 m_leds [0] = st;
465 return true; 465 return true;
466 } 466 }
467 } 467 }
468 } 468 }
469 return false; 469 return false;
470} 470}
471 471
472bool Zaurus::setSoftSuspend ( bool soft ) 472bool Zaurus::setSoftSuspend ( bool soft )
473{ 473{
474 if (!m_embedix) { 474 if (!m_embedix) {
475 /* non-Embedix kernels dont have kernel autosuspend */ 475 /* non-Embedix kernels dont have kernel autosuspend */
476 return ODevice::setSoftSuspend( soft ); 476 return ODevice::setSoftSuspend( soft );
477 } 477 }
478 478
479 bool res = false; 479 bool res = false;
480 int fd; 480 int fd;
481 481
482 if ((( fd = ::open ( "/dev/apm_bios", O_RDWR )) >= 0 ) || 482 if ((( fd = ::open ( "/dev/apm_bios", O_RDWR )) >= 0 ) ||
483 (( fd = ::open ( "/dev/misc/apm_bios",O_RDWR )) >= 0 )) { 483 (( fd = ::open ( "/dev/misc/apm_bios",O_RDWR )) >= 0 )) {
484 484
485 int sources = ::ioctl ( fd, APM_IOCGEVTSRC, 0 ); // get current event sources 485 int sources = ::ioctl ( fd, APM_IOCGEVTSRC, 0 ); // get current event sources
486 486
487 if ( sources >= 0 ) { 487 if ( sources >= 0 ) {
488 if ( soft ) 488 if ( soft )
489 sources &= ~APM_EVT_POWER_BUTTON; 489 sources &= ~APM_EVT_POWER_BUTTON;
490 else 490 else
491 sources |= APM_EVT_POWER_BUTTON; 491 sources |= APM_EVT_POWER_BUTTON;
492 492
493 if ( ::ioctl ( fd, APM_IOCSEVTSRC, sources ) >= 0 ) // set new event sources 493 if ( ::ioctl ( fd, APM_IOCSEVTSRC, sources ) >= 0 ) // set new event sources
494 res = true; 494 res = true;
495 else 495 else
496 perror ( "APM_IOCGEVTSRC" ); 496 perror ( "APM_IOCGEVTSRC" );
497 } 497 }
498 else 498 else
499 perror ( "APM_IOCGEVTSRC" ); 499 perror ( "APM_IOCGEVTSRC" );
500 500
501 ::close ( fd ); 501 ::close ( fd );
502 } 502 }
503 else 503 else
504 perror ( "/dev/apm_bios or /dev/misc/apm_bios" ); 504 perror ( "/dev/apm_bios or /dev/misc/apm_bios" );
505 505
506 return res; 506 return res;
507} 507}
508 508
diff --git a/libopie2/opiecore/device/odevice_zaurus.h b/libopie2/opiecore/device/odevice_zaurus.h
index c07fe07..f5c5172 100644
--- a/libopie2/opiecore/device/odevice_zaurus.h
+++ b/libopie2/opiecore/device/odevice_zaurus.h
@@ -1,96 +1,96 @@
1/* 1/*
2                 This file is part of the Opie Project 2                 This file is part of the Opie Project
3              Copyright (C) The Opie Team <opie-devel@handhelds.org> 3              Copyright (C) The Opie Team <opie-devel@handhelds.org>
4 =. 4 =.
5 .=l. 5 .=l.
6           .>+-= 6           .>+-=
7 _;:,     .>    :=|. This program is free software; you can 7 _;:,     .>    :=|. This program is free software; you can
8.> <`_,   >  .   <= redistribute it and/or modify it under 8.> <`_,   >  .   <= redistribute it and/or modify it under
9:`=1 )Y*s>-.--   : the terms of the GNU Library General Public 9:`=1 )Y*s>-.--   : the terms of the GNU Library General Public
10.="- .-=="i,     .._ License as published by the Free Software 10.="- .-=="i,     .._ License as published by the Free Software
11 - .   .-<_>     .<> Foundation; either version 2 of the License, 11 - .   .-<_>     .<> Foundation; either version 2 of the License,
12     ._= =}       : or (at your option) any later version. 12     ._= =}       : or (at your option) any later version.
13    .%`+i>       _;_. 13    .%`+i>       _;_.
14    .i_,=:_.      -<s. This program is distributed in the hope that 14    .i_,=:_.      -<s. This program is distributed in the hope that
15     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY; 15     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
16    : ..    .:,     . . . without even the implied warranty of 16    : ..    .:,     . . . without even the implied warranty of
17    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A 17    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
18  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU 18  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
19..}^=.=       =       ; Library General Public License for more 19..}^=.=       =       ; Library General Public License for more
20++=   -.     .`     .: details. 20++=   -.     .`     .: details.
21 :     =  ...= . :.=- 21 :     =  ...= . :.=-
22 -.   .:....=;==+<; You should have received a copy of the GNU 22 -.   .:....=;==+<; You should have received a copy of the GNU
23  -_. . .   )=.  = Library General Public License along with 23  -_. . .   )=.  = Library General Public License along with
24    --        :-=` this library; see the file COPYING.LIB. 24    --        :-=` this library; see the file COPYING.LIB.
25 If not, write to the Free Software Foundation, 25 If not, write to the Free Software Foundation,
26 Inc., 59 Temple Place - Suite 330, 26 Inc., 59 Temple Place - Suite 330,
27 Boston, MA 02111-1307, USA. 27 Boston, MA 02111-1307, USA.
28*/ 28*/
29 29
30#ifndef ODEVICE_ZAURUS 30#ifndef ODEVICE_ZAURUS
31#define ODEVICE_ZAURUS 31#define ODEVICE_ZAURUS
32 32
33#include <opie2/odevice.h> 33#include <opie2/odevice.h>
34 34
35#ifndef ARRAY_SIZE 35#ifndef ARRAY_SIZE
36#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) 36#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
37#endif 37#endif
38 38
39// _IO and friends are only defined in kernel headers ... 39// _IO and friends are only defined in kernel headers ...
40 40
41#define OD_IOC(dir,type,number,size) (( dir << 30 ) | ( type << 8 ) | ( number ) | ( size << 16 )) 41#define OD_IOC(dir,type,number,size) (( dir << 30 ) | ( type << 8 ) | ( number ) | ( size << 16 ))
42 42
43#define OD_IO(type,number) OD_IOC(0,type,number,0) 43#define OD_IO(type,number) OD_IOC(0,type,number,0)
44#define OD_IOW(type,number,size) OD_IOC(1,type,number,sizeof(size)) 44#define OD_IOW(type,number,size) OD_IOC(1,type,number,sizeof(size))
45#define OD_IOR(type,number,size) OD_IOC(2,type,number,sizeof(size)) 45#define OD_IOR(type,number,size) OD_IOC(2,type,number,sizeof(size))
46#define OD_IORW(type,number,size) OD_IOC(3,type,number,sizeof(size)) 46#define OD_IORW(type,number,size) OD_IOC(3,type,number,sizeof(size))
47 47
48using namespace Opie; 48using namespace Opie;
49 49
50class Zaurus : public ODevice 50class Zaurus : public ODevice
51{ 51{
52 52
53 protected: 53 protected:
54 virtual void init(); 54 virtual void init();
55 virtual void initButtons(); 55 virtual void initButtons();
56 56
57 public: 57 public:
58 virtual bool setSoftSuspend ( bool soft ); 58 virtual bool setSoftSuspend ( bool soft );
59 59
60 virtual bool setDisplayBrightness ( int b ); 60 virtual bool setDisplayBrightness ( int b );
61 virtual int displayBrightnessResolution() const; 61 virtual int displayBrightnessResolution() const;
62 62
63 virtual void alarmSound(); 63 virtual void playAlarmSound();
64 virtual void keySound(); 64 virtual void playKeySound();
65 virtual void touchSound(); 65 virtual void playTouchSound();
66 66
67 virtual QValueList <OLed> ledList() const; 67 virtual QValueList <OLed> ledList() const;
68 virtual QValueList <OLedState> ledStateList ( OLed led ) const; 68 virtual QValueList <OLedState> ledStateList ( OLed led ) const;
69 virtual OLedState ledState( OLed led ) const; 69 virtual OLedState ledState( OLed led ) const;
70 virtual bool setLedState( OLed led, OLedState st ); 70 virtual bool setLedState( OLed led, OLedState st );
71 71
72 virtual bool hasHingeSensor() const; 72 virtual bool hasHingeSensor() const;
73 virtual OHingeStatus readHingeSensor(); 73 virtual OHingeStatus readHingeSensor();
74 74
75 virtual bool suspend(); 75 virtual bool suspend();
76 virtual Transformation rotation() const; 76 virtual Transformation rotation() const;
77 virtual ODirection direction() const; 77 virtual ODirection direction() const;
78 78
79 protected: 79 protected:
80 virtual void buzzer ( int snd ); 80 virtual void buzzer ( int snd );
81 81
82 OLedState m_leds [1]; 82 OLedState m_leds [1];
83 bool m_embedix; 83 bool m_embedix;
84}; 84};
85 85
86struct z_button { 86struct z_button {
87 Qt::Key code; 87 Qt::Key code;
88 char *utext; 88 char *utext;
89 char *pix; 89 char *pix;
90 char *fpressedservice; 90 char *fpressedservice;
91 char *fpressedaction; 91 char *fpressedaction;
92 char *fheldservice; 92 char *fheldservice;
93 char *fheldaction; 93 char *fheldaction;
94}; 94};
95 95
96#endif 96#endif