Diffstat (limited to 'libopie2/opiecore/device/odevice_zaurus.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | libopie2/opiecore/device/odevice_zaurus.cpp | 4 |
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 | |||
@@ -335,97 +335,99 @@ void Zaurus::initButtons() | |||
335 | } | 335 | } |
336 | 336 | ||
337 | 337 | ||
338 | 338 | ||
339 | typedef struct sharp_led_status { | 339 | typedef 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 | ||
344 | void Zaurus::buzzer( int sound ) | 344 | void 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 | ||
392 | void Zaurus::playAlarmSound() | 394 | void Zaurus::playAlarmSound() |
393 | { | 395 | { |
394 | buzzer( SHARP_BUZ_SCHEDULE_ALARM ); | 396 | buzzer( SHARP_BUZ_SCHEDULE_ALARM ); |
395 | } | 397 | } |
396 | 398 | ||
397 | void Zaurus::playTouchSound() | 399 | void Zaurus::playTouchSound() |
398 | { | 400 | { |
399 | buzzer( SHARP_BUZ_TOUCHSOUND ); | 401 | buzzer( SHARP_BUZ_TOUCHSOUND ); |
400 | } | 402 | } |
401 | 403 | ||
402 | void Zaurus::playKeySound() | 404 | void Zaurus::playKeySound() |
403 | { | 405 | { |
404 | buzzer( SHARP_BUZ_KEYSOUND ); | 406 | buzzer( SHARP_BUZ_KEYSOUND ); |
405 | } | 407 | } |
406 | 408 | ||
407 | 409 | ||
408 | QValueList <OLed> Zaurus::ledList() const | 410 | QValueList <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 | ||
415 | QValueList <OLedState> Zaurus::ledStateList( OLed l ) const | 417 | QValueList <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 | ||
424 | OLedState Zaurus::ledState( OLed which ) const | 426 | OLedState 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 | ||