summaryrefslogtreecommitdiff
authorsandman <sandman>2002-12-17 23:38:52 (UTC)
committer sandman <sandman>2002-12-17 23:38:52 (UTC)
commit96a9654c2fccce382a4a9ad5d2d0b991b4191468 (patch) (side-by-side diff)
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) (show whitespace changes)
-rw-r--r--libopie/odevice.cpp2
1 files changed, 0 insertions, 2 deletions
diff --git a/libopie/odevice.cpp b/libopie/odevice.cpp
index 9fd3ae2..c947630 100644
--- a/libopie/odevice.cpp
+++ b/libopie/odevice.cpp
@@ -571,54 +571,52 @@ void iPAQ::timerEvent ( QTimerEvent * )
QWSServer::sendKeyEvent ( -1, HardKey_Backlight, 0, false, false );
}
void iPAQ::alarmSound ( )
{
#ifndef QT_NO_SOUND
static Sound snd ( "alarm" );
int fd;
int vol;
bool vol_reset = false;
if (( fd = ::open ( "/dev/sound/mixer", O_RDWR )) >= 0 ) {
if ( ::ioctl ( fd, MIXER_READ( 0 ), &vol ) >= 0 ) {
Config cfg ( "qpe" );
cfg. setGroup ( "Volume" );
int volalarm = cfg. readNumEntry ( "AlarmPercent", 50 );
if ( volalarm < 0 )
volalarm = 0;
else if ( volalarm > 100 )
volalarm = 100;
volalarm |= ( volalarm << 8 );
- if (( volalarm & 0xff ) > ( vol & 0xff )) {
if ( ::ioctl ( fd, MIXER_WRITE( 0 ), &volalarm ) >= 0 )
vol_reset = true;
}
}
- }
snd. play ( );
while ( !snd. isFinished ( ))
qApp-> processEvents ( );
if ( fd >= 0 ) {
if ( vol_reset )
::ioctl ( fd, MIXER_WRITE( 0 ), &vol );
::close ( fd );
}
#endif
}
bool iPAQ::setSoftSuspend ( bool soft )
{
bool res = false;
int fd;
if (( fd = ::open ( "/proc/sys/ts/suspend_button_mode", O_WRONLY )) >= 0 ) {
if ( ::write ( fd, soft ? "1" : "0", 1 ) == 1 )
res = true;
else
::perror ( "write to /proc/sys/ts/suspend_button_mode" );