summaryrefslogtreecommitdiff
path: root/libopie2/opiecore/device/odevice_zaurus.cpp
authorerik <erik>2007-02-09 21:12:35 (UTC)
committer erik <erik>2007-02-09 21:12:35 (UTC)
commit2695f72652956e94e24611539579e7ff7899811e (patch) (unidiff)
tree0a2e73775f5b04da5950465f1c31e067256a266c /libopie2/opiecore/device/odevice_zaurus.cpp
parent9abe862308081155837512dd5e6c581752c9ddb2 (diff)
downloadopie-2695f72652956e94e24611539579e7ff7899811e.zip
opie-2695f72652956e94e24611539579e7ff7899811e.tar.gz
opie-2695f72652956e94e24611539579e7ff7899811e.tar.bz2
This commit fixes an issue where an ioctl call is made but the return
value is not checked. It isn't a big deal. But it would be nice if the user knew that an ioctl to a device tanked.
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
@@ -359,49 +359,51 @@ void Zaurus::buzzer( int sound )
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