summaryrefslogtreecommitdiff
Unidiff
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
@@ -37,64 +37,65 @@
37#include "odevice_yopy.h" 37#include "odevice_yopy.h"
38#include "odevice_zaurus.h" 38#include "odevice_zaurus.h"
39#include "odevice_genuineintel.h" 39#include "odevice_genuineintel.h"
40#include "odevice_htc.h" 40#include "odevice_htc.h"
41#include "odevice_motorola_ezx.h" 41#include "odevice_motorola_ezx.h"
42#include "odevice_palm.h" 42#include "odevice_palm.h"
43 43
44/* QT */ 44/* QT */
45#include <qapplication.h> 45#include <qapplication.h>
46#include <qfile.h> 46#include <qfile.h>
47#include <qtextstream.h> 47#include <qtextstream.h>
48#include <qwindowsystem_qws.h> 48#include <qwindowsystem_qws.h>
49 49
50/* OPIE */ 50/* OPIE */
51#include <qpe/config.h> 51#include <qpe/config.h>
52#include <qpe/sound.h> 52#include <qpe/sound.h>
53#include <qpe/qcopenvelope_qws.h> 53#include <qpe/qcopenvelope_qws.h>
54#include <qpe/sound.h> 54#include <qpe/sound.h>
55 55
56#include <opie2/okeyfilter.h> 56#include <opie2/okeyfilter.h>
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" },
81 { System_OpenEmbedded, "OpenEmbedded", "/etc/oe-version" }, 82 { System_OpenEmbedded, "OpenEmbedded", "/etc/oe-version" },
82 { System_Unknown, "Linux", "/etc/issue" }, 83 { System_Unknown, "Linux", "/etc/issue" },
83}; 84};
84 85
85 86
86/* EXPORT */ bool isQWS(){ 87/* EXPORT */ bool isQWS(){
87 return qApp ? ( qApp->type() == QApplication::GuiServer ) : false; 88 return qApp ? ( qApp->type() == QApplication::GuiServer ) : false;
88} 89}
89 90
90/* EXPORT */ QCString makeChannel ( const char *str ){ 91/* EXPORT */ QCString makeChannel ( const char *str ){
91 if ( str && !::strchr ( str, '/' )) 92 if ( str && !::strchr ( str, '/' ))
92 return QCString ( "QPE/Application/" ) + str; 93 return QCString ( "QPE/Application/" ) + str;
93 else 94 else
94 return str; 95 return str;
95} 96}
96 97
97 98
98 99
99/* Now the default implementation of ODevice */ 100/* Now the default implementation of ODevice */
100 101
@@ -720,73 +721,77 @@ void ODevice::sendSuspendmsg()
720 * 721 *
721 * Prepend a QWSServer::KeyboardFilter to the List of Keyboard 722 * Prepend a QWSServer::KeyboardFilter to the List of Keyboard
722 * Filters. This function is the only way to prepend a KeyFilter. 723 * Filters. This function is the only way to prepend a KeyFilter.
723 * 724 *
724 * @param aFilter The KeyFilter to be prepended to the list of filters 725 * @param aFilter The KeyFilter to be prepended to the list of filters
725 * 726 *
726 * @see Opie::Core::OKeyFilter 727 * @see Opie::Core::OKeyFilter
727 * @see Opie::Core::OKeyFilter::inst() 728 * @see Opie::Core::OKeyFilter::inst()
728 */ 729 */
729void ODevice::addPreHandler(QWSServer::KeyboardFilter*aFilter) 730void ODevice::addPreHandler(QWSServer::KeyboardFilter*aFilter)
730{ 731{
731 Opie::Core::OKeyFilter::inst()->addPreHandler(aFilter); 732 Opie::Core::OKeyFilter::inst()->addPreHandler(aFilter);
732} 733}
733 734
734/** 735/**
735 * \brief Remove the QWSServer::KeyboardFilter in the param from the list 736 * \brief Remove the QWSServer::KeyboardFilter in the param from the list
736 * 737 *
737 * Remove the QWSServer::KeyboardFilter \par aFilter from the List 738 * Remove the QWSServer::KeyboardFilter \par aFilter from the List
738 * of Keyfilters. Call this when you delete the KeyFilter! 739 * of Keyfilters. Call this when you delete the KeyFilter!
739 * 740 *
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.
773 * The problem is that we used to enter the event loop while waiting 778 * The problem is that we used to enter the event loop while waiting
774 * for the sound to be finished triggering all kind of reentrance 779 * for the sound to be finished triggering all kind of reentrance
775 * problems what a library shouldn't introduce. 780 * problems what a library shouldn't introduce.
776 * Instead of manually waiting for the sound to be finished use 781 * Instead of manually waiting for the sound to be finished use
777 * this Method and it will automatically restore the Mixer to 782 * this Method and it will automatically restore the Mixer to
778 * the user configuration after the sound finished playing. 783 * the user configuration after the sound finished playing.
779 * 784 *
780 * Note: The onwership of \param snd is not transfered and playing 785 * Note: The onwership of \param snd is not transfered and playing
781 * is not started in this method. If 'snd' gets deleted before 786 * is not started in this method. If 'snd' gets deleted before
782 * playing is finished the volume doesn't get set back to 787 * playing is finished the volume doesn't get set back to
783 * the user preference! 788 * the user preference!
784 * 789 *
785 * \code 790 * \code
786 * static Sound snd("alarm"); 791 * static Sound snd("alarm");
787 * if(!snd.isFinished()) 792 * if(!snd.isFinished())
788 * return; 793 * return;
789 * 794 *
790 * changeMixerForAlarm( my_channel, "/dev/mixer", &snd ); 795 * changeMixerForAlarm( my_channel, "/dev/mixer", &snd );
791 * snd.play() 796 * snd.play()
792 * \endcode 797 * \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 )
277 if ( d->m_model == Model_HTC_Universal ) { 277 if ( d->m_model == Model_HTC_Universal ) {
278 278
279 switch ( sound ){ 279 switch ( sound ){
280 case SHARP_BUZ_TOUCHSOUND: { 280 case SHARP_BUZ_TOUCHSOUND: {
281 static Sound touch_sound("touchsound"); 281 static Sound touch_sound("touchsound");
282 snd = &touch_sound; 282 snd = &touch_sound;
283 } 283 }
284 break; 284 break;
285 case SHARP_BUZ_KEYSOUND: { 285 case SHARP_BUZ_KEYSOUND: {
286 static Sound key_sound( "keysound" ); 286 static Sound key_sound( "keysound" );
287 snd = &key_sound; 287 snd = &key_sound;
288 } 288 }
289 break; 289 break;
290 case SHARP_BUZ_SCHEDULE_ALARM: 290 case SHARP_BUZ_SCHEDULE_ALARM:
291 default: { 291 default: {
292 static Sound alarm_sound("alarm"); 292 static Sound alarm_sound("alarm");
293 snd = &alarm_sound; 293 snd = &alarm_sound;
294 } 294 }
295 break; 295 break;
296 } 296 }
297 } 297 }
298 298
299 // If a soundname is defined, we expect that this device has 299 // If a soundname is defined, we expect that this device has
300 // sound capabilities.. Otherwise we expect to have the buzzer 300 // sound capabilities.. Otherwise we expect to have the buzzer
301 // device.. 301 // device..
302 if ( snd && snd->isFinished() ){ 302 if ( snd && snd->isFinished() ){
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}
316 318
317 319
318void HTC::playAlarmSound() 320void HTC::playAlarmSound()
319{ 321{
320 buzzer( SHARP_BUZ_SCHEDULE_ALARM ); 322 buzzer( SHARP_BUZ_SCHEDULE_ALARM );
321} 323}
322 324
323void HTC::playTouchSound() 325void HTC::playTouchSound()
324{ 326{
325 buzzer( SHARP_BUZ_TOUCHSOUND ); 327 buzzer( SHARP_BUZ_TOUCHSOUND );
326} 328}
327 329
328void HTC::playKeySound() 330void HTC::playKeySound()
329{ 331{
330 buzzer( SHARP_BUZ_KEYSOUND ); 332 buzzer( SHARP_BUZ_KEYSOUND );
331} 333}
332 334
333 335
334QValueList <OLed> HTC::ledList() const 336QValueList <OLed> HTC::ledList() const
335{ 337{
336 QValueList <OLed> vl; 338 QValueList <OLed> vl;
337 vl << Led_Mail; 339 vl << Led_Mail;
338 return vl; 340 return vl;
339} 341}
340 342
341QValueList <OLedState> HTC::ledStateList( OLed l ) const 343QValueList <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 )
351 && d->m_model != Model_Zaurus_SL5500 ) { 351 && d->m_model != Model_Zaurus_SL5500 ) {
352 352
353 switch ( sound ){ 353 switch ( sound ){
354 case SHARP_BUZ_TOUCHSOUND: { 354 case SHARP_BUZ_TOUCHSOUND: {
355 static Sound touch_sound("touchsound"); 355 static Sound touch_sound("touchsound");
356 snd = &touch_sound; 356 snd = &touch_sound;
357 } 357 }
358 break; 358 break;
359 case SHARP_BUZ_KEYSOUND: { 359 case SHARP_BUZ_KEYSOUND: {
360 static Sound key_sound( "keysound" ); 360 static Sound key_sound( "keysound" );
361 snd = &key_sound; 361 snd = &key_sound;
362 } 362 }
363 break; 363 break;
364 case SHARP_BUZ_SCHEDULE_ALARM: 364 case SHARP_BUZ_SCHEDULE_ALARM:
365 default: { 365 default: {
366 static Sound alarm_sound("alarm"); 366 static Sound alarm_sound("alarm");
367 snd = &alarm_sound; 367 snd = &alarm_sound;
368 } 368 }
369 break; 369 break;
370 } 370 }
371 } 371 }
372 372
373 // If a soundname is defined, we expect that this device has 373 // If a soundname is defined, we expect that this device has
374 // sound capabilities.. Otherwise we expect to have the buzzer 374 // sound capabilities.. Otherwise we expect to have the buzzer
375 // device.. 375 // device..
376 if ( snd && snd->isFinished() ){ 376 if ( snd && snd->isFinished() ){
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}
390 392
391 393
392void Zaurus::playAlarmSound() 394void Zaurus::playAlarmSound()
393{ 395{
394 buzzer( SHARP_BUZ_SCHEDULE_ALARM ); 396 buzzer( SHARP_BUZ_SCHEDULE_ALARM );
395} 397}
396 398
397void Zaurus::playTouchSound() 399void Zaurus::playTouchSound()
398{ 400{
399 buzzer( SHARP_BUZ_TOUCHSOUND ); 401 buzzer( SHARP_BUZ_TOUCHSOUND );
400} 402}
401 403
402void Zaurus::playKeySound() 404void Zaurus::playKeySound()
403{ 405{
404 buzzer( SHARP_BUZ_KEYSOUND ); 406 buzzer( SHARP_BUZ_KEYSOUND );
405} 407}
406 408
407 409
408QValueList <OLed> Zaurus::ledList() const 410QValueList <OLed> Zaurus::ledList() const
409{ 411{
410 QValueList <OLed> vl; 412 QValueList <OLed> vl;
411 vl << Led_Mail; 413 vl << Led_Mail;
412 return vl; 414 return vl;
413} 415}
414 416
415QValueList <OLedState> Zaurus::ledStateList( OLed l ) const 417QValueList <OLedState> Zaurus::ledStateList( OLed l ) const