summaryrefslogtreecommitdiff
path: root/libopie2
authorerik <erik>2007-02-09 21:12:35 (UTC)
committer erik <erik>2007-02-09 21:12:35 (UTC)
commit2695f72652956e94e24611539579e7ff7899811e (patch) (side-by-side diff)
tree0a2e73775f5b04da5950465f1c31e067256a266c /libopie2
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') (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
@@ -63,12 +63,13 @@
#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";
@@ -746,21 +747,25 @@ void ODevice::remPreHandler(QWSServer::KeyboardFilter*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
}
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
@@ -303,13 +303,15 @@ void HTC::buzzer( int sound )
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
}
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
@@ -377,13 +377,15 @@ void Zaurus::buzzer( int sound )
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
}