summaryrefslogtreecommitdiff
path: root/libopie2/opiecore/device/odevice.cpp
authorerik <erik>2007-02-09 21:12:35 (UTC)
committer erik <erik>2007-02-09 21:12:35 (UTC)
commit2695f72652956e94e24611539579e7ff7899811e (patch) (unidiff)
tree0a2e73775f5b04da5950465f1c31e067256a266c /libopie2/opiecore/device/odevice.cpp
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/opiecore/device/odevice.cpp') (more/less context) (show 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 @@
57#include <opie2/oresource.h> 57#include <opie2/oresource.h>
58 58
59/* STD */ 59/* STD */
60#include <fcntl.h> 60#include <fcntl.h>
61#include <math.h> 61#include <math.h>
62#include <stdlib.h> 62#include <stdlib.h>
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";
75 76
76 77
77/* STATIC and common implementation */ 78/* STATIC and common implementation */
78/* EXPORT */ ODistribution distributions[] = { 79/* EXPORT */ ODistribution distributions[] = {
79 { System_Familiar, "FamiliarLinux", "/etc/familiar-version" }, 80 { System_Familiar, "FamiliarLinux", "/etc/familiar-version" },
80 { System_OpenZaurus, "OpenZaurus", "/etc/openzaurus-version" }, 81 { System_OpenZaurus, "OpenZaurus", "/etc/openzaurus-version" },
@@ -740,33 +741,37 @@ void ODevice::addPreHandler(QWSServer::KeyboardFilter*aFilter)
740 * @param aFilter The filter to be removed from the Opie::Core::OKeyFilter 741 * @param aFilter The filter to be removed from the Opie::Core::OKeyFilter
741 * @see Opie::Core::ODevice::addPreHandler 742 * @see Opie::Core::ODevice::addPreHandler
742 */ 743 */
743void ODevice::remPreHandler(QWSServer::KeyboardFilter*aFilter) 744void ODevice::remPreHandler(QWSServer::KeyboardFilter*aFilter)
744{ 745{
745 Opie::Core::OKeyFilter::inst()->remPreHandler(aFilter); 746 Opie::Core::OKeyFilter::inst()->remPreHandler(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
767/** 772/**
768 * \brief Change the Volume for the Alarm and set it back after playing is finished 773 * \brief Change the Volume for the Alarm and set it back after playing is finished
769 * 774 *
770 * If you play an Alarm Sound you might want to change the Mixer to 775 * If you play an Alarm Sound you might want to change the Mixer to
771 * full volume and ignore the user setting. After it \sa Sound::isFinished 776 * full volume and ignore the user setting. After it \sa Sound::isFinished
772 * you would turn the volume back to the user preference. 777 * you would turn the volume back to the user preference.