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
@@ -1,164 +1,165 @@
1/* 1/*
2                 This file is part of the Opie Project 2                 This file is part of the Opie Project
3 =. (C) 2002-2006 The Opie Team <opie-devel@handhelds.org> 3 =. (C) 2002-2006 The Opie Team <opie-devel@handhelds.org>
4 .=l. 4 .=l.
5           .>+-= 5           .>+-=
6 _;:,     .>    :=|. This program is free software; you can 6 _;:,     .>    :=|. This program is free software; you can
7.> <`_,   >  .   <= redistribute it and/or modify it under 7.> <`_,   >  .   <= redistribute it and/or modify it under
8:`=1 )Y*s>-.--   : the terms of the GNU Library General Public 8:`=1 )Y*s>-.--   : the terms of the GNU Library General Public
9.="- .-=="i,     .._ License as published by the Free Software 9.="- .-=="i,     .._ License as published by the Free Software
10 - .   .-<_>     .<> Foundation; version 2 of the License. 10 - .   .-<_>     .<> Foundation; version 2 of the License.
11     ._= =}       : 11     ._= =}       :
12    .%`+i>       _;_. 12    .%`+i>       _;_.
13    .i_,=:_.      -<s. This program is distributed in the hope that 13    .i_,=:_.      -<s. This program is distributed in the hope that
14     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY; 14     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
15    : ..    .:,     . . . without even the implied warranty of 15    : ..    .:,     . . . without even the implied warranty of
16    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A 16    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
17  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU 17  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
18..}^=.=       =       ; Library General Public License for more 18..}^=.=       =       ; Library General Public License for more
19++=   -.     .`     .: details. 19++=   -.     .`     .: details.
20 :     =  ...= . :.=- 20 :     =  ...= . :.=-
21 -.   .:....=;==+<; You should have received a copy of the GNU 21 -.   .:....=;==+<; You should have received a copy of the GNU
22  -_. . .   )=.  = Library General Public License along with 22  -_. . .   )=.  = Library General Public License along with
23    --        :-=` this library; see the file COPYING.LIB. 23    --        :-=` this library; see the file COPYING.LIB.
24 If not, write to the Free Software Foundation, 24 If not, write to the Free Software Foundation,
25 Inc., 59 Temple Place - Suite 330, 25 Inc., 59 Temple Place - Suite 330,
26 Boston, MA 02111-1307, USA. 26 Boston, MA 02111-1307, USA.
27 27
28*/ 28*/
29 29
30 30
31#include "odevice_beagle.h" 31#include "odevice_beagle.h"
32#include "odevice_ipaq.h" 32#include "odevice_ipaq.h"
33#include "odevice_mypal.h" 33#include "odevice_mypal.h"
34#include "odevice_jornada.h" 34#include "odevice_jornada.h"
35#include "odevice_ramses.h" 35#include "odevice_ramses.h"
36#include "odevice_simpad.h" 36#include "odevice_simpad.h"
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
101struct default_button default_buttons [] = { 102struct default_button default_buttons [] = {
102 { Qt::Key_F9, QT_TRANSLATE_NOOP("Button", "Calendar Button"), 103 { Qt::Key_F9, QT_TRANSLATE_NOOP("Button", "Calendar Button"),
103 "devicebuttons/z_calendar", 104 "devicebuttons/z_calendar",
104 "datebook", "nextView()", 105 "datebook", "nextView()",
105 "today", "raise()" }, 106 "today", "raise()" },
106 { Qt::Key_F10, QT_TRANSLATE_NOOP("Button", "Contacts Button"), 107 { Qt::Key_F10, QT_TRANSLATE_NOOP("Button", "Contacts Button"),
107 "devicebuttons/z_contact", 108 "devicebuttons/z_contact",
108 "addressbook", "raise()", 109 "addressbook", "raise()",
109 "addressbook", "beamBusinessCard()" }, 110 "addressbook", "beamBusinessCard()" },
110 { Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Home Button"), 111 { Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Home Button"),
111 "devicebuttons/z_home", 112 "devicebuttons/z_home",
112 "QPE/Launcher", "home()", 113 "QPE/Launcher", "home()",
113 "buttonsettings", "raise()" }, 114 "buttonsettings", "raise()" },
114 { Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Menu Button"), 115 { Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Menu Button"),
115 "devicebuttons/z_menu", 116 "devicebuttons/z_menu",
116 "QPE/TaskBar", "toggleMenu()", 117 "QPE/TaskBar", "toggleMenu()",
117 "QPE/TaskBar", "toggleStartMenu()" }, 118 "QPE/TaskBar", "toggleStartMenu()" },
118 { Qt::Key_F13, QT_TRANSLATE_NOOP("Button", "Mail Button"), 119 { Qt::Key_F13, QT_TRANSLATE_NOOP("Button", "Mail Button"),
119 "devicebuttons/z_mail", 120 "devicebuttons/z_mail",
120 "opiemail", "raise()", 121 "opiemail", "raise()",
121 "opiemail", "newMail()" }, 122 "opiemail", "newMail()" },
122}; 123};
123 124
124ODevice *ODevice::inst() 125ODevice *ODevice::inst()
125{ 126{
126 static ODevice *dev = 0; 127 static ODevice *dev = 0;
127 QString cpu_info; 128 QString cpu_info;
128 129
129 if ( !dev ) 130 if ( !dev )
130 { 131 {
131 QFile f( PATH_PROC_CPUINFO ); 132 QFile f( PATH_PROC_CPUINFO );
132 if ( f.open( IO_ReadOnly ) ) 133 if ( f.open( IO_ReadOnly ) )
133 { 134 {
134 QTextStream s( &f ); 135 QTextStream s( &f );
135 while ( !s.atEnd() ) 136 while ( !s.atEnd() )
136 { 137 {
137 QString line; 138 QString line;
138 line = s.readLine(); 139 line = s.readLine();
139 if ( line.startsWith( "Hardware" ) ) 140 if ( line.startsWith( "Hardware" ) )
140 { 141 {
141 qDebug( "ODevice() - found '%s'", (const char*) line ); 142 qDebug( "ODevice() - found '%s'", (const char*) line );
142 cpu_info = line; 143 cpu_info = line;
143 if ( line.contains( "sharp", false ) ) dev = new Internal::Zaurus(); 144 if ( line.contains( "sharp", false ) ) dev = new Internal::Zaurus();
144 else if ( line.contains( "ipaq", false ) ) dev = new Internal::iPAQ(); 145 else if ( line.contains( "ipaq", false ) ) dev = new Internal::iPAQ();
145 else if ( line.contains( "mypal", false ) ) dev = new Internal::MyPal(); 146 else if ( line.contains( "mypal", false ) ) dev = new Internal::MyPal();
146 else if ( line.contains( "simpad", false ) ) dev = new Internal::SIMpad(); 147 else if ( line.contains( "simpad", false ) ) dev = new Internal::SIMpad();
147 else if ( line.contains( "jornada", false ) ) dev = new Internal::Jornada(); 148 else if ( line.contains( "jornada", false ) ) dev = new Internal::Jornada();
148 else if ( line.contains( "ramses", false ) ) dev = new Internal::Ramses(); 149 else if ( line.contains( "ramses", false ) ) dev = new Internal::Ramses();
149 else if ( line.contains( "Tradesquare.NL", false ) ) dev = new Internal::Beagle(); 150 else if ( line.contains( "Tradesquare.NL", false ) ) dev = new Internal::Beagle();
150 else if ( line.contains( "HTC", false ) ) dev = new Internal::HTC(); 151 else if ( line.contains( "HTC", false ) ) dev = new Internal::HTC();
151 else if ( line.contains( "Motorola", false ) ) dev = new Internal::Motorola_EZX(); 152 else if ( line.contains( "Motorola", false ) ) dev = new Internal::Motorola_EZX();
152 else if ( line.contains( "Palm", false ) ) dev = new Internal::Palm(); 153 else if ( line.contains( "Palm", false ) ) dev = new Internal::Palm();
153 154
154 else qWarning( "ODevice() - unknown hardware - using default." ); 155 else qWarning( "ODevice() - unknown hardware - using default." );
155 break; 156 break;
156 } else if ( line.startsWith( "vendor_id" ) ) { 157 } else if ( line.startsWith( "vendor_id" ) ) {
157 qDebug( "ODevice() - found '%s'", (const char*) line ); 158 qDebug( "ODevice() - found '%s'", (const char*) line );
158 cpu_info = line; 159 cpu_info = line;
159 if( line.contains( "genuineintel", false ) ) { 160 if( line.contains( "genuineintel", false ) ) {
160 dev = new Internal::GenuineIntel(); 161 dev = new Internal::GenuineIntel();
161 break; 162 break;
162 } 163 }
163 } 164 }
164 } 165 }
@@ -656,169 +657,173 @@ void ODevice::remapPressedAction ( int button, const OQCopMessage &action )
656 657
657 ODeviceButton &b = ( *d->m_buttons ) [button]; 658 ODeviceButton &b = ( *d->m_buttons ) [button];
658 b. setPressedAction ( action ); 659 b. setPressedAction ( action );
659 660
660 mb_chan=b. pressedAction(). channel(); 661 mb_chan=b. pressedAction(). channel();
661 662
662 Config buttonFile ( "ButtonSettings" ); 663 Config buttonFile ( "ButtonSettings" );
663 buttonFile. setGroup ( "Button" + QString::number ( button )); 664 buttonFile. setGroup ( "Button" + QString::number ( button ));
664 buttonFile. writeEntry ( "PressedActionChannel", (const char*) mb_chan); 665 buttonFile. writeEntry ( "PressedActionChannel", (const char*) mb_chan);
665 buttonFile. writeEntry ( "PressedActionMessage", (const char*) b. pressedAction(). message()); 666 buttonFile. writeEntry ( "PressedActionMessage", (const char*) b. pressedAction(). message());
666 667
667// buttonFile. writeEntry ( "PressedActionArgs", encodeBase64 ( b. pressedAction(). data())); 668// buttonFile. writeEntry ( "PressedActionArgs", encodeBase64 ( b. pressedAction(). data()));
668 669
669 QCopEnvelope ( "QPE/System", "deviceButtonMappingChanged()" ); 670 QCopEnvelope ( "QPE/System", "deviceButtonMappingChanged()" );
670} 671}
671 672
672void ODevice::remapHeldAction ( int button, const OQCopMessage &action ) 673void ODevice::remapHeldAction ( int button, const OQCopMessage &action )
673{ 674{
674 initButtons(); 675 initButtons();
675 676
676 if ( button >= (int) d->m_buttons->count()) 677 if ( button >= (int) d->m_buttons->count())
677 return; 678 return;
678 679
679 ODeviceButton &b = ( *d->m_buttons ) [button]; 680 ODeviceButton &b = ( *d->m_buttons ) [button];
680 b. setHeldAction ( action ); 681 b. setHeldAction ( action );
681 682
682 Config buttonFile ( "ButtonSettings" ); 683 Config buttonFile ( "ButtonSettings" );
683 buttonFile. setGroup ( "Button" + QString::number ( button )); 684 buttonFile. setGroup ( "Button" + QString::number ( button ));
684 buttonFile. writeEntry ( "HeldActionChannel", (const char *) b. heldAction(). channel()); 685 buttonFile. writeEntry ( "HeldActionChannel", (const char *) b. heldAction(). channel());
685 buttonFile. writeEntry ( "HeldActionMessage", (const char *) b. heldAction(). message()); 686 buttonFile. writeEntry ( "HeldActionMessage", (const char *) b. heldAction(). message());
686 687
687// buttonFile. writeEntry ( "HeldActionArgs", decodeBase64 ( b. heldAction(). data())); 688// buttonFile. writeEntry ( "HeldActionArgs", decodeBase64 ( b. heldAction(). data()));
688 689
689 QCopEnvelope ( "QPE/System", "deviceButtonMappingChanged()" ); 690 QCopEnvelope ( "QPE/System", "deviceButtonMappingChanged()" );
690} 691}
691 692
692/** 693/**
693 * @internal 694 * @internal
694 */ 695 */
695void ODevice::virtual_hook(int, void* ){ 696void ODevice::virtual_hook(int, void* ){
696 697
697} 698}
698 699
699/** 700/**
700 * \brief Send a QCOP Message before suspending 701 * \brief Send a QCOP Message before suspending
701 * 702 *
702 * Sends a QCOP message to channel QPE/System 703 * Sends a QCOP message to channel QPE/System
703 * with the message "aboutToSuspend()" if this 704 * with the message "aboutToSuspend()" if this
704 * is the windowing server. 705 * is the windowing server.
705 * 706 *
706 * Call this in your custom \sa suspend() Method 707 * Call this in your custom \sa suspend() Method
707 * before going to suspend. 708 * before going to suspend.
708 * 709 *
709 */ 710 */
710void ODevice::sendSuspendmsg() 711void ODevice::sendSuspendmsg()
711{ 712{
712 if ( !isQWS() ) 713 if ( !isQWS() )
713 return; 714 return;
714 715
715 QCopEnvelope ( "QPE/System", "aboutToSuspend()" ); 716 QCopEnvelope ( "QPE/System", "aboutToSuspend()" );
716} 717}
717 718
718/** 719/**
719 * \brief Prepend the QWSServer::KeyboardFilter to the list of installed KeyFilters 720 * \brief Prepend the QWSServer::KeyboardFilter to the list of installed KeyFilters
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
793 * 798 *
794 * 799 *
795 * 800 *
796 * @param mixer The mixer number/channel to use 801 * @param mixer The mixer number/channel to use
797 * @param file The file name. If you convert from QString use QFile::encodeName 802 * @param file The file name. If you convert from QString use QFile::encodeName
798 * @param snd The sound to wait for finishing 803 * @param snd The sound to wait for finishing
799 * 804 *
800 */ 805 */
801void ODevice::changeMixerForAlarm( int mixer, const char* file, Sound *snd ) { 806void ODevice::changeMixerForAlarm( int mixer, const char* file, Sound *snd ) {
802#ifndef QT_NO_SOUND 807#ifndef QT_NO_SOUND
803 if (( d->m_sound = ::open ( file, O_RDWR )) >= 0 ) { 808 if (( d->m_sound = ::open ( file, O_RDWR )) >= 0 ) {
804 if ( ::ioctl ( d->m_sound, MIXER_READ( mixer ), &d->m_vol ) >= 0 ) { 809 if ( ::ioctl ( d->m_sound, MIXER_READ( mixer ), &d->m_vol ) >= 0 ) {
805 Config cfg ( "qpe" ); 810 Config cfg ( "qpe" );
806 cfg. setGroup ( "Volume" ); 811 cfg. setGroup ( "Volume" );
807 812
808 int volalarm = cfg. readNumEntry ( "AlarmPercent", 50 ); 813 int volalarm = cfg. readNumEntry ( "AlarmPercent", 50 );
809 if ( volalarm < 0 ) 814 if ( volalarm < 0 )
810 volalarm = 0; 815 volalarm = 0;
811 else if ( volalarm > 100 ) 816 else if ( volalarm > 100 )
812 volalarm = 100; 817 volalarm = 100;
813 volalarm |= ( volalarm << 8 ); 818 volalarm |= ( volalarm << 8 );
814 819
815 if ( ::ioctl ( d->m_sound, MIXER_WRITE( mixer ), &volalarm ) >= 0 ) 820 if ( ::ioctl ( d->m_sound, MIXER_WRITE( mixer ), &volalarm ) >= 0 )
816 register_qpe_sound_finished(snd, this, SLOT(playingStopped())); 821 register_qpe_sound_finished(snd, this, SLOT(playingStopped()));
817 } 822 }
818 d->m_mixer = mixer; 823 d->m_mixer = mixer;
819 } 824 }
820#endif 825#endif
821} 826}
822 827
823} 828}
824} 829}
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
@@ -213,193 +213,195 @@ void HTC::init(const QString& cpu_info)
213 { 213 {
214 default: 214 default:
215 d->m_qteDriver = "Transformed"; 215 d->m_qteDriver = "Transformed";
216 } 216 }
217 217
218 m_leds[0] = Led_Off; 218 m_leds[0] = Led_Off;
219 219
220 qDebug( "HTC::init() - Using the 2.6 Xanadux on a %s", (const char*) d->m_modelstr ); 220 qDebug( "HTC::init() - Using the 2.6 Xanadux on a %s", (const char*) d->m_modelstr );
221} 221}
222 222
223void HTC::initButtons() 223void HTC::initButtons()
224{ 224{
225 qDebug( "HTC::initButtons()" ); 225 qDebug( "HTC::initButtons()" );
226 if ( d->m_buttons ) 226 if ( d->m_buttons )
227 return; 227 return;
228 228
229 d->m_buttons = new QValueList <ODeviceButton>; 229 d->m_buttons = new QValueList <ODeviceButton>;
230 230
231 struct htc_button * phtc_buttons; 231 struct htc_button * phtc_buttons;
232 int buttoncount; 232 int buttoncount;
233 switch ( d->m_model ) 233 switch ( d->m_model )
234 { 234 {
235 case Model_HTC_Universal: 235 case Model_HTC_Universal:
236 if ( isQWS( ) ) 236 if ( isQWS( ) )
237 { 237 {
238 addPreHandler(this); 238 addPreHandler(this);
239 } 239 }
240 phtc_buttons = htc_buttons_universal; 240 phtc_buttons = htc_buttons_universal;
241 buttoncount = ARRAY_SIZE(htc_buttons_universal); 241 buttoncount = ARRAY_SIZE(htc_buttons_universal);
242 break; 242 break;
243 default: 243 default:
244 phtc_buttons = htc_buttons; 244 phtc_buttons = htc_buttons;
245 buttoncount = ARRAY_SIZE(htc_buttons); 245 buttoncount = ARRAY_SIZE(htc_buttons);
246 break; 246 break;
247 } 247 }
248 248
249 for ( int i = 0; i < buttoncount; i++ ) { 249 for ( int i = 0; i < buttoncount; i++ ) {
250 struct htc_button *zb = phtc_buttons + i; 250 struct htc_button *zb = phtc_buttons + i;
251 ODeviceButton b; 251 ODeviceButton b;
252 252
253 b.setKeycode( zb->code ); 253 b.setKeycode( zb->code );
254 b.setUserText( QObject::tr( "Button", zb->utext )); 254 b.setUserText( QObject::tr( "Button", zb->utext ));
255 b.setPixmap( OResource::loadPixmap( zb->pix )); 255 b.setPixmap( OResource::loadPixmap( zb->pix ));
256 b.setFactoryPresetPressedAction( OQCopMessage( makeChannel ( zb->fpressedservice ), zb->fpressedaction )); 256 b.setFactoryPresetPressedAction( OQCopMessage( makeChannel ( zb->fpressedservice ), zb->fpressedaction ));
257 b.setFactoryPresetHeldAction( OQCopMessage( makeChannel ( zb->fheldservice ), zb->fheldaction )); 257 b.setFactoryPresetHeldAction( OQCopMessage( makeChannel ( zb->fheldservice ), zb->fheldaction ));
258 d->m_buttons->append( b ); 258 d->m_buttons->append( b );
259 } 259 }
260 260
261 reloadButtonMapping(); 261 reloadButtonMapping();
262} 262}
263 263
264 264
265 265
266typedef struct sharp_led_status { 266typedef struct sharp_led_status {
267 int which; /* select which LED status is wanted. */ 267 int which; /* select which LED status is wanted. */
268 int status; /* set new led status if you call SHARP_LED_SETSTATUS */ 268 int status; /* set new led status if you call SHARP_LED_SETSTATUS */
269} sharp_led_status; 269} sharp_led_status;
270 270
271void HTC::buzzer( int sound ) 271void HTC::buzzer( int sound )
272{ 272{
273#ifndef QT_NO_SOUND 273#ifndef QT_NO_SOUND
274 Sound *snd = 0; 274 Sound *snd = 0;
275 275
276 // All devices except SL5500 have a DSP device 276 // All devices except SL5500 have a DSP device
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
342{ 344{
343 QValueList <OLedState> vl; 345 QValueList <OLedState> vl;
344 346
345 if ( l == Led_Mail ) 347 if ( l == Led_Mail )
346 vl << Led_Off << Led_On << Led_BlinkSlow; 348 vl << Led_Off << Led_On << Led_BlinkSlow;
347 return vl; 349 return vl;
348} 350}
349 351
350OLedState HTC::ledState( OLed which ) const 352OLedState HTC::ledState( OLed which ) const
351{ 353{
352 if ( which == Led_Mail ) 354 if ( which == Led_Mail )
353 return m_leds [0]; 355 return m_leds [0];
354 else 356 else
355 return Led_Off; 357 return Led_Off;
356} 358}
357 359
358bool HTC::setLedState( OLed, OLedState ) 360bool HTC::setLedState( OLed, OLedState )
359{ 361{
360 qDebug( "HTC::setLedState: ODevice handling not yet implemented" ); 362 qDebug( "HTC::setLedState: ODevice handling not yet implemented" );
361 return false; 363 return false;
362} 364}
363 365
364int HTC::displayBrightnessResolution() const 366int HTC::displayBrightnessResolution() const
365{ 367{
366 int res = 1; 368 int res = 1;
367 369
368 int fd = ::open( m_backlightdev + "max_brightness", O_RDONLY|O_NONBLOCK ); 370 int fd = ::open( m_backlightdev + "max_brightness", O_RDONLY|O_NONBLOCK );
369 371
370 if ( fd ) 372 if ( fd )
371 { 373 {
372 char buf[100]; 374 char buf[100];
373 if ( ::read( fd, &buf[0], sizeof buf ) ) ::sscanf( &buf[0], "%d", &res ); 375 if ( ::read( fd, &buf[0], sizeof buf ) ) ::sscanf( &buf[0], "%d", &res );
374 ::close( fd ); 376 ::close( fd );
375 } 377 }
376 378
377 return res; 379 return res;
378} 380}
379 381
380bool HTC::setDisplayBrightness( int bright ) 382bool HTC::setDisplayBrightness( int bright )
381{ 383{
382 384
383 //qDebug( "HTC::setDisplayBrightness( %d )", bright ); 385 //qDebug( "HTC::setDisplayBrightness( %d )", bright );
384 bool res = false; 386 bool res = false;
385 387
386 if ( bright > 255 ) bright = 255; 388 if ( bright > 255 ) bright = 255;
387 if ( bright < 0 ) bright = 0; 389 if ( bright < 0 ) bright = 0;
388 390
389 int numberOfSteps = displayBrightnessResolution(); 391 int numberOfSteps = displayBrightnessResolution();
390 int val = ( bright == 1 ) ? 1 : ( bright * numberOfSteps ) / 255; 392 int val = ( bright == 1 ) ? 1 : ( bright * numberOfSteps ) / 255;
391 393
392 int fd = ::open( m_backlightdev + "brightness", O_WRONLY|O_NONBLOCK ); 394 int fd = ::open( m_backlightdev + "brightness", O_WRONLY|O_NONBLOCK );
393 if ( fd ) 395 if ( fd )
394 { 396 {
395 char buf[100]; 397 char buf[100];
396 int len = ::snprintf( &buf[0], sizeof buf, "%d", val ); 398 int len = ::snprintf( &buf[0], sizeof buf, "%d", val );
397 res = ( ::write( fd, &buf[0], len ) == 0 ); 399 res = ( ::write( fd, &buf[0], len ) == 0 );
398 ::close( fd ); 400 ::close( fd );
399 } 401 }
400 return res; 402 return res;
401} 403}
402 404
403bool HTC::setDisplayStatus( bool on ) 405bool HTC::setDisplayStatus( bool on )
404{ 406{
405 407
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
@@ -287,193 +287,195 @@ void Zaurus::init(const QString& cpu_info)
287} 287}
288 288
289void Zaurus::initButtons() 289void Zaurus::initButtons()
290{ 290{
291 qDebug( "Zaurus::initButtons()" ); 291 qDebug( "Zaurus::initButtons()" );
292 if ( d->m_buttons ) 292 if ( d->m_buttons )
293 return; 293 return;
294 294
295 d->m_buttons = new QValueList <ODeviceButton>; 295 d->m_buttons = new QValueList <ODeviceButton>;
296 296
297 struct z_button * pz_buttons; 297 struct z_button * pz_buttons;
298 int buttoncount; 298 int buttoncount;
299 switch ( d->m_model ) 299 switch ( d->m_model )
300 { 300 {
301 case Model_Zaurus_SL6000: 301 case Model_Zaurus_SL6000:
302 pz_buttons = z_buttons_6000; 302 pz_buttons = z_buttons_6000;
303 buttoncount = ARRAY_SIZE(z_buttons_6000); 303 buttoncount = ARRAY_SIZE(z_buttons_6000);
304 break; 304 break;
305 case Model_Zaurus_SLC3100: // fallthrough 305 case Model_Zaurus_SLC3100: // fallthrough
306 case Model_Zaurus_SLC3000: // fallthrough 306 case Model_Zaurus_SLC3000: // fallthrough
307 case Model_Zaurus_SLC1000: // fallthrough 307 case Model_Zaurus_SLC1000: // fallthrough
308 case Model_Zaurus_SLC7x0: 308 case Model_Zaurus_SLC7x0:
309 if ( isQWS( ) ) 309 if ( isQWS( ) )
310 { 310 {
311 addPreHandler(this); 311 addPreHandler(this);
312 } 312 }
313 pz_buttons = z_buttons_c700; 313 pz_buttons = z_buttons_c700;
314 buttoncount = ARRAY_SIZE(z_buttons_c700); 314 buttoncount = ARRAY_SIZE(z_buttons_c700);
315 break; 315 break;
316 default: 316 default:
317 pz_buttons = z_buttons; 317 pz_buttons = z_buttons;
318 buttoncount = ARRAY_SIZE(z_buttons); 318 buttoncount = ARRAY_SIZE(z_buttons);
319 break; 319 break;
320 } 320 }
321 321
322 for ( int i = 0; i < buttoncount; i++ ) { 322 for ( int i = 0; i < buttoncount; i++ ) {
323 struct z_button *zb = pz_buttons + i; 323 struct z_button *zb = pz_buttons + i;
324 ODeviceButton b; 324 ODeviceButton b;
325 325
326 b.setKeycode( zb->code ); 326 b.setKeycode( zb->code );
327 b.setUserText( QObject::tr( "Button", zb->utext )); 327 b.setUserText( QObject::tr( "Button", zb->utext ));
328 b.setPixmap( OResource::loadPixmap( zb->pix )); 328 b.setPixmap( OResource::loadPixmap( zb->pix ));
329 b.setFactoryPresetPressedAction( OQCopMessage( makeChannel ( zb->fpressedservice ), zb->fpressedaction )); 329 b.setFactoryPresetPressedAction( OQCopMessage( makeChannel ( zb->fpressedservice ), zb->fpressedaction ));
330 b.setFactoryPresetHeldAction( OQCopMessage( makeChannel ( zb->fheldservice ), zb->fheldaction )); 330 b.setFactoryPresetHeldAction( OQCopMessage( makeChannel ( zb->fheldservice ), zb->fheldaction ));
331 d->m_buttons->append( b ); 331 d->m_buttons->append( b );
332 } 332 }
333 333
334 reloadButtonMapping(); 334 reloadButtonMapping();
335} 335}
336 336
337 337
338 338
339typedef struct sharp_led_status { 339typedef struct sharp_led_status {
340 int which; /* select which LED status is wanted. */ 340 int which; /* select which LED status is wanted. */
341 int status; /* set new led status if you call SHARP_LED_SETSTATUS */ 341 int status; /* set new led status if you call SHARP_LED_SETSTATUS */
342} sharp_led_status; 342} sharp_led_status;
343 343
344void Zaurus::buzzer( int sound ) 344void Zaurus::buzzer( int sound )
345{ 345{
346#ifndef QT_NO_SOUND 346#ifndef QT_NO_SOUND
347 Sound *snd = 0; 347 Sound *snd = 0;
348 348
349 // All devices except SL5500 have a DSP device 349 // All devices except SL5500 have a DSP device
350 if ( d->m_model != Model_Zaurus_SL5000 350 if ( d->m_model != Model_Zaurus_SL5000
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
416{ 418{
417 QValueList <OLedState> vl; 419 QValueList <OLedState> vl;
418 420
419 if ( l == Led_Mail ) 421 if ( l == Led_Mail )
420 vl << Led_Off << Led_On << Led_BlinkSlow; 422 vl << Led_Off << Led_On << Led_BlinkSlow;
421 return vl; 423 return vl;
422} 424}
423 425
424OLedState Zaurus::ledState( OLed which ) const 426OLedState Zaurus::ledState( OLed which ) const
425{ 427{
426 if ( which == Led_Mail ) 428 if ( which == Led_Mail )
427 return m_leds [0]; 429 return m_leds [0];
428 else 430 else
429 return Led_Off; 431 return Led_Off;
430} 432}
431 433
432bool Zaurus::setLedState( OLed which, OLedState st ) 434bool Zaurus::setLedState( OLed which, OLedState st )
433{ 435{
434 // Currently not supported on non_embedix kernels 436 // Currently not supported on non_embedix kernels
435 if (!m_embedix) 437 if (!m_embedix)
436 { 438 {
437 qDebug( "Zaurus::setLedState: ODevice handling for non-embedix kernels not yet implemented" ); 439 qDebug( "Zaurus::setLedState: ODevice handling for non-embedix kernels not yet implemented" );
438 return false; 440 return false;
439 } 441 }
440 442
441 static int fd = ::open ( "/dev/sharp_led", O_RDWR|O_NONBLOCK ); 443 static int fd = ::open ( "/dev/sharp_led", O_RDWR|O_NONBLOCK );
442 444
443 if ( which == Led_Mail ) { 445 if ( which == Led_Mail ) {
444 if ( fd >= 0 ) { 446 if ( fd >= 0 ) {
445 struct sharp_led_status leds; 447 struct sharp_led_status leds;
446 ::memset ( &leds, 0, sizeof( leds )); 448 ::memset ( &leds, 0, sizeof( leds ));
447 leds. which = SHARP_LED_MAIL_EXISTS; 449 leds. which = SHARP_LED_MAIL_EXISTS;
448 bool ok = true; 450 bool ok = true;
449 451
450 switch ( st ) { 452 switch ( st ) {
451 case Led_Off : leds. status = LED_MAIL_NO_UNREAD_MAIL; break; 453 case Led_Off : leds. status = LED_MAIL_NO_UNREAD_MAIL; break;
452 case Led_On : leds. status = LED_MAIL_NEWMAIL_EXISTS; break; 454 case Led_On : leds. status = LED_MAIL_NEWMAIL_EXISTS; break;
453 case Led_BlinkSlow: leds. status = LED_MAIL_UNREAD_MAIL_EX; break; 455 case Led_BlinkSlow: leds. status = LED_MAIL_UNREAD_MAIL_EX; break;
454 default : ok = false; 456 default : ok = false;
455 } 457 }
456 458
457 if ( ok && ( ::ioctl ( fd, SHARP_LED_SETSTATUS, &leds ) >= 0 )) { 459 if ( ok && ( ::ioctl ( fd, SHARP_LED_SETSTATUS, &leds ) >= 0 )) {
458 m_leds [0] = st; 460 m_leds [0] = st;
459 return true; 461 return true;
460 } 462 }
461 } 463 }
462 } 464 }
463 return false; 465 return false;
464} 466}
465 467
466int Zaurus::displayBrightnessResolution() const 468int Zaurus::displayBrightnessResolution() const
467{ 469{
468 int res = 1; 470 int res = 1;
469 if (m_embedix) 471 if (m_embedix)
470 { 472 {
471 int fd = ::open( SHARP_FL_IOCTL_DEVICE, O_RDWR|O_NONBLOCK ); 473 int fd = ::open( SHARP_FL_IOCTL_DEVICE, O_RDWR|O_NONBLOCK );
472 if ( fd ) 474 if ( fd )
473 { 475 {
474 int value = ::ioctl( fd, SHARP_FL_IOCTL_GET_STEP, 0 ); 476 int value = ::ioctl( fd, SHARP_FL_IOCTL_GET_STEP, 0 );
475 ::close( fd ); 477 ::close( fd );
476 return value ? value : res; 478 return value ? value : res;
477 } 479 }
478 } 480 }
479 else 481 else