summaryrefslogtreecommitdiff
authorerik <erik>2007-02-09 21:12:35 (UTC)
committer erik <erik>2007-02-09 21:12:35 (UTC)
commit2695f72652956e94e24611539579e7ff7899811e (patch) (unidiff)
tree0a2e73775f5b04da5950465f1c31e067256a266c
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 (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 @@
63#include <signal.h> 63#include <signal.h>
64#include <sys/ioctl.h> 64#include <sys/ioctl.h>
65#include <sys/time.h> 65#include <sys/time.h>
66#include <unistd.h> 66#include <unistd.h>
67#ifndef QT_NO_SOUND 67#ifndef QT_NO_SOUND
68#include <linux/soundcard.h> 68#include <linux/soundcard.h>
69#include <errno.h>
69#endif 70#endif
70 71
71namespace Opie { 72namespace Opie {
72namespace Core { 73namespace Core {
73 74
74static const char* PATH_PROC_CPUINFO = "/proc/cpuinfo"; 75static const char* PATH_PROC_CPUINFO = "/proc/cpuinfo";
@@ -746,21 +747,25 @@ void ODevice::remPreHandler(QWSServer::KeyboardFilter*aFilter)
746} 747}
747 748
748 749
749/** 750/**
750 * @internal 751 * @internal
751 * 752 *
753 * Returns the volume back to the user preference after an alarm is finished.
754 *
752 * @see changeMixerForAlarm 755 * @see changeMixerForAlarm
753 */ 756 */
754void ODevice::playingStopped() { 757void ODevice::playingStopped() {
755 if ( sender() ) 758 if ( sender() )
756 const_cast<QObject*>(sender())->disconnect( this ); 759 const_cast<QObject*>(sender())->disconnect( this );
757 760
758#ifndef QT_NO_SOUND 761#ifndef QT_NO_SOUND
759 if ( d->m_sound >= 0 ) { 762 if ( d->m_sound >= 0 ) {
760 ::ioctl ( d->m_sound, MIXER_WRITE( d->m_mixer ), &d->m_vol ); 763 if (::ioctl ( d->m_sound, MIXER_WRITE( d->m_mixer ), &d->m_vol ) == -1)
764 qWarning( "ODevice::playingStopped() - "
765 "unable to change volume back (%s)", strerror( errno ) );
761 ::close ( d->m_sound ); 766 ::close ( d->m_sound );
762 } 767 }
763#endif 768#endif
764} 769}
765 770
766 771
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 )
303 changeMixerForAlarm( 0, "/dev/mixer", snd ); 303 changeMixerForAlarm( 0, "/dev/mixer", snd );
304 snd->play(); 304 snd->play();
305 } else if( !snd ) { 305 } else if( !snd ) {
306 int fd = ::open ( "/dev/sharp_buz", O_WRONLY|O_NONBLOCK ); 306 int fd = ::open ( "/dev/sharp_buz", O_WRONLY|O_NONBLOCK );
307 307
308 if ( fd >= 0 ) { 308 if ( fd >= 0 ) {
309 ::ioctl ( fd, SHARP_BUZZER_MAKESOUND, sound ); 309 if (::ioctl ( fd, SHARP_BUZZER_MAKESOUND, sound ) == -1)
310 qWarning( "HTC::buzzer() - Couldn't make the buzzer buzz (%s)",
311 strerror( errno ) );
310 ::close ( fd ); 312 ::close ( fd );
311 } 313 }
312 314
313 } 315 }
314#endif 316#endif
315} 317}
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 )
377 changeMixerForAlarm( 0, "/dev/sound/mixer", snd ); 377 changeMixerForAlarm( 0, "/dev/sound/mixer", snd );
378 snd->play(); 378 snd->play();
379 } else if( !snd ) { 379 } else if( !snd ) {
380 int fd = ::open ( "/dev/sharp_buz", O_WRONLY|O_NONBLOCK ); 380 int fd = ::open ( "/dev/sharp_buz", O_WRONLY|O_NONBLOCK );
381 381
382 if ( fd >= 0 ) { 382 if ( fd >= 0 ) {
383 ::ioctl ( fd, SHARP_BUZZER_MAKESOUND, sound ); 383 if (::ioctl ( fd, SHARP_BUZZER_MAKESOUND, sound ) == -1)
384 qWarning( "HTC::buzzer() - Couldn't make the buzzer buzz (%s)",
385 strerror( errno ) );
384 ::close ( fd ); 386 ::close ( fd );
385 } 387 }
386 388
387 } 389 }
388#endif 390#endif
389} 391}