summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opiecore/device/odevice.cpp7
-rw-r--r--libopie2/opiecore/device/odevice_htc.cpp4
-rw-r--r--libopie2/opiecore/device/odevice_zaurus.cpp4
3 files changed, 12 insertions, 3 deletions
diff --git a/libopie2/opiecore/device/odevice.cpp b/libopie2/opiecore/device/odevice.cpp
index e4233eb..aecccca 100644
--- a/libopie2/opiecore/device/odevice.cpp
+++ b/libopie2/opiecore/device/odevice.cpp
@@ -53,32 +53,33 @@
#include <qpe/qcopenvelope_qws.h>
#include <qpe/sound.h>
#include <opie2/okeyfilter.h>
#include <opie2/oresource.h>
/* STD */
#include <fcntl.h>
#include <math.h>
#include <stdlib.h>
#include <signal.h>
#include <sys/ioctl.h>
#include <sys/time.h>
#include <unistd.h>
#ifndef QT_NO_SOUND
#include <linux/soundcard.h>
+#include <errno.h>
#endif
namespace Opie {
namespace Core {
static const char* PATH_PROC_CPUINFO = "/proc/cpuinfo";
/* STATIC and common implementation */
/* EXPORT */ ODistribution distributions[] = {
{ System_Familiar, "FamiliarLinux", "/etc/familiar-version" },
{ System_OpenZaurus, "OpenZaurus", "/etc/openzaurus-version" },
{ System_OpenEmbedded, "OpenEmbedded", "/etc/oe-version" },
{ System_Unknown, "Linux", "/etc/issue" },
};
@@ -736,41 +737,45 @@ void ODevice::addPreHandler(QWSServer::KeyboardFilter*aFilter)
*
* Remove the QWSServer::KeyboardFilter \par aFilter from the List
* of Keyfilters. Call this when you delete the KeyFilter!
*
* @param aFilter The filter to be removed from the Opie::Core::OKeyFilter
* @see Opie::Core::ODevice::addPreHandler
*/
void ODevice::remPreHandler(QWSServer::KeyboardFilter*aFilter)
{
Opie::Core::OKeyFilter::inst()->remPreHandler(aFilter);
}
/**
* @internal
*
+ * Returns the volume back to the user preference after an alarm is finished.
+ *
* @see changeMixerForAlarm
*/
void ODevice::playingStopped() {
if ( sender() )
const_cast<QObject*>(sender())->disconnect( this );
#ifndef QT_NO_SOUND
if ( d->m_sound >= 0 ) {
- ::ioctl ( d->m_sound, MIXER_WRITE( d->m_mixer ), &d->m_vol );
+ if (::ioctl ( d->m_sound, MIXER_WRITE( d->m_mixer ), &d->m_vol ) == -1)
+ qWarning( "ODevice::playingStopped() - "
+ "unable to change volume back (%s)", strerror( errno ) );
::close ( d->m_sound );
}
#endif
}
/**
* \brief Change the Volume for the Alarm and set it back after playing is finished
*
* If you play an Alarm Sound you might want to change the Mixer to
* full volume and ignore the user setting. After it \sa Sound::isFinished
* you would turn the volume back to the user preference.
* The problem is that we used to enter the event loop while waiting
* for the sound to be finished triggering all kind of reentrance
* problems what a library shouldn't introduce.
* Instead of manually waiting for the sound to be finished use
diff --git a/libopie2/opiecore/device/odevice_htc.cpp b/libopie2/opiecore/device/odevice_htc.cpp
index 44b33c0..7f82369 100644
--- a/libopie2/opiecore/device/odevice_htc.cpp
+++ b/libopie2/opiecore/device/odevice_htc.cpp
@@ -293,33 +293,35 @@ void HTC::buzzer( int sound )
snd = &alarm_sound;
}
break;
}
}
// If a soundname is defined, we expect that this device has
// sound capabilities.. Otherwise we expect to have the buzzer
// device..
if ( snd && snd->isFinished() ){
changeMixerForAlarm( 0, "/dev/mixer", snd );
snd->play();
} else if( !snd ) {
int fd = ::open ( "/dev/sharp_buz", O_WRONLY|O_NONBLOCK );
if ( fd >= 0 ) {
- ::ioctl ( fd, SHARP_BUZZER_MAKESOUND, sound );
+ if (::ioctl ( fd, SHARP_BUZZER_MAKESOUND, sound ) == -1)
+ qWarning( "HTC::buzzer() - Couldn't make the buzzer buzz (%s)",
+ strerror( errno ) );
::close ( fd );
}
}
#endif
}
void HTC::playAlarmSound()
{
buzzer( SHARP_BUZ_SCHEDULE_ALARM );
}
void HTC::playTouchSound()
{
buzzer( SHARP_BUZ_TOUCHSOUND );
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
@@ -367,33 +367,35 @@ void Zaurus::buzzer( int sound )
snd = &alarm_sound;
}
break;
}
}
// If a soundname is defined, we expect that this device has
// sound capabilities.. Otherwise we expect to have the buzzer
// device..
if ( snd && snd->isFinished() ){
changeMixerForAlarm( 0, "/dev/sound/mixer", snd );
snd->play();
} else if( !snd ) {
int fd = ::open ( "/dev/sharp_buz", O_WRONLY|O_NONBLOCK );
if ( fd >= 0 ) {
- ::ioctl ( fd, SHARP_BUZZER_MAKESOUND, sound );
+ if (::ioctl ( fd, SHARP_BUZZER_MAKESOUND, sound ) == -1)
+ qWarning( "HTC::buzzer() - Couldn't make the buzzer buzz (%s)",
+ strerror( errno ) );
::close ( fd );
}
}
#endif
}
void Zaurus::playAlarmSound()
{
buzzer( SHARP_BUZ_SCHEDULE_ALARM );
}
void Zaurus::playTouchSound()
{
buzzer( SHARP_BUZ_TOUCHSOUND );