summaryrefslogtreecommitdiff
path: root/libopie2/opiecore/device/odevice_zaurus.cpp
Unidiff
Diffstat (limited to 'libopie2/opiecore/device/odevice_zaurus.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opiecore/device/odevice_zaurus.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/libopie2/opiecore/device/odevice_zaurus.cpp b/libopie2/opiecore/device/odevice_zaurus.cpp
index 9d2ebbb..f978355 100644
--- a/libopie2/opiecore/device/odevice_zaurus.cpp
+++ b/libopie2/opiecore/device/odevice_zaurus.cpp
@@ -287,193 +287,195 @@ void Zaurus::init(const QString& cpu_info)
287} 287}
288 288
289void Zaurus::initButtons() 289void Zaurus::initButtons()
290{ 290{
291 qDebug( "Zaurus::initButtons()" ); 291 qDebug( "Zaurus::initButtons()" );
292 if ( d->m_buttons ) 292 if ( d->m_buttons )
293 return; 293 return;
294 294
295 d->m_buttons = new QValueList <ODeviceButton>; 295 d->m_buttons = new QValueList <ODeviceButton>;
296 296
297 struct z_button * pz_buttons; 297 struct z_button * pz_buttons;
298 int buttoncount; 298 int buttoncount;
299 switch ( d->m_model ) 299 switch ( d->m_model )
300 { 300 {
301 case Model_Zaurus_SL6000: 301 case Model_Zaurus_SL6000:
302 pz_buttons = z_buttons_6000; 302 pz_buttons = z_buttons_6000;
303 buttoncount = ARRAY_SIZE(z_buttons_6000); 303 buttoncount = ARRAY_SIZE(z_buttons_6000);
304 break; 304 break;
305 case Model_Zaurus_SLC3100: // fallthrough 305 case Model_Zaurus_SLC3100: // fallthrough
306 case Model_Zaurus_SLC3000: // fallthrough 306 case Model_Zaurus_SLC3000: // fallthrough
307 case Model_Zaurus_SLC1000: // fallthrough 307 case Model_Zaurus_SLC1000: // fallthrough
308 case Model_Zaurus_SLC7x0: 308 case Model_Zaurus_SLC7x0:
309 if ( isQWS( ) ) 309 if ( isQWS( ) )
310 { 310 {
311 addPreHandler(this); 311 addPreHandler(this);
312 } 312 }
313 pz_buttons = z_buttons_c700; 313 pz_buttons = z_buttons_c700;
314 buttoncount = ARRAY_SIZE(z_buttons_c700); 314 buttoncount = ARRAY_SIZE(z_buttons_c700);
315 break; 315 break;
316 default: 316 default:
317 pz_buttons = z_buttons; 317 pz_buttons = z_buttons;
318 buttoncount = ARRAY_SIZE(z_buttons); 318 buttoncount = ARRAY_SIZE(z_buttons);
319 break; 319 break;
320 } 320 }
321 321
322 for ( int i = 0; i < buttoncount; i++ ) { 322 for ( int i = 0; i < buttoncount; i++ ) {
323 struct z_button *zb = pz_buttons + i; 323 struct z_button *zb = pz_buttons + i;
324 ODeviceButton b; 324 ODeviceButton b;
325 325
326 b.setKeycode( zb->code ); 326 b.setKeycode( zb->code );
327 b.setUserText( QObject::tr( "Button", zb->utext )); 327 b.setUserText( QObject::tr( "Button", zb->utext ));
328 b.setPixmap( OResource::loadPixmap( zb->pix )); 328 b.setPixmap( OResource::loadPixmap( zb->pix ));
329 b.setFactoryPresetPressedAction( OQCopMessage( makeChannel ( zb->fpressedservice ), zb->fpressedaction )); 329 b.setFactoryPresetPressedAction( OQCopMessage( makeChannel ( zb->fpressedservice ), zb->fpressedaction ));
330 b.setFactoryPresetHeldAction( OQCopMessage( makeChannel ( zb->fheldservice ), zb->fheldaction )); 330 b.setFactoryPresetHeldAction( OQCopMessage( makeChannel ( zb->fheldservice ), zb->fheldaction ));
331 d->m_buttons->append( b ); 331 d->m_buttons->append( b );
332 } 332 }
333 333
334 reloadButtonMapping(); 334 reloadButtonMapping();
335} 335}
336 336
337 337
338 338
339typedef struct sharp_led_status { 339typedef struct sharp_led_status {
340 int which; /* select which LED status is wanted. */ 340 int which; /* select which LED status is wanted. */
341 int status; /* set new led status if you call SHARP_LED_SETSTATUS */ 341 int status; /* set new led status if you call SHARP_LED_SETSTATUS */
342} sharp_led_status; 342} sharp_led_status;
343 343
344void Zaurus::buzzer( int sound ) 344void Zaurus::buzzer( int sound )
345{ 345{
346#ifndef QT_NO_SOUND 346#ifndef QT_NO_SOUND
347 Sound *snd = 0; 347 Sound *snd = 0;
348 348
349 // All devices except SL5500 have a DSP device 349 // All devices except SL5500 have a DSP device
350 if ( d->m_model != Model_Zaurus_SL5000 350 if ( d->m_model != Model_Zaurus_SL5000
351 && d->m_model != Model_Zaurus_SL5500 ) { 351 && d->m_model != Model_Zaurus_SL5500 ) {
352 352
353 switch ( sound ){ 353 switch ( sound ){
354 case SHARP_BUZ_TOUCHSOUND: { 354 case SHARP_BUZ_TOUCHSOUND: {
355 static Sound touch_sound("touchsound"); 355 static Sound touch_sound("touchsound");
356 snd = &touch_sound; 356 snd = &touch_sound;
357 } 357 }
358 break; 358 break;
359 case SHARP_BUZ_KEYSOUND: { 359 case SHARP_BUZ_KEYSOUND: {
360 static Sound key_sound( "keysound" ); 360 static Sound key_sound( "keysound" );
361 snd = &key_sound; 361 snd = &key_sound;
362 } 362 }
363 break; 363 break;
364 case SHARP_BUZ_SCHEDULE_ALARM: 364 case SHARP_BUZ_SCHEDULE_ALARM:
365 default: { 365 default: {
366 static Sound alarm_sound("alarm"); 366 static Sound alarm_sound("alarm");
367 snd = &alarm_sound; 367 snd = &alarm_sound;
368 } 368 }
369 break; 369 break;
370 } 370 }
371 } 371 }
372 372
373 // If a soundname is defined, we expect that this device has 373 // If a soundname is defined, we expect that this device has
374 // sound capabilities.. Otherwise we expect to have the buzzer 374 // sound capabilities.. Otherwise we expect to have the buzzer
375 // device.. 375 // device..
376 if ( snd && snd->isFinished() ){ 376 if ( snd && snd->isFinished() ){
377 changeMixerForAlarm( 0, "/dev/sound/mixer", snd ); 377 changeMixerForAlarm( 0, "/dev/sound/mixer", snd );
378 snd->play(); 378 snd->play();
379 } else if( !snd ) { 379 } else if( !snd ) {
380 int fd = ::open ( "/dev/sharp_buz", O_WRONLY|O_NONBLOCK ); 380 int fd = ::open ( "/dev/sharp_buz", O_WRONLY|O_NONBLOCK );
381 381
382 if ( fd >= 0 ) { 382 if ( fd >= 0 ) {
383 ::ioctl ( fd, SHARP_BUZZER_MAKESOUND, sound ); 383 if (::ioctl ( fd, SHARP_BUZZER_MAKESOUND, sound ) == -1)
384 qWarning( "HTC::buzzer() - Couldn't make the buzzer buzz (%s)",
385 strerror( errno ) );
384 ::close ( fd ); 386 ::close ( fd );
385 } 387 }
386 388
387 } 389 }
388#endif 390#endif
389} 391}
390 392
391 393
392void Zaurus::playAlarmSound() 394void Zaurus::playAlarmSound()
393{ 395{
394 buzzer( SHARP_BUZ_SCHEDULE_ALARM ); 396 buzzer( SHARP_BUZ_SCHEDULE_ALARM );
395} 397}
396 398
397void Zaurus::playTouchSound() 399void Zaurus::playTouchSound()
398{ 400{
399 buzzer( SHARP_BUZ_TOUCHSOUND ); 401 buzzer( SHARP_BUZ_TOUCHSOUND );
400} 402}
401 403
402void Zaurus::playKeySound() 404void Zaurus::playKeySound()
403{ 405{
404 buzzer( SHARP_BUZ_KEYSOUND ); 406 buzzer( SHARP_BUZ_KEYSOUND );
405} 407}
406 408
407 409
408QValueList <OLed> Zaurus::ledList() const 410QValueList <OLed> Zaurus::ledList() const
409{ 411{
410 QValueList <OLed> vl; 412 QValueList <OLed> vl;
411 vl << Led_Mail; 413 vl << Led_Mail;
412 return vl; 414 return vl;
413} 415}
414 416
415QValueList <OLedState> Zaurus::ledStateList( OLed l ) const 417QValueList <OLedState> Zaurus::ledStateList( OLed l ) const
416{ 418{
417 QValueList <OLedState> vl; 419 QValueList <OLedState> vl;
418 420
419 if ( l == Led_Mail ) 421 if ( l == Led_Mail )
420 vl << Led_Off << Led_On << Led_BlinkSlow; 422 vl << Led_Off << Led_On << Led_BlinkSlow;
421 return vl; 423 return vl;
422} 424}
423 425
424OLedState Zaurus::ledState( OLed which ) const 426OLedState Zaurus::ledState( OLed which ) const
425{ 427{
426 if ( which == Led_Mail ) 428 if ( which == Led_Mail )
427 return m_leds [0]; 429 return m_leds [0];
428 else 430 else
429 return Led_Off; 431 return Led_Off;
430} 432}
431 433
432bool Zaurus::setLedState( OLed which, OLedState st ) 434bool Zaurus::setLedState( OLed which, OLedState st )
433{ 435{
434 // Currently not supported on non_embedix kernels 436 // Currently not supported on non_embedix kernels
435 if (!m_embedix) 437 if (!m_embedix)
436 { 438 {
437 qDebug( "Zaurus::setLedState: ODevice handling for non-embedix kernels not yet implemented" ); 439 qDebug( "Zaurus::setLedState: ODevice handling for non-embedix kernels not yet implemented" );
438 return false; 440 return false;
439 } 441 }
440 442
441 static int fd = ::open ( "/dev/sharp_led", O_RDWR|O_NONBLOCK ); 443 static int fd = ::open ( "/dev/sharp_led", O_RDWR|O_NONBLOCK );
442 444
443 if ( which == Led_Mail ) { 445 if ( which == Led_Mail ) {
444 if ( fd >= 0 ) { 446 if ( fd >= 0 ) {
445 struct sharp_led_status leds; 447 struct sharp_led_status leds;
446 ::memset ( &leds, 0, sizeof( leds )); 448 ::memset ( &leds, 0, sizeof( leds ));
447 leds. which = SHARP_LED_MAIL_EXISTS; 449 leds. which = SHARP_LED_MAIL_EXISTS;
448 bool ok = true; 450 bool ok = true;
449 451
450 switch ( st ) { 452 switch ( st ) {
451 case Led_Off : leds. status = LED_MAIL_NO_UNREAD_MAIL; break; 453 case Led_Off : leds. status = LED_MAIL_NO_UNREAD_MAIL; break;
452 case Led_On : leds. status = LED_MAIL_NEWMAIL_EXISTS; break; 454 case Led_On : leds. status = LED_MAIL_NEWMAIL_EXISTS; break;
453 case Led_BlinkSlow: leds. status = LED_MAIL_UNREAD_MAIL_EX; break; 455 case Led_BlinkSlow: leds. status = LED_MAIL_UNREAD_MAIL_EX; break;
454 default : ok = false; 456 default : ok = false;
455 } 457 }
456 458
457 if ( ok && ( ::ioctl ( fd, SHARP_LED_SETSTATUS, &leds ) >= 0 )) { 459 if ( ok && ( ::ioctl ( fd, SHARP_LED_SETSTATUS, &leds ) >= 0 )) {
458 m_leds [0] = st; 460 m_leds [0] = st;
459 return true; 461 return true;
460 } 462 }
461 } 463 }
462 } 464 }
463 return false; 465 return false;
464} 466}
465 467
466int Zaurus::displayBrightnessResolution() const 468int Zaurus::displayBrightnessResolution() const
467{ 469{
468 int res = 1; 470 int res = 1;
469 if (m_embedix) 471 if (m_embedix)
470 { 472 {
471 int fd = ::open( SHARP_FL_IOCTL_DEVICE, O_RDWR|O_NONBLOCK ); 473 int fd = ::open( SHARP_FL_IOCTL_DEVICE, O_RDWR|O_NONBLOCK );
472 if ( fd ) 474 if ( fd )
473 { 475 {
474 int value = ::ioctl( fd, SHARP_FL_IOCTL_GET_STEP, 0 ); 476 int value = ::ioctl( fd, SHARP_FL_IOCTL_GET_STEP, 0 );
475 ::close( fd ); 477 ::close( fd );
476 return value ? value : res; 478 return value ? value : res;
477 } 479 }
478 } 480 }
479 else 481 else