summaryrefslogtreecommitdiff
authorsandman <sandman>2002-12-17 23:38:52 (UTC)
committer sandman <sandman>2002-12-17 23:38:52 (UTC)
commit96a9654c2fccce382a4a9ad5d2d0b991b4191468 (patch) (unidiff)
tree4ecc6cbec54d3bc51fabfed4c51b494ef4c75583
parent9a30159e1b0ac09b0be5918daae8c9530bf17d1d (diff)
downloadopie-96a9654c2fccce382a4a9ad5d2d0b991b4191468.zip
opie-96a9654c2fccce382a4a9ad5d2d0b991b4191468.tar.gz
opie-96a9654c2fccce382a4a9ad5d2d0b991b4191468.tar.bz2
fix for alarm volume handling on iPAQs
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--libopie/odevice.cpp6
1 files changed, 2 insertions, 4 deletions
diff --git a/libopie/odevice.cpp b/libopie/odevice.cpp
index 9fd3ae2..c947630 100644
--- a/libopie/odevice.cpp
+++ b/libopie/odevice.cpp
@@ -579,36 +579,34 @@ void iPAQ::alarmSound ( )
579 int fd; 579 int fd;
580 int vol; 580 int vol;
581 bool vol_reset = false; 581 bool vol_reset = false;
582 582
583 if (( fd = ::open ( "/dev/sound/mixer", O_RDWR )) >= 0 ) { 583 if (( fd = ::open ( "/dev/sound/mixer", O_RDWR )) >= 0 ) {
584 if ( ::ioctl ( fd, MIXER_READ( 0 ), &vol ) >= 0 ) { 584 if ( ::ioctl ( fd, MIXER_READ( 0 ), &vol ) >= 0 ) {
585 Config cfg ( "qpe" ); 585 Config cfg ( "qpe" );
586 cfg. setGroup ( "Volume" ); 586 cfg. setGroup ( "Volume" );
587 587
588 int volalarm = cfg. readNumEntry ( "AlarmPercent", 50 ); 588 int volalarm = cfg. readNumEntry ( "AlarmPercent", 50 );
589 if ( volalarm < 0 ) 589 if ( volalarm < 0 )
590 volalarm = 0; 590 volalarm = 0;
591 else if ( volalarm > 100 ) 591 else if ( volalarm > 100 )
592 volalarm = 100; 592 volalarm = 100;
593 volalarm |= ( volalarm << 8 ); 593 volalarm |= ( volalarm << 8 );
594 594
595 if (( volalarm & 0xff ) > ( vol & 0xff )) { 595 if ( ::ioctl ( fd, MIXER_WRITE( 0 ), &volalarm ) >= 0 )
596 if ( ::ioctl ( fd, MIXER_WRITE( 0 ), &volalarm ) >= 0 ) 596 vol_reset = true;
597 vol_reset = true;
598 }
599 } 597 }
600 } 598 }
601 599
602 snd. play ( ); 600 snd. play ( );
603 while ( !snd. isFinished ( )) 601 while ( !snd. isFinished ( ))
604 qApp-> processEvents ( ); 602 qApp-> processEvents ( );
605 603
606 if ( fd >= 0 ) { 604 if ( fd >= 0 ) {
607 if ( vol_reset ) 605 if ( vol_reset )
608 ::ioctl ( fd, MIXER_WRITE( 0 ), &vol ); 606 ::ioctl ( fd, MIXER_WRITE( 0 ), &vol );
609 ::close ( fd ); 607 ::close ( fd );
610 } 608 }
611#endif 609#endif
612} 610}
613 611
614 612