summaryrefslogtreecommitdiff
path: root/libopie2/opiecore/device/odevice.cpp
Side-by-side diff
Diffstat (limited to 'libopie2/opiecore/device/odevice.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opiecore/device/odevice.cpp7
1 files changed, 6 insertions, 1 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
@@ -57,24 +57,25 @@
#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" },
@@ -740,33 +741,37 @@ void ODevice::addPreHandler(QWSServer::KeyboardFilter*aFilter)
* @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.