-rw-r--r-- | libopie2/opiecore/device/odevice.cpp | 7 | ||||
-rw-r--r-- | libopie2/opiecore/device/odevice_htc.cpp | 4 | ||||
-rw-r--r-- | libopie2/opiecore/device/odevice_zaurus.cpp | 4 |
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 @@ -37,64 +37,65 @@ #include "odevice_yopy.h" #include "odevice_zaurus.h" #include "odevice_genuineintel.h" #include "odevice_htc.h" #include "odevice_motorola_ezx.h" #include "odevice_palm.h" /* QT */ #include <qapplication.h> #include <qfile.h> #include <qtextstream.h> #include <qwindowsystem_qws.h> /* OPIE */ #include <qpe/config.h> #include <qpe/sound.h> #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" }, }; /* EXPORT */ bool isQWS(){ return qApp ? ( qApp->type() == QApplication::GuiServer ) : false; } /* EXPORT */ QCString makeChannel ( const char *str ){ if ( str && !::strchr ( str, '/' )) return QCString ( "QPE/Application/" ) + str; else return str; } /* Now the default implementation of ODevice */ @@ -720,73 +721,77 @@ void ODevice::sendSuspendmsg() * * Prepend a QWSServer::KeyboardFilter to the List of Keyboard * Filters. This function is the only way to prepend a KeyFilter. * * @param aFilter The KeyFilter to be prepended to the list of filters * * @see Opie::Core::OKeyFilter * @see Opie::Core::OKeyFilter::inst() */ void ODevice::addPreHandler(QWSServer::KeyboardFilter*aFilter) { Opie::Core::OKeyFilter::inst()->addPreHandler(aFilter); } /** * \brief Remove the QWSServer::KeyboardFilter in the param from the list * * 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 * this Method and it will automatically restore the Mixer to * the user configuration after the sound finished playing. * * Note: The onwership of \param snd is not transfered and playing * is not started in this method. If 'snd' gets deleted before * playing is finished the volume doesn't get set back to * the user preference! * * \code * static Sound snd("alarm"); * if(!snd.isFinished()) * return; * * changeMixerForAlarm( my_channel, "/dev/mixer", &snd ); * snd.play() * \endcode 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 @@ -277,65 +277,67 @@ void HTC::buzzer( int sound ) if ( d->m_model == Model_HTC_Universal ) { switch ( sound ){ case SHARP_BUZ_TOUCHSOUND: { static Sound touch_sound("touchsound"); snd = &touch_sound; } break; case SHARP_BUZ_KEYSOUND: { static Sound key_sound( "keysound" ); snd = &key_sound; } break; case SHARP_BUZ_SCHEDULE_ALARM: default: { static Sound alarm_sound("alarm"); 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 ); } void HTC::playKeySound() { buzzer( SHARP_BUZ_KEYSOUND ); } QValueList <OLed> HTC::ledList() const { QValueList <OLed> vl; vl << Led_Mail; return vl; } QValueList <OLedState> HTC::ledStateList( OLed l ) const 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 @@ -351,65 +351,67 @@ void Zaurus::buzzer( int sound ) && d->m_model != Model_Zaurus_SL5500 ) { switch ( sound ){ case SHARP_BUZ_TOUCHSOUND: { static Sound touch_sound("touchsound"); snd = &touch_sound; } break; case SHARP_BUZ_KEYSOUND: { static Sound key_sound( "keysound" ); snd = &key_sound; } break; case SHARP_BUZ_SCHEDULE_ALARM: default: { static Sound alarm_sound("alarm"); 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 ); } void Zaurus::playKeySound() { buzzer( SHARP_BUZ_KEYSOUND ); } QValueList <OLed> Zaurus::ledList() const { QValueList <OLed> vl; vl << Led_Mail; return vl; } QValueList <OLedState> Zaurus::ledStateList( OLed l ) const |