summaryrefslogtreecommitdiff
authorerik <erik>2007-02-08 23:11:26 (UTC)
committer erik <erik>2007-02-08 23:11:26 (UTC)
commit98353ac16bb90ee4b5df18945acf4fa7f05f9a85 (patch) (unidiff)
tree67ccd74ecfcc9006bece74089b6739736d78243f
parent497621fb3ba39ea511842a30cddfcdbda090e7ba (diff)
downloadopie-98353ac16bb90ee4b5df18945acf4fa7f05f9a85.zip
opie-98353ac16bb90ee4b5df18945acf4fa7f05f9a85.tar.gz
opie-98353ac16bb90ee4b5df18945acf4fa7f05f9a85.tar.bz2
This commit provides fixes that quiet warnings associated to device
information. It should cause no change in behavior.
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opiecore/device/odevice_htc.cpp10
-rw-r--r--libopie2/opiecore/device/odevice_motorola_ezx.cpp45
-rw-r--r--libopie2/opiecore/device/odevice_palm.cpp4
-rw-r--r--libopie2/opiecore/device/odevice_zaurus.cpp10
4 files changed, 16 insertions, 53 deletions
diff --git a/libopie2/opiecore/device/odevice_htc.cpp b/libopie2/opiecore/device/odevice_htc.cpp
index a6ade11..44b33c0 100644
--- a/libopie2/opiecore/device/odevice_htc.cpp
+++ b/libopie2/opiecore/device/odevice_htc.cpp
@@ -78,71 +78,71 @@ struct htc_button htc_buttons [] = {
78 "QPE/TaskBar", "toggleMenu()", 78 "QPE/TaskBar", "toggleMenu()",
79 "QPE/TaskBar", "toggleStartMenu()" }, 79 "QPE/TaskBar", "toggleStartMenu()" },
80 { Qt::Key_F13, QT_TRANSLATE_NOOP("Button", "Mail Button"), 80 { Qt::Key_F13, QT_TRANSLATE_NOOP("Button", "Mail Button"),
81 "devicebuttons/z_mail", 81 "devicebuttons/z_mail",
82 "opiemail", "raise()", 82 "opiemail", "raise()",
83 "opiemail", "newMail()" }, 83 "opiemail", "newMail()" },
84}; 84};
85 85
86struct htc_button htc_buttons_universal [] = { 86struct htc_button htc_buttons_universal [] = {
87 { Qt::Key_F9, QT_TRANSLATE_NOOP("Button", "Calendar Button"), 87 { Qt::Key_F9, QT_TRANSLATE_NOOP("Button", "Calendar Button"),
88 "devicebuttons/z_calendar", 88 "devicebuttons/z_calendar",
89 "datebook", "nextView()", 89 "datebook", "nextView()",
90 "today", "raise()" }, 90 "today", "raise()" },
91 { Qt::Key_F10, QT_TRANSLATE_NOOP("Button", "Contacts Button"), 91 { Qt::Key_F10, QT_TRANSLATE_NOOP("Button", "Contacts Button"),
92 "devicebuttons/z_contact", 92 "devicebuttons/z_contact",
93 "addressbook", "raise()", 93 "addressbook", "raise()",
94 "addressbook", "beamBusinessCard()" }, 94 "addressbook", "beamBusinessCard()" },
95 { Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Home Button"), 95 { Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Home Button"),
96 "devicebuttons/z_home", 96 "devicebuttons/z_home",
97 "QPE/Launcher", "home()", 97 "QPE/Launcher", "home()",
98 "buttonsettings", "raise()" }, 98 "buttonsettings", "raise()" },
99 { Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Menu Button"), 99 { Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Menu Button"),
100 "devicebuttons/z_menu", 100 "devicebuttons/z_menu",
101 "QPE/TaskBar", "toggleMenu()", 101 "QPE/TaskBar", "toggleMenu()",
102 "QPE/TaskBar", "toggleStartMenu()" }, 102 "QPE/TaskBar", "toggleStartMenu()" },
103 { Qt::Key_F13, QT_TRANSLATE_NOOP("Button", "Mail Button"), 103 { Qt::Key_F13, QT_TRANSLATE_NOOP("Button", "Mail Button"),
104 "devicebuttons/z_mail", 104 "devicebuttons/z_mail",
105 "opiemail", "raise()", 105 "opiemail", "raise()",
106 "opiemail", "newMail()" }, 106 "opiemail", "newMail()" },
107 107
108 { Qt::Key_F15, QT_TRANSLATE_NOOP("Button", "Hinge1"), 108 { Qt::Key_F15, QT_TRANSLATE_NOOP("Button", "Hinge1"),
109 "devicebuttons/z_hinge1", 109 "devicebuttons/z_hinge1",
110 "QPE/Rotation", "rotateDefault()",0}, 110 "QPE/Rotation", "rotateDefault()",0,0},
111 { Qt::Key_F16, QT_TRANSLATE_NOOP("Button", "Hinge2"), 111 { Qt::Key_F16, QT_TRANSLATE_NOOP("Button", "Hinge2"),
112 "devicebuttons/z_hinge2", 112 "devicebuttons/z_hinge2",
113 "QPE/Rotation", "rotateDefault()",0}, 113 "QPE/Rotation", "rotateDefault()",0,0},
114 { Qt::Key_F17, QT_TRANSLATE_NOOP("Button", "Hinge3"), 114 { Qt::Key_F17, QT_TRANSLATE_NOOP("Button", "Hinge3"),
115 "devicebuttons/z_hinge3", 115 "devicebuttons/z_hinge3",
116 "QPE/Rotation", "rotateDefault()",0}, 116 "QPE/Rotation", "rotateDefault()",0,0},
117}; 117};
118 118
119 119
120// 120//
121// HTC-Universal (PXA-model w/ 480x640 3.6" lcd) 121// HTC-Universal (PXA-model w/ 480x640 3.6" lcd)
122// HTC-Alpine (PXA-model w/ 240x320 3.5" lcd) 122// HTC-Alpine (PXA-model w/ 240x320 3.5" lcd)
123// HTC-Apache (PXA-model w/ 240x320 2.8" lcd) 123// HTC-Apache (PXA-model w/ 240x320 2.8" lcd)
124// HTC-Beetles (PXA-model w/ 240x240 3.0" lcd) 124// HTC-Beetles (PXA-model w/ 240x240 3.0" lcd)
125// HTC-Blueangel (PXA-model w/ 240x320 3.5" lcd) 125// HTC-Blueangel (PXA-model w/ 240x320 3.5" lcd)
126// HTC-Himalaya (PXA-model w/ 240x320 3.5" lcd) 126// HTC-Himalaya (PXA-model w/ 240x320 3.5" lcd)
127// HTC-Magician (PXA-model w/ 240x320 2.8" lcd) 127// HTC-Magician (PXA-model w/ 240x320 2.8" lcd)
128 128
129void HTC::init(const QString& cpu_info) 129void HTC::init(const QString& cpu_info)
130{ 130{
131 qDebug( "HTC::init()" ); 131 qDebug( "HTC::init()" );
132 // Set the time to wait until the system is really suspended 132 // Set the time to wait until the system is really suspended
133 // the delta between apm --suspend and sleeping 133 // the delta between apm --suspend and sleeping
134 setAPMTimeOut( 15000 ); 134 setAPMTimeOut( 15000 );
135 135
136 d->m_vendorstr = "Xanadux Team"; 136 d->m_vendorstr = "Xanadux Team";
137 d->m_systemstr = "Familiar"; 137 d->m_systemstr = "Familiar";
138 d->m_system = System_Familiar; 138 d->m_system = System_Familiar;
139 139
140 // check the HTC model 140 // check the HTC model
141 QString model; 141 QString model;
142 int loc = cpu_info.find( ":" ); 142 int loc = cpu_info.find( ":" );
143 if ( loc != -1 ) 143 if ( loc != -1 )
144 model = cpu_info.mid( loc+2 ).simplifyWhiteSpace(); 144 model = cpu_info.mid( loc+2 ).simplifyWhiteSpace();
145 else 145 else
146 model = cpu_info; 146 model = cpu_info;
147 147
148 d->m_model = Model_HTC_Universal; 148 d->m_model = Model_HTC_Universal;
@@ -326,65 +326,65 @@ void HTC::playTouchSound()
326} 326}
327 327
328void HTC::playKeySound() 328void HTC::playKeySound()
329{ 329{
330 buzzer( SHARP_BUZ_KEYSOUND ); 330 buzzer( SHARP_BUZ_KEYSOUND );
331} 331}
332 332
333 333
334QValueList <OLed> HTC::ledList() const 334QValueList <OLed> HTC::ledList() const
335{ 335{
336 QValueList <OLed> vl; 336 QValueList <OLed> vl;
337 vl << Led_Mail; 337 vl << Led_Mail;
338 return vl; 338 return vl;
339} 339}
340 340
341QValueList <OLedState> HTC::ledStateList( OLed l ) const 341QValueList <OLedState> HTC::ledStateList( OLed l ) const
342{ 342{
343 QValueList <OLedState> vl; 343 QValueList <OLedState> vl;
344 344
345 if ( l == Led_Mail ) 345 if ( l == Led_Mail )
346 vl << Led_Off << Led_On << Led_BlinkSlow; 346 vl << Led_Off << Led_On << Led_BlinkSlow;
347 return vl; 347 return vl;
348} 348}
349 349
350OLedState HTC::ledState( OLed which ) const 350OLedState HTC::ledState( OLed which ) const
351{ 351{
352 if ( which == Led_Mail ) 352 if ( which == Led_Mail )
353 return m_leds [0]; 353 return m_leds [0];
354 else 354 else
355 return Led_Off; 355 return Led_Off;
356} 356}
357 357
358bool HTC::setLedState( OLed which, OLedState st ) 358bool HTC::setLedState( OLed, OLedState )
359{ 359{
360 qDebug( "HTC::setLedState: ODevice handling not yet implemented" ); 360 qDebug( "HTC::setLedState: ODevice handling not yet implemented" );
361 return false; 361 return false;
362} 362}
363 363
364int HTC::displayBrightnessResolution() const 364int HTC::displayBrightnessResolution() const
365{ 365{
366 int res = 1; 366 int res = 1;
367 367
368 int fd = ::open( m_backlightdev + "max_brightness", O_RDONLY|O_NONBLOCK ); 368 int fd = ::open( m_backlightdev + "max_brightness", O_RDONLY|O_NONBLOCK );
369 369
370 if ( fd ) 370 if ( fd )
371 { 371 {
372 char buf[100]; 372 char buf[100];
373 if ( ::read( fd, &buf[0], sizeof buf ) ) ::sscanf( &buf[0], "%d", &res ); 373 if ( ::read( fd, &buf[0], sizeof buf ) ) ::sscanf( &buf[0], "%d", &res );
374 ::close( fd ); 374 ::close( fd );
375 } 375 }
376 376
377 return res; 377 return res;
378} 378}
379 379
380bool HTC::setDisplayBrightness( int bright ) 380bool HTC::setDisplayBrightness( int bright )
381{ 381{
382 382
383 //qDebug( "HTC::setDisplayBrightness( %d )", bright ); 383 //qDebug( "HTC::setDisplayBrightness( %d )", bright );
384 bool res = false; 384 bool res = false;
385 385
386 if ( bright > 255 ) bright = 255; 386 if ( bright > 255 ) bright = 255;
387 if ( bright < 0 ) bright = 0; 387 if ( bright < 0 ) bright = 0;
388 388
389 int numberOfSteps = displayBrightnessResolution(); 389 int numberOfSteps = displayBrightnessResolution();
390 int val = ( bright == 1 ) ? 1 : ( bright * numberOfSteps ) / 255; 390 int val = ( bright == 1 ) ? 1 : ( bright * numberOfSteps ) / 255;
@@ -402,64 +402,66 @@ bool HTC::setDisplayBrightness( int bright )
402 402
403bool HTC::setDisplayStatus( bool on ) 403bool HTC::setDisplayStatus( bool on )
404{ 404{
405 405
406 bool res = false; 406 bool res = false;
407 407
408 int fd = ::open( m_backlightdev + "power", O_WRONLY|O_NONBLOCK ); 408 int fd = ::open( m_backlightdev + "power", O_WRONLY|O_NONBLOCK );
409 if ( fd ) 409 if ( fd )
410 { 410 {
411 char buf[10]; 411 char buf[10];
412 buf[0] = on ? FB_BLANK_UNBLANK : FB_BLANK_POWERDOWN; 412 buf[0] = on ? FB_BLANK_UNBLANK : FB_BLANK_POWERDOWN;
413 buf[1] = '\0'; 413 buf[1] = '\0';
414 res = ( ::write( fd, &buf[0], 2 ) == 0 ); 414 res = ( ::write( fd, &buf[0], 2 ) == 0 );
415 ::close( fd ); 415 ::close( fd );
416 } 416 }
417 return res; 417 return res;
418} 418}
419 419
420Transformation HTC::rotation() const 420Transformation HTC::rotation() const
421{ 421{
422 qDebug( "HTC::rotation()" ); 422 qDebug( "HTC::rotation()" );
423 Transformation rot = Rot270; 423 Transformation rot = Rot270;
424 424
425 switch ( d->m_model ) { 425 switch ( d->m_model ) {
426 case Model_HTC_Universal: 426 case Model_HTC_Universal:
427 { 427 {
428 OHingeStatus hs = readHingeSensor(); 428 OHingeStatus hs = readHingeSensor();
429 qDebug( "HTC::rotation() - hinge sensor = %d", (int) hs ); 429 qDebug( "HTC::rotation() - hinge sensor = %d", (int) hs );
430 if ( hs == CASE_PORTRAIT ) rot = Rot0; 430 if ( hs == CASE_PORTRAIT ) rot = Rot0;
431 else if ( hs == CASE_UNKNOWN ) rot = Rot270; 431 else if ( hs == CASE_UNKNOWN ) rot = Rot270;
432 } 432 }
433 break; 433 break;
434 default:
435 break;
434 } 436 }
435 437
436 qDebug( "HTC::rotation() - returning '%d'", rot ); 438 qDebug( "HTC::rotation() - returning '%d'", rot );
437 return rot; 439 return rot;
438} 440}
439ODirection HTC::direction() const 441ODirection HTC::direction() const
440{ 442{
441 ODirection dir; 443 ODirection dir;
442 444
443 switch ( d->m_model ) { 445 switch ( d->m_model ) {
444 case Model_HTC_Universal: { 446 case Model_HTC_Universal: {
445 OHingeStatus hs = readHingeSensor(); 447 OHingeStatus hs = readHingeSensor();
446 if ( hs == CASE_PORTRAIT ) dir = CCW; 448 if ( hs == CASE_PORTRAIT ) dir = CCW;
447 else if ( hs == CASE_UNKNOWN ) dir = CCW; 449 else if ( hs == CASE_UNKNOWN ) dir = CCW;
448 else dir = CW; 450 else dir = CW;
449 } 451 }
450 break; 452 break;
451 default: dir = d->m_direction; 453 default: dir = d->m_direction;
452 break; 454 break;
453 } 455 }
454 return dir; 456 return dir;
455 457
456} 458}
457 459
458bool HTC::hasHingeSensor() const 460bool HTC::hasHingeSensor() const
459{ 461{
460 return d->m_model == Model_HTC_Universal; 462 return d->m_model == Model_HTC_Universal;
461} 463}
462 464
463OHingeStatus HTC::readHingeSensor() const 465OHingeStatus HTC::readHingeSensor() const
464{ 466{
465 /* 467 /*
diff --git a/libopie2/opiecore/device/odevice_motorola_ezx.cpp b/libopie2/opiecore/device/odevice_motorola_ezx.cpp
index eed81ac..67a2b9b 100644
--- a/libopie2/opiecore/device/odevice_motorola_ezx.cpp
+++ b/libopie2/opiecore/device/odevice_motorola_ezx.cpp
@@ -98,145 +98,104 @@ void Motorola_EZX::init(const QString& cpu_info)
98 // check the Motorola_EZX model 98 // check the Motorola_EZX model
99 QString model; 99 QString model;
100 int loc = cpu_info.find( ":" ); 100 int loc = cpu_info.find( ":" );
101 if ( loc != -1 ) 101 if ( loc != -1 )
102 model = cpu_info.mid( loc+2 ).simplifyWhiteSpace(); 102 model = cpu_info.mid( loc+2 ).simplifyWhiteSpace();
103 else 103 else
104 model = cpu_info; 104 model = cpu_info;
105 105
106 if ( model == "Motorola Ezx Platform" ) { 106 if ( model == "Motorola Ezx Platform" ) {
107 d->m_model = Model_Motorola_EZX; 107 d->m_model = Model_Motorola_EZX;
108 d->m_modelstr = "Motorola_EZX"; 108 d->m_modelstr = "Motorola_EZX";
109 } else assert( 0 ); 109 } else assert( 0 );
110 110
111 // set path to backlight device in kernel 2.6 111 // set path to backlight device in kernel 2.6
112 m_backlightdev = "/sys/class/backlight/ezx-bl/"; 112 m_backlightdev = "/sys/class/backlight/ezx-bl/";
113 d->m_rotation = Rot0; 113 d->m_rotation = Rot0;
114 //initHingeSensor(); 114 //initHingeSensor();
115 115
116 // set default qte driver and led state 116 // set default qte driver and led state
117 d->m_qteDriver = "Transformed"; 117 d->m_qteDriver = "Transformed";
118 m_leds[0] = Led_Off; 118 m_leds[0] = Led_Off;
119 119
120 qDebug( "Motorola_EZX::init() - Using the 2.6 OpenEZX HAL on a %s", (const char*) d->m_modelstr ); 120 qDebug( "Motorola_EZX::init() - Using the 2.6 OpenEZX HAL on a %s", (const char*) d->m_modelstr );
121} 121}
122 122
123void Motorola_EZX::initButtons() 123void Motorola_EZX::initButtons()
124{ 124{
125 qDebug( "Motorola_EZX::initButtons()" ); 125 qDebug( "Motorola_EZX::initButtons()" );
126 if ( d->m_buttons ) 126 if ( d->m_buttons )
127 return; 127 return;
128 128
129 d->m_buttons = new QValueList <ODeviceButton>; 129 d->m_buttons = new QValueList <ODeviceButton>;
130
131 struct ezx_button * ezx_buttons;
132 int buttoncount;
133
134/*
135
136 switch ( d->m_model )
137 {
138 case Model_Motorola_EZX_SL6000:
139 pezx_buttons = ezx_buttons_6000;
140 buttoncount = ARRAY_SIZE(ezx_buttons_6000);
141 break;
142 case Model_Motorola_EZX_SLC3100: // fallthrough
143 case Model_Motorola_EZX_SLC3000: // fallthrough
144 case Model_Motorola_EZX_SLC1000: // fallthrough
145 case Model_Motorola_EZX_SLC7x0:
146 if ( isQWS( ) )
147 {
148 addPreHandler(this);
149 }
150 pezx_buttons = ezx_buttons_c700;
151 buttoncount = ARRAY_SIZE(ezx_buttons_c700);
152 break;
153 default:
154 pezx_buttons = ezx_buttons;
155 buttoncount = ARRAY_SIZE(ezx_buttons);
156 break;
157 }
158
159 for ( int i = 0; i < buttoncount; i++ ) {
160 struct ezx_button *zb = pezx_buttons + i;
161 ODeviceButton b;
162
163 b.setKeycode( zb->code );
164 b.setUserText( QObject::tr( "Button", zb->utext ));
165 b.setPixmap( OResource::loadPixmap( zb->pix ));
166 b.setFactoryPresetPressedAction( OQCopMessage( makeChannel ( zb->fpressedservice ), zb->fpressedaction ));
167 b.setFactoryPresetHeldAction( OQCopMessage( makeChannel ( zb->fheldservice ), zb->fheldaction ));
168 d->m_buttons->append( b );
169 }
170*/
171 reloadButtonMapping(); 130 reloadButtonMapping();
172} 131}
173 132
174void Motorola_EZX::playAlarmSound() 133void Motorola_EZX::playAlarmSound()
175{ 134{
176#ifndef QT_NO_SOUND 135#ifndef QT_NO_SOUND
177 static Sound snd ( "alarm" ); 136 static Sound snd ( "alarm" );
178 if(!snd.isFinished()) 137 if(!snd.isFinished())
179 return; 138 return;
180 139
181 changeMixerForAlarm(0, "/dev/sound/mixer", &snd ); 140 changeMixerForAlarm(0, "/dev/sound/mixer", &snd );
182 snd. play(); 141 snd. play();
183#endif 142#endif
184} 143}
185 144
186QValueList <OLed> Motorola_EZX::ledList() const 145QValueList <OLed> Motorola_EZX::ledList() const
187{ 146{
188 QValueList <OLed> vl; 147 QValueList <OLed> vl;
189 vl << Led_Mail; 148 vl << Led_Mail;
190 return vl; 149 return vl;
191} 150}
192 151
193QValueList <OLedState> Motorola_EZX::ledStateList( OLed l ) const 152QValueList <OLedState> Motorola_EZX::ledStateList( OLed l ) const
194{ 153{
195 QValueList <OLedState> vl; 154 QValueList <OLedState> vl;
196 155
197 if ( l == Led_Mail ) 156 if ( l == Led_Mail )
198 vl << Led_Off << Led_On << Led_BlinkSlow; 157 vl << Led_Off << Led_On << Led_BlinkSlow;
199 return vl; 158 return vl;
200} 159}
201 160
202OLedState Motorola_EZX::ledState( OLed which ) const 161OLedState Motorola_EZX::ledState( OLed which ) const
203{ 162{
204 if ( which == Led_Mail ) 163 if ( which == Led_Mail )
205 return m_leds [0]; 164 return m_leds [0];
206 else 165 else
207 return Led_Off; 166 return Led_Off;
208} 167}
209 168
210bool Motorola_EZX::setLedState( OLed which, OLedState st ) 169bool Motorola_EZX::setLedState( OLed, OLedState )
211{ 170{
212 // Currently not supported 171 // Currently not supported
213 qDebug( "Motorola_EZX::setLedState: ODevice handling not yet implemented" ); 172 qDebug( "Motorola_EZX::setLedState: ODevice handling not yet implemented" );
214 return false; 173 return false;
215} 174}
216 175
217int Motorola_EZX::displayBrightnessResolution() const 176int Motorola_EZX::displayBrightnessResolution() const
218{ 177{
219 int res = 1; 178 int res = 1;
220 int fd = ::open( m_backlightdev + "max_brightness", O_RDONLY|O_NONBLOCK ); 179 int fd = ::open( m_backlightdev + "max_brightness", O_RDONLY|O_NONBLOCK );
221 if ( fd ) 180 if ( fd )
222 { 181 {
223 char buf[100]; 182 char buf[100];
224 if ( ::read( fd, &buf[0], sizeof buf ) ) ::sscanf( &buf[0], "%d", &res ); 183 if ( ::read( fd, &buf[0], sizeof buf ) ) ::sscanf( &buf[0], "%d", &res );
225 ::close( fd ); 184 ::close( fd );
226 } 185 }
227 return res; 186 return res;
228} 187}
229 188
230bool Motorola_EZX::setDisplayBrightness( int bright ) 189bool Motorola_EZX::setDisplayBrightness( int bright )
231{ 190{
232 qDebug( "Motorola_EZX::setDisplayBrightness( %d )", bright ); 191 qDebug( "Motorola_EZX::setDisplayBrightness( %d )", bright );
233 return false; 192 return false;
234 193
235 bool res = false; 194 bool res = false;
236 195
237 if ( bright > 255 ) bright = 255; 196 if ( bright > 255 ) bright = 255;
238 if ( bright < 0 ) bright = 0; 197 if ( bright < 0 ) bright = 0;
239 198
240 int numberOfSteps = displayBrightnessResolution(); 199 int numberOfSteps = displayBrightnessResolution();
241 int val = ( bright == 1 ) ? 1 : ( bright * numberOfSteps ) / 255; 200 int val = ( bright == 1 ) ? 1 : ( bright * numberOfSteps ) / 255;
242 201
@@ -251,42 +210,42 @@ bool Motorola_EZX::setDisplayBrightness( int bright )
251 return res; 210 return res;
252} 211}
253 212
254bool Motorola_EZX::setDisplayStatus( bool on ) 213bool Motorola_EZX::setDisplayStatus( bool on )
255{ 214{
256 bool res = false; 215 bool res = false;
257 int fd = ::open( m_backlightdev + "power", O_WRONLY|O_NONBLOCK ); 216 int fd = ::open( m_backlightdev + "power", O_WRONLY|O_NONBLOCK );
258 if ( fd ) 217 if ( fd )
259 { 218 {
260 char buf[10]; 219 char buf[10];
261 buf[0] = on ? FB_BLANK_UNBLANK : FB_BLANK_POWERDOWN; 220 buf[0] = on ? FB_BLANK_UNBLANK : FB_BLANK_POWERDOWN;
262 buf[1] = '\0'; 221 buf[1] = '\0';
263 res = ( ::write( fd, &buf[0], 2 ) == 0 ); 222 res = ( ::write( fd, &buf[0], 2 ) == 0 );
264 ::close( fd ); 223 ::close( fd );
265 } 224 }
266 return res; 225 return res;
267} 226}
268 227
269void Motorola_EZX::systemMessage( const QCString &msg, const QByteArray & ) 228void Motorola_EZX::systemMessage( const QCString &msg, const QByteArray & )
270{ 229{
271 if ( msg == "deviceButtonMappingChanged()" ) { 230 if ( msg == "deviceButtonMappingChanged()" ) {
272 reloadButtonMapping(); 231 reloadButtonMapping();
273 } 232 }
274} 233}
275 234
276bool Motorola_EZX::suspend() { 235bool Motorola_EZX::suspend() {
277 if ( !isQWS( ) ) // only qwsserver is allowed to suspend 236 if ( !isQWS( ) ) // only qwsserver is allowed to suspend
278 return false; 237 return false;
279 238
280 bool res = false; 239 bool res = false;
281 QCopChannel::send( "QPE/System", "aboutToSuspend()" ); 240 QCopChannel::send( "QPE/System", "aboutToSuspend()" );
282 241
283 struct timeval tvs, tvn; 242 struct timeval tvs;
284 ::gettimeofday ( &tvs, 0 ); 243 ::gettimeofday ( &tvs, 0 );
285 244
286 ::sync(); // flush fs caches 245 ::sync(); // flush fs caches
287 res = ( ::system ( "apm --suspend" ) == 0 ); 246 res = ( ::system ( "apm --suspend" ) == 0 );
288 247
289 QCopChannel::send( "QPE/System", "returnFromSuspend()" ); 248 QCopChannel::send( "QPE/System", "returnFromSuspend()" );
290 249
291 return res; 250 return res;
292} 251}
diff --git a/libopie2/opiecore/device/odevice_palm.cpp b/libopie2/opiecore/device/odevice_palm.cpp
index 76399f8..399c08c 100644
--- a/libopie2/opiecore/device/odevice_palm.cpp
+++ b/libopie2/opiecore/device/odevice_palm.cpp
@@ -60,65 +60,65 @@
60using namespace Opie::Core; 60using namespace Opie::Core;
61using namespace Opie::Core::Internal; 61using namespace Opie::Core::Internal;
62 62
63struct palm_button palm_buttons [] = { 63struct palm_button palm_buttons [] = {
64 { Model_Palm_TX | Model_Palm_LD | Model_Palm_Z72, 64 { Model_Palm_TX | Model_Palm_LD | Model_Palm_Z72,
65 Qt::Key_F9, QT_TRANSLATE_NOOP( "Button", "Home Button" ), 65 Qt::Key_F9, QT_TRANSLATE_NOOP( "Button", "Home Button" ),
66 "devicebuttons/palm_home", 66 "devicebuttons/palm_home",
67 "QPE/Launcher", "home()", 67 "QPE/Launcher", "home()",
68 "buttonsettings", "raise()" }, 68 "buttonsettings", "raise()" },
69 { Model_Palm_TX | Model_Palm_LD | Model_Palm_Z72, 69 { Model_Palm_TX | Model_Palm_LD | Model_Palm_Z72,
70 Qt::Key_F10, QT_TRANSLATE_NOOP( "Button", "Calendar Button" ), 70 Qt::Key_F10, QT_TRANSLATE_NOOP( "Button", "Calendar Button" ),
71 "devicebuttons/palm_calendar", 71 "devicebuttons/palm_calendar",
72 "datebook", "nextView()", 72 "datebook", "nextView()",
73 "today", "raise()" }, 73 "today", "raise()" },
74 { Model_Palm_TX | Model_Palm_LD | Model_Palm_Z72, 74 { Model_Palm_TX | Model_Palm_LD | Model_Palm_Z72,
75 Qt::Key_F11, QT_TRANSLATE_NOOP( "Button", "Todo Button" ), 75 Qt::Key_F11, QT_TRANSLATE_NOOP( "Button", "Todo Button" ),
76 "devicebuttons/palm_todo", 76 "devicebuttons/palm_todo",
77 "todolist", "raise()", 77 "todolist", "raise()",
78 "todolist", "create()" }, 78 "todolist", "create()" },
79 { Model_Palm_TX | Model_Palm_LD | Model_Palm_Z72, 79 { Model_Palm_TX | Model_Palm_LD | Model_Palm_Z72,
80 Qt::Key_F12, QT_TRANSLATE_NOOP( "Button", "Mail Button" ), 80 Qt::Key_F12, QT_TRANSLATE_NOOP( "Button", "Mail Button" ),
81 "devicebuttons/palm_mail", 81 "devicebuttons/palm_mail",
82 "opiemail", "raise()", 82 "opiemail", "raise()",
83 "opiemail", "newmail()" }, 83 "opiemail", "newmail()" },
84 { Model_Palm_LD, 84 { Model_Palm_LD,
85 Qt::Key_F7, QT_TRANSLATE_NOOP( "Button", "Voice Memo Button" ), 85 Qt::Key_F7, QT_TRANSLATE_NOOP( "Button", "Voice Memo Button" ),
86 "devicebuttons/palm_voice_memo", 86 "devicebuttons/palm_voice_memo",
87 "QPE/TaskBar", "toggleMenu()", 87 "QPE/TaskBar", "toggleMenu()",
88 "QPE/TaskBar", "toggleStartMenu()" }, 88 "QPE/TaskBar", "toggleStartMenu()" },
89 { Model_Palm_LD, 89 { Model_Palm_LD,
90 Qt::Key_F8, QT_TRANSLATE_NOOP( "Button", "Rotate Button" ), 90 Qt::Key_F8, QT_TRANSLATE_NOOP( "Button", "Rotate Button" ),
91 "devicebuttons/palm_rotate", 91 "devicebuttons/palm_rotate",
92 "QPE/Rotation", "flip()",0}, 92 "QPE/Rotation", "flip()",0,0},
93}; 93};
94 94
95void Palm::init(const QString& cpu_info) 95void Palm::init(const QString& cpu_info)
96{ 96{
97 d->m_vendorstr = "Palm"; 97 d->m_vendorstr = "Palm";
98 d->m_vendor = Vendor_Palm; 98 d->m_vendor = Vendor_Palm;
99 99
100 QString model = "unknown"; 100 QString model = "unknown";
101 101
102 int loc = cpu_info.find( ":" ); 102 int loc = cpu_info.find( ":" );
103 if ( loc != -1 ) 103 if ( loc != -1 )
104 model = cpu_info.mid( loc+2 ).simplifyWhiteSpace(); 104 model = cpu_info.mid( loc+2 ).simplifyWhiteSpace();
105 else 105 else
106 model = cpu_info; 106 model = cpu_info;
107 107
108 if ( model == "Palm LifeDrive" ) { 108 if ( model == "Palm LifeDrive" ) {
109 d->m_modelstr = "Palm LifeDrive"; 109 d->m_modelstr = "Palm LifeDrive";
110 d->m_model = Model_Palm_LD; 110 d->m_model = Model_Palm_LD;
111 } 111 }
112 else if ( model == "Palm TX" ) { 112 else if ( model == "Palm TX" ) {
113 d->m_modelstr = "Palm TX"; 113 d->m_modelstr = "Palm TX";
114 d->m_model = Model_Palm_TX; 114 d->m_model = Model_Palm_TX;
115 } 115 }
116 else if ( model == "Palm Zire 72" ) { 116 else if ( model == "Palm Zire 72" ) {
117 d->m_modelstr = "Palm Zire 72"; 117 d->m_modelstr = "Palm Zire 72";
118 d->m_model = Model_Palm_Z72; 118 d->m_model = Model_Palm_Z72;
119 } 119 }
120 else 120 else
121 d->m_model = Model_Unknown; 121 d->m_model = Model_Unknown;
122 122
123 switch ( d->m_model ) 123 switch ( d->m_model )
124 { 124 {
@@ -189,64 +189,66 @@ bool Palm::filter ( int /*unicode*/, int keycode, int modifiers, bool isPress, b
189 QWSServer::sendKeyEvent ( -1, newkeycode, modifiers, isPress, autoRepeat ); 189 QWSServer::sendKeyEvent ( -1, newkeycode, modifiers, isPress, autoRepeat );
190 } 190 }
191 return true; 191 return true;
192 } 192 }
193 193
194 } 194 }
195 195
196 return false; 196 return false;
197} 197}
198 198
199 199
200bool Palm::suspend() 200bool Palm::suspend()
201{ 201{
202 // some Palms do not implement their own power management at the moment. 202 // some Palms do not implement their own power management at the moment.
203 203
204 bool res = false; 204 bool res = false;
205 205
206 if ( !isQWS( ) ) // only qwsserver is allowed to suspend 206 if ( !isQWS( ) ) // only qwsserver is allowed to suspend
207 return false; 207 return false;
208 208
209 switch ( d->m_model ) { 209 switch ( d->m_model ) {
210 case Model_Palm_LD: 210 case Model_Palm_LD:
211 case Model_Palm_Z72: 211 case Model_Palm_Z72:
212 { 212 {
213 QCopChannel::send( "QPE/System", "aboutToSuspend()" ); 213 QCopChannel::send( "QPE/System", "aboutToSuspend()" );
214 214
215 ::sync(); // flush fs caches 215 ::sync(); // flush fs caches
216 res = ( ::system ( "apm --suspend" ) == 0 ); 216 res = ( ::system ( "apm --suspend" ) == 0 );
217 217
218 QCopChannel::send( "QPE/System", "returnFromSuspend()" ); 218 QCopChannel::send( "QPE/System", "returnFromSuspend()" );
219 } 219 }
220 break; 220 break;
221 default:
222 break;
221 } 223 }
222 224
223 return res; 225 return res;
224} 226}
225 227
226 228
227int Palm::displayBrightnessResolution() const 229int Palm::displayBrightnessResolution() const
228{ 230{
229 int res = 1; 231 int res = 1;
230 232
231 switch ( d->m_model ) 233 switch ( d->m_model )
232 { 234 {
233 case Model_Palm_LD: 235 case Model_Palm_LD:
234 case Model_Palm_TX: 236 case Model_Palm_TX:
235 case Model_Palm_Z72: 237 case Model_Palm_Z72:
236 int fd = ::open( m_backlightdev + "max_brightness", O_RDONLY|O_NONBLOCK ); 238 int fd = ::open( m_backlightdev + "max_brightness", O_RDONLY|O_NONBLOCK );
237 if ( fd ) 239 if ( fd )
238 { 240 {
239 char buf[100]; 241 char buf[100];
240 if ( ::read( fd, &buf[0], sizeof buf ) ) ::sscanf( &buf[0], "%d", &res ); 242 if ( ::read( fd, &buf[0], sizeof buf ) ) ::sscanf( &buf[0], "%d", &res );
241 ::close( fd ); 243 ::close( fd );
242 } 244 }
243 break; 245 break;
244 246
245 default: 247 default:
246 res = 1; 248 res = 1;
247 } 249 }
248 250
249 return res; 251 return res;
250} 252}
251 253
252 254
diff --git a/libopie2/opiecore/device/odevice_zaurus.cpp b/libopie2/opiecore/device/odevice_zaurus.cpp
index 4963f54..9d2ebbb 100644
--- a/libopie2/opiecore/device/odevice_zaurus.cpp
+++ b/libopie2/opiecore/device/odevice_zaurus.cpp
@@ -78,98 +78,98 @@ struct z_button z_buttons [] = {
78 "QPE/TaskBar", "toggleMenu()", 78 "QPE/TaskBar", "toggleMenu()",
79 "QPE/TaskBar", "toggleStartMenu()" }, 79 "QPE/TaskBar", "toggleStartMenu()" },
80 { Qt::Key_F13, QT_TRANSLATE_NOOP("Button", "Mail Button"), 80 { Qt::Key_F13, QT_TRANSLATE_NOOP("Button", "Mail Button"),
81 "devicebuttons/z_mail", 81 "devicebuttons/z_mail",
82 "opiemail", "raise()", 82 "opiemail", "raise()",
83 "opiemail", "newMail()" }, 83 "opiemail", "newMail()" },
84}; 84};
85 85
86struct z_button z_buttons_c700 [] = { 86struct z_button z_buttons_c700 [] = {
87 { Qt::Key_F9, QT_TRANSLATE_NOOP("Button", "Calendar Button"), 87 { Qt::Key_F9, QT_TRANSLATE_NOOP("Button", "Calendar Button"),
88 "devicebuttons/z_calendar", 88 "devicebuttons/z_calendar",
89 "datebook", "nextView()", 89 "datebook", "nextView()",
90 "today", "raise()" }, 90 "today", "raise()" },
91 { Qt::Key_F10, QT_TRANSLATE_NOOP("Button", "Contacts Button"), 91 { Qt::Key_F10, QT_TRANSLATE_NOOP("Button", "Contacts Button"),
92 "devicebuttons/z_contact", 92 "devicebuttons/z_contact",
93 "addressbook", "raise()", 93 "addressbook", "raise()",
94 "addressbook", "beamBusinessCard()" }, 94 "addressbook", "beamBusinessCard()" },
95 { Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Home Button"), 95 { Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Home Button"),
96 "devicebuttons/z_home", 96 "devicebuttons/z_home",
97 "QPE/Launcher", "home()", 97 "QPE/Launcher", "home()",
98 "buttonsettings", "raise()" }, 98 "buttonsettings", "raise()" },
99 { Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Menu Button"), 99 { Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Menu Button"),
100 "devicebuttons/z_menu", 100 "devicebuttons/z_menu",
101 "QPE/TaskBar", "toggleMenu()", 101 "QPE/TaskBar", "toggleMenu()",
102 "QPE/TaskBar", "toggleStartMenu()" }, 102 "QPE/TaskBar", "toggleStartMenu()" },
103 { Qt::Key_F13, QT_TRANSLATE_NOOP("Button", "Mail Button"), 103 { Qt::Key_F13, QT_TRANSLATE_NOOP("Button", "Mail Button"),
104 "devicebuttons/z_mail", 104 "devicebuttons/z_mail",
105 "opiemail", "raise()", 105 "opiemail", "raise()",
106 "opiemail", "newMail()" }, 106 "opiemail", "newMail()" },
107 107
108 { Qt::Key_F15, QT_TRANSLATE_NOOP("Button", "Hinge1"), 108 { Qt::Key_F15, QT_TRANSLATE_NOOP("Button", "Hinge1"),
109 "devicebuttons/z_hinge1", 109 "devicebuttons/z_hinge1",
110 "QPE/Rotation", "rotateDefault()",0}, 110 "QPE/Rotation", "rotateDefault()",0,0},
111 { Qt::Key_F16, QT_TRANSLATE_NOOP("Button", "Hinge2"), 111 { Qt::Key_F16, QT_TRANSLATE_NOOP("Button", "Hinge2"),
112 "devicebuttons/z_hinge2", 112 "devicebuttons/z_hinge2",
113 "QPE/Rotation", "rotateDefault()",0}, 113 "QPE/Rotation", "rotateDefault()",0,0},
114 { Qt::Key_F17, QT_TRANSLATE_NOOP("Button", "Hinge3"), 114 { Qt::Key_F17, QT_TRANSLATE_NOOP("Button", "Hinge3"),
115 "devicebuttons/z_hinge3", 115 "devicebuttons/z_hinge3",
116 "QPE/Rotation", "rotateDefault()",0}, 116 "QPE/Rotation", "rotateDefault()",0,0},
117}; 117};
118 118
119struct z_button z_buttons_6000 [] = { 119struct z_button z_buttons_6000 [] = {
120 { Qt::Key_F9, QT_TRANSLATE_NOOP("Button", "Calendar Button"), 120 { Qt::Key_F9, QT_TRANSLATE_NOOP("Button", "Calendar Button"),
121 "devicebuttons/z_calendar", 121 "devicebuttons/z_calendar",
122 "datebook", "nextView()", 122 "datebook", "nextView()",
123 "today", "raise()" }, 123 "today", "raise()" },
124 { Qt::Key_F10, QT_TRANSLATE_NOOP("Button", "Contacts Button"), 124 { Qt::Key_F10, QT_TRANSLATE_NOOP("Button", "Contacts Button"),
125 "devicebuttons/z_contact", 125 "devicebuttons/z_contact",
126 "addressbook", "raise()", 126 "addressbook", "raise()",
127 "addressbook", "beamBusinessCard()" }, 127 "addressbook", "beamBusinessCard()" },
128 { Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Home Button"), 128 { Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Home Button"),
129 "devicebuttons/z_home", 129 "devicebuttons/z_home",
130 "QPE/Launcher", "home()", 130 "QPE/Launcher", "home()",
131 "buttonsettings", "raise()" }, 131 "buttonsettings", "raise()" },
132 { Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Menu Button"), 132 { Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Menu Button"),
133 "devicebuttons/z_menu", 133 "devicebuttons/z_menu",
134 "QPE/TaskBar", "toggleMenu()", 134 "QPE/TaskBar", "toggleMenu()",
135 "QPE/TaskBar", "toggleStartMenu()" }, 135 "QPE/TaskBar", "toggleStartMenu()" },
136 { Qt::Key_F13, QT_TRANSLATE_NOOP("Button", "Mail Button"), 136 { Qt::Key_F13, QT_TRANSLATE_NOOP("Button", "Mail Button"),
137 "devicebuttons/z_mail", 137 "devicebuttons/z_mail",
138 "opiemail", "raise()", 138 "opiemail", "raise()",
139 "opiemail", "newMail()" }, 139 "opiemail", "newMail()" },
140 { Qt::Key_F15, QT_TRANSLATE_NOOP("Button", "Rotate Button"), 140 { Qt::Key_F15, QT_TRANSLATE_NOOP("Button", "Rotate Button"),
141 "devicebuttons/z_rotate", 141 "devicebuttons/z_rotate",
142 0, 142 0, "QPE/Rotation",
143 "QPE/Rotation", "rotateDefault()" }, 143 "rotateDefault()", 0 },
144 { Qt::Key_F24, QT_TRANSLATE_NOOP("Button", "Record Button"), 144 { Qt::Key_F24, QT_TRANSLATE_NOOP("Button", "Record Button"),
145 "devicebuttons/z_hinge3", 145 "devicebuttons/z_hinge3",
146 "QPE/VMemo", "toggleRecord()", 146 "QPE/VMemo", "toggleRecord()",
147 "sound", "raise()" }, 147 "sound", "raise()" },
148}; 148};
149 149
150// FIXME This gets unnecessary complicated. We should think about splitting the Zaurus 150// FIXME This gets unnecessary complicated. We should think about splitting the Zaurus
151// class up into individual classes. We would need three classes 151// class up into individual classes. We would need three classes
152// 152//
153// Zaurus-Collie (SA-model w/ 320x240 lcd, for SL5500 and SL5000) 153// Zaurus-Collie (SA-model w/ 320x240 lcd, for SL5500 and SL5000)
154// Zaurus-Poodle (PXA-model w/ 320x240 lcd, for SL5600) 154// Zaurus-Poodle (PXA-model w/ 320x240 lcd, for SL5600)
155// Zaurus-Corgi (PXA-model w/ 640x480 lcd, for C700, C750, C760, C860, C3000, C1000, C3100) 155// Zaurus-Corgi (PXA-model w/ 640x480 lcd, for C700, C750, C760, C860, C3000, C1000, C3100)
156// Zaurus-Tosa (PXA-model w/ 480x640 lcd, for SL6000) 156// Zaurus-Tosa (PXA-model w/ 480x640 lcd, for SL6000)
157 157
158void Zaurus::init(const QString& cpu_info) 158void Zaurus::init(const QString& cpu_info)
159{ 159{
160 qDebug( "Zaurus::init()" ); 160 qDebug( "Zaurus::init()" );
161 // Set the time to wait until the system is really suspended 161 // Set the time to wait until the system is really suspended
162 // the delta between apm --suspend and sleeping 162 // the delta between apm --suspend and sleeping
163 setAPMTimeOut( 15000 ); 163 setAPMTimeOut( 15000 );
164 164
165 // generic distribution code already scanned /etc/issue at that point - 165 // generic distribution code already scanned /etc/issue at that point -
166 // embedix releases contain "Embedix <version> | Linux for Embedded Devices" 166 // embedix releases contain "Embedix <version> | Linux for Embedded Devices"
167 if ( d->m_sysverstr.contains( "embedix", false ) ) 167 if ( d->m_sysverstr.contains( "embedix", false ) )
168 { 168 {
169 d->m_vendorstr = "Sharp"; 169 d->m_vendorstr = "Sharp";
170 d->m_vendor = Vendor_Sharp; 170 d->m_vendor = Vendor_Sharp;
171 d->m_systemstr = "Zaurus"; 171 d->m_systemstr = "Zaurus";
172 d->m_system = System_Zaurus; 172 d->m_system = System_Zaurus;
173 m_embedix = true; 173 m_embedix = true;
174 } 174 }
175 else 175 else