summaryrefslogtreecommitdiff
path: root/libopie2
authorzecke <zecke>2004-08-25 21:51:13 (UTC)
committer zecke <zecke>2004-08-25 21:51:13 (UTC)
commitdf3e4c8b13c16aeb96e70dbaa2d409f83eed988e (patch) (side-by-side diff)
tree59b12028c6e8a53b99f1686278b6e9fdc57ab18e /libopie2
parente4811064703ad34f42f15c3044cd8f63c0e7583c (diff)
downloadopie-df3e4c8b13c16aeb96e70dbaa2d409f83eed988e.zip
opie-df3e4c8b13c16aeb96e70dbaa2d409f83eed988e.tar.gz
opie-df3e4c8b13c16aeb96e70dbaa2d409f83eed988e.tar.bz2
-Have a common implementation for reading the config value
and setting the Mixer. The mixer, sound and path is configurable -Restore the Opie HEADER (who is guilty? probably me) -Fix warnings -Port Zaurus,Simpad,Ipaq to configure the mixer
Diffstat (limited to 'libopie2') (more/less context) (show whitespace changes)
-rw-r--r--libopie2/opiecore/device/odevice.cpp57
-rw-r--r--libopie2/opiecore/device/odevice.h53
-rw-r--r--libopie2/opiecore/device/odevice_ipaq.cpp71
-rw-r--r--libopie2/opiecore/device/odevice_simpad.cpp47
-rw-r--r--libopie2/opiecore/device/odevice_simpad.h2
-rw-r--r--libopie2/opiecore/device/odevice_yopy.cpp2
-rw-r--r--libopie2/opiecore/device/odevice_zaurus.cpp99
7 files changed, 157 insertions, 174 deletions
diff --git a/libopie2/opiecore/device/odevice.cpp b/libopie2/opiecore/device/odevice.cpp
index b58f9eb..26c6dca 100644
--- a/libopie2/opiecore/device/odevice.cpp
+++ b/libopie2/opiecore/device/odevice.cpp
@@ -42,12 +42,13 @@
/* OPIE */
#include <qpe/config.h>
#include <qpe/resource.h>
#include <qpe/sound.h>
#include <qpe/qcopenvelope_qws.h>
+#include <qpe/sound.h>
#include <opie2/okeyfilter.h>
/* STD */
#include <fcntl.h>
#include <math.h>
#include <stdlib.h>
@@ -168,12 +169,16 @@ ODevice::ODevice()
d->m_direction = CW;
d->m_holdtime = 1000; // 1000ms
d->m_buttons = 0;
d->m_cpu_frequencies = new QStrList;
+
+ /* mixer */
+ d->m_sound = d->m_vol = d->m_mixer = -1;
+
// New distribution detection code first checks for legacy distributions,
// identified by /etc/familiar-version or /etc/oz_version.
// Then check for OpenEmbedded and lastly, read /etc/issue
for ( unsigned int i = 0; i < sizeof distributions; ++i )
{
@@ -702,27 +707,79 @@ void ODevice::remapHeldAction ( int button, const OQCopMessage &action )
QCopEnvelope ( "QPE/System", "deviceButtonMappingChanged()" );
}
void ODevice::virtual_hook(int, void* ){
}
+/**
+ * Sends a QCOP message to channel QPE/System
+ * with the message "aboutToSuspend()" if this
+ * is the windowing server
+ */
void ODevice::sendSuspendmsg()
{
if ( isQWS() )
return;
QCopEnvelope ( "QPE/System", "aboutToSuspend()" );
}
+/**
+ * \brief Prepend the QWSServer::KeyboardFilter to the list of installed KeyFilters
+ *
+ * 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);
}
+void ODevice::playingStopped() {
+ const_cast<QObject*>(sender())->disconnect( this );
+ if ( d->m_sound >= 0 ) {
+ ::ioctl ( d->m_sound, MIXER_WRITE( d->m_mixer ), &d->m_vol );
+ ::close ( d->m_sound );
+ }
+}
+
+void ODevice::changeMixerForAlarm( int mixer, const char* file, Sound *snd ) {
+ if (( d->m_sound = ::open ( file, O_RDWR )) >= 0 ) {
+ if ( ::ioctl ( d->m_sound, MIXER_READ( mixer ), &d->m_vol ) >= 0 ) {
+ Config cfg ( "qpe" );
+ cfg. setGroup ( "Volume" );
+
+ int volalarm = cfg. readNumEntry ( "AlarmPercent", 50 );
+ if ( volalarm < 0 )
+ volalarm = 0;
+ else if ( volalarm > 100 )
+ volalarm = 100;
+ volalarm |= ( volalarm << 8 );
+
+ if ( ::ioctl ( d->m_sound, MIXER_WRITE( mixer ), &volalarm ) >= 0 )
+ register_qpe_sound_finished(snd, this, SLOT(playingStopped()));
+ }
+ d->m_mixer = mixer;
+ }
+}
}
}
diff --git a/libopie2/opiecore/device/odevice.h b/libopie2/opiecore/device/odevice.h
index cb7a83f..f4b3e0e 100644
--- a/libopie2/opiecore/device/odevice.h
+++ b/libopie2/opiecore/device/odevice.h
@@ -1,30 +1,30 @@
/*
- This file is part of the Opie Project
- Copyright (C) The Opie Team <opie-devel@handhelds.org>
+                 This file is part of the Opie Project
+              Copyright (C) The Opie Team <opie-devel@handhelds.org>
=.
.=l.
- .>+-=
-_;:, .> :=|. This program is free software; you can
-.> <`_, > . <= redistribute it and/or modify it under
-:`=1 )Y*s>-.-- : the terms of the GNU Library General Public
-.="- .-=="i, .._ License as published by the Free Software
-- . .-<_> .<> Foundation; either version 2 of the License,
- ._= =} : or (at your option) any later version.
- .%`+i> _;_.
- .i_,=:_. -<s. This program is distributed in the hope that
- + . -:. = it will be useful, but WITHOUT ANY WARRANTY;
- : .. .:, . . . without even the implied warranty of
- =_ + =;=|` MERCHANTABILITY or FITNESS FOR A
- _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU
-..}^=.= = ; Library General Public License for more
-++= -. .` .: details.
-: = ...= . :.=-
--. .:....=;==+<; You should have received a copy of the GNU
- -_. . . )=. = Library General Public License along with
- -- :-=` this library; see the file COPYING.LIB.
+           .>+-=
+ _;:,     .>    :=|. This program is free software; you can
+.> <`_,   >  .   <= redistribute it and/or modify it under
+:`=1 )Y*s>-.--   : the terms of the GNU Library General Public
+.="- .-=="i,     .._ License as published by the Free Software
+ - .   .-<_>     .<> Foundation; either version 2 of the License,
+     ._= =}       : or (at your option) any later version.
+    .%`+i>       _;_.
+    .i_,=:_.      -<s. This program is distributed in the hope that
+     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
+    : ..    .:,     . . . without even the implied warranty of
+    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
+  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
+..}^=.=       =       ; Library General Public License for more
+++=   -.     .`     .: details.
+ :     =  ...= . :.=-
+ -.   .:....=;==+<; You should have received a copy of the GNU
+  -_. . .   )=.  = Library General Public License along with
+    --        :-=` this library; see the file COPYING.LIB.
If not, write to the Free Software Foundation,
Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#ifndef ODEVICE_H_
@@ -35,15 +35,20 @@ _;:, .> :=|. This program is free software; you can
#include <qpe/qpeapplication.h> /* for Transformation enum.. */
/* QT */
#include <qnamespace.h>
#include <qobject.h>
#include <qstring.h>
+
+
#include <qstrlist.h>
#include <qwindowsystem_qws.h>
+
+class Sound;
+
namespace Opie{
namespace Core{
class ODeviceData;
/**
* The available devices
@@ -316,17 +321,20 @@ public:
signals:
void buttonMappingChanged();
private slots:
void systemMessage ( const QCString &, const QByteArray & );
+ void playingStopped();
protected:
void addPreHandler(QWSServer::KeyboardFilter*aFilter);
void remPreHandler(QWSServer::KeyboardFilter*aFilter);
void reloadButtonMapping();
+ void changeMixerForAlarm( int mixer, const char* file, Sound *snd);
+
/* ugly virtual hook */
virtual void virtual_hook( int id, void* data );
};
class ODeviceData {
@@ -345,12 +353,15 @@ class ODeviceData {
Transformation m_rotation;
ODirection m_direction;
QValueList <ODeviceButton> *m_buttons;
uint m_holdtime;
QStrList *m_cpu_frequencies;
+
+ /* values for changeMixerForAlarm */
+ int m_sound, m_vol, m_mixer;
};
extern bool isQWS();
extern QCString makeChannel ( const char *str );
}
}
diff --git a/libopie2/opiecore/device/odevice_ipaq.cpp b/libopie2/opiecore/device/odevice_ipaq.cpp
index 21fed99..7f5aa7b 100644
--- a/libopie2/opiecore/device/odevice_ipaq.cpp
+++ b/libopie2/opiecore/device/odevice_ipaq.cpp
@@ -1,30 +1,30 @@
/*
- This file is part of the Opie Project
- Copyright (C) The Opie Team <opie-devel@handhelds.org>
+                 This file is part of the Opie Project
+              Copyright (C) 2002,2003,2004 The Opie Team <opie-devel@handhelds.org>
=.
.=l.
- .>+-=
-_;:, .> :=|. This program is free software; you can
-.> <`_, > . <= redistribute it and/or modify it under
-:`=1 )Y*s>-.-- : the terms of the GNU Library General Public
-.="- .-=="i, .._ License as published by the Free Software
-- . .-<_> .<> Foundation; either version 2 of the License,
- ._= =} : or (at your option) any later version.
- .%`+i> _;_.
- .i_,=:_. -<s. This program is distributed in the hope that
- + . -:. = it will be useful, but WITHOUT ANY WARRANTY;
- : .. .:, . . . without even the implied warranty of
- =_ + =;=|` MERCHANTABILITY or FITNESS FOR A
- _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU
-..}^=.= = ; Library General Public License for more
-++= -. .` .: details.
-: = ...= . :.=-
--. .:....=;==+<; You should have received a copy of the GNU
- -_. . . )=. = Library General Public License along with
- -- :-=` this library; see the file COPYING.LIB.
+           .>+-=
+ _;:,     .>    :=|. This program is free software; you can
+.> <`_,   >  .   <= redistribute it and/or modify it under
+:`=1 )Y*s>-.--   : the terms of the GNU Library General Public
+.="- .-=="i,     .._ License as published by the Free Software
+ - .   .-<_>     .<> Foundation; either version 2 of the License,
+     ._= =}       : or (at your option) any later version.
+    .%`+i>       _;_.
+    .i_,=:_.      -<s. This program is distributed in the hope that
+     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
+    : ..    .:,     . . . without even the implied warranty of
+    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
+  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
+..}^=.=       =       ; Library General Public License for more
+++=   -.     .`     .: details.
+ :     =  ...= . :.=-
+ -.   .:....=;==+<; You should have received a copy of the GNU
+  -_. . .   )=.  = Library General Public License along with
+    --        :-=` this library; see the file COPYING.LIB.
If not, write to the Free Software Foundation,
Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#include "odevice_ipaq.h"
@@ -328,42 +328,15 @@ void iPAQ::timerEvent ( QTimerEvent * )
void iPAQ::playAlarmSound()
{
#ifndef QT_NO_SOUND
static Sound snd ( "alarm" );
- int fd;
- int vol;
- bool vol_reset = false;
-
- if (( fd = ::open ( "/dev/sound/mixer", O_RDWR )) >= 0 ) {
- if ( ::ioctl ( fd, MIXER_READ( 0 ), &vol ) >= 0 ) {
- Config cfg ( "qpe" );
- cfg. setGroup ( "Volume" );
-
- int volalarm = cfg. readNumEntry ( "AlarmPercent", 50 );
- if ( volalarm < 0 )
- volalarm = 0;
- else if ( volalarm > 100 )
- volalarm = 100;
- volalarm |= ( volalarm << 8 );
-
- if ( ::ioctl ( fd, MIXER_WRITE( 0 ), &volalarm ) >= 0 )
- vol_reset = true;
- }
- }
+ changeMixerForAlarm(0, "/dev/sound/mixer", &snd );
snd. play();
- while ( !snd. isFinished())
- qApp->processEvents();
-
- if ( fd >= 0 ) {
- if ( vol_reset )
- ::ioctl ( fd, MIXER_WRITE( 0 ), &vol );
- ::close ( fd );
- }
#endif
}
bool iPAQ::setSoftSuspend ( bool soft )
{
diff --git a/libopie2/opiecore/device/odevice_simpad.cpp b/libopie2/opiecore/device/odevice_simpad.cpp
index c6de614..2d0160d 100644
--- a/libopie2/opiecore/device/odevice_simpad.cpp
+++ b/libopie2/opiecore/device/odevice_simpad.cpp
@@ -235,22 +235,23 @@ bool SIMpad::setLedState ( OLed l, OLedState st )
/*TODO Implement this like that:
read from cs3
&& with SIMPAD_LED2_ON
write to cs3 */
m_leds [0] = st;
return true;
- }
- }
- }
-
+ // }
+// }
+#else
+ Q_UNUSED( l )
+ Q_UNUSED( st )
#endif
return false;
}
-bool SIMpad::filter ( int /*unicode*/, int keycode, int modifiers, bool isPress, bool autoRepeat )
+bool SIMpad::filter ( int /*unicode*/, int /*keycode*/, int /*modifiers*/, bool /*isPress*/, bool /*autoRepeat*/ )
{
//TODO
return false;
}
void SIMpad::timerEvent ( QTimerEvent * )
@@ -263,42 +264,16 @@ void SIMpad::timerEvent ( QTimerEvent * )
void SIMpad::playAlarmSound()
{
#ifndef QT_NO_SOUND
static Sound snd ( "alarm" );
- int fd;
- int vol;
- bool vol_reset = false;
-
- if (( fd = ::open ( "/dev/sound/mixer", O_RDWR )) >= 0 ) {
- if ( ::ioctl ( fd, MIXER_READ( 0 ), &vol ) >= 0 ) {
- Config cfg ( "qpe" );
- cfg. setGroup ( "Volume" );
-
- int volalarm = cfg. readNumEntry ( "AlarmPercent", 50 );
- if ( volalarm < 0 )
- volalarm = 0;
- else if ( volalarm > 100 )
- volalarm = 100;
- volalarm |= ( volalarm << 8 );
-
- if ( ::ioctl ( fd, MIXER_WRITE( 0 ), &volalarm ) >= 0 )
- vol_reset = true;
- }
- }
+ /* save as the Sound is static! */
+ changeMixerForAlarm( 0, "/dev/sound/mixer" , &snd);
snd. play();
- while ( !snd. isFinished())
- qApp->processEvents();
-
- if ( fd >= 0 ) {
- if ( vol_reset )
- ::ioctl ( fd, MIXER_WRITE( 0 ), &vol );
- ::close ( fd );
- }
#endif
}
bool SIMpad::suspend() // Must override because SIMpad does NOT have apm
{
@@ -332,20 +307,16 @@ bool SIMpad::setSoftSuspend ( bool soft )
bool SIMpad::setDisplayStatus ( bool on )
{
qDebug( "ODevice for SIMpad: setDisplayStatus(%s)", on? "on" : "off" );
- bool res = false;
- int fd;
QString cmdline = QString().sprintf( "echo %s > /proc/cs3", on ? "0xd41a" : "0xd40a" ); //TODO make better :)
- res = ( ::system( (const char*) cmdline ) == 0 );
-
- return res;
+ return ( ::system( (const char*) cmdline ) == 0 );
}
bool SIMpad::setDisplayBrightness ( int bright )
{
qDebug( "ODevice for SIMpad: setDisplayBrightness( %d )", bright );
diff --git a/libopie2/opiecore/device/odevice_simpad.h b/libopie2/opiecore/device/odevice_simpad.h
index d9ae5a5..6c42be7 100644
--- a/libopie2/opiecore/device/odevice_simpad.h
+++ b/libopie2/opiecore/device/odevice_simpad.h
@@ -1,9 +1,9 @@
/*
                This file is part of the Opie Project
-              Copyright (C) The Opie Team <opie-devel@handhelds.org>
+              Copyright (C) 2003, 2004 The Opie Team <opie-devel@handhelds.org>
=.
.=l.
           .>+-=
 _;:,     .>    :=|. This program is free software; you can
.> <`_,   >  .   <= redistribute it and/or modify it under
:`=1 )Y*s>-.--   : the terms of the GNU Library General Public
diff --git a/libopie2/opiecore/device/odevice_yopy.cpp b/libopie2/opiecore/device/odevice_yopy.cpp
index 223aa76..a06d7ec 100644
--- a/libopie2/opiecore/device/odevice_yopy.cpp
+++ b/libopie2/opiecore/device/odevice_yopy.cpp
@@ -140,12 +140,14 @@ bool Yopy::setDisplayBrightness( int bright )
else
::write( fd, "0\n", 2 );
::close( fd );
return true;
}
}
+#else
+ Q_UNUSED( bright )
#endif
return false;
}
int Yopy::displayBrightnessResolution() const
diff --git a/libopie2/opiecore/device/odevice_zaurus.cpp b/libopie2/opiecore/device/odevice_zaurus.cpp
index 47682bb..127fee9 100644
--- a/libopie2/opiecore/device/odevice_zaurus.cpp
+++ b/libopie2/opiecore/device/odevice_zaurus.cpp
@@ -1,30 +1,30 @@
/*
- This file is part of the Opie Project
- Copyright (C) The Opie Team <opie-devel@handhelds.org>
+                 This file is part of the Opie Project
+              Copyright (C) The Opie Team <opie-devel@handhelds.org>
=.
.=l.
- .>+-=
-_;:, .> :=|. This program is free software; you can
-.> <`_, > . <= redistribute it and/or modify it under
-:`=1 )Y*s>-.-- : the terms of the GNU Library General Public
-.="- .-=="i, .._ License as published by the Free Software
-- . .-<_> .<> Foundation; either version 2 of the License,
- ._= =} : or (at your option) any later version.
- .%`+i> _;_.
- .i_,=:_. -<s. This program is distributed in the hope that
- + . -:. = it will be useful, but WITHOUT ANY WARRANTY;
- : .. .:, . . . without even the implied warranty of
- =_ + =;=|` MERCHANTABILITY or FITNESS FOR A
- _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU
-..}^=.= = ; Library General Public License for more
-++= -. .` .: details.
-: = ...= . :.=-
--. .:....=;==+<; You should have received a copy of the GNU
- -_. . . )=. = Library General Public License along with
- -- :-=` this library; see the file COPYING.LIB.
+           .>+-=
+ _;:,     .>    :=|. This program is free software; you can
+.> <`_,   >  .   <= redistribute it and/or modify it under
+:`=1 )Y*s>-.--   : the terms of the GNU Library General Public
+.="- .-=="i,     .._ License as published by the Free Software
+ - .   .-<_>     .<> Foundation; either version 2 of the License,
+     ._= =}       : or (at your option) any later version.
+    .%`+i>       _;_.
+    .i_,=:_.      -<s. This program is distributed in the hope that
+     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
+    : ..    .:,     . . . without even the implied warranty of
+    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
+  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
+..}^=.=       =       ; Library General Public License for more
+++=   -.     .`     .: details.
+ :     =  ...= . :.=-
+ -.   .:....=;==+<; You should have received a copy of the GNU
+  -_. . .   )=.  = Library General Public License along with
+    --        :-=` this library; see the file COPYING.LIB.
If not, write to the Free Software Foundation,
Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#include "odevice_zaurus.h"
@@ -180,14 +180,12 @@ void Zaurus::init(const QString& cpu_info)
} else {
d->m_model = Model_Zaurus_SL5500;
d->m_modelstr = "Unkown Zaurus";
}
// set initial rotation
-
- bool flipstate = false;
switch ( d->m_model ) {
case Model_Zaurus_SL6000:
case Model_Zaurus_SLA300:
d->m_rotation = Rot0;
break;
case Model_Zaurus_SLC7x0:
@@ -315,70 +313,41 @@ int status; /* set new led status if you call SHARP_LED_SETSTATUS */
#define FL_IOCTL_STEP_CONTRAST 100
void Zaurus::buzzer ( int sound )
{
#ifndef QT_NO_SOUND
- QString soundname;
+ Sound *snd = 0;
// Not all devices have real sound
if ( d->m_model == Model_Zaurus_SLC7x0
|| d->m_model == Model_Zaurus_SLB600 ){
switch ( sound ){
- case SHARP_BUZ_SCHEDULE_ALARM:
- soundname = "alarm";
- break;
case SHARP_BUZ_TOUCHSOUND:
- soundname = "touchsound";
+ static Sound touch_sound("touchsound");
+ snd = &touch_sound;
break;
case SHARP_BUZ_KEYSOUND:
- soundname = "keysound";
+ static Sound key_sound( "keysound" );
+ snd = &key_sound;
break;
+ case SHARP_BUZ_SCHEDULE_ALARM:
default:
- soundname = "alarm";
-
+ 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 ( !soundname.isEmpty() ){
- int fd;
- int vol;
- bool vol_reset = false;
-
- Sound snd ( soundname );
-
- if (( fd = ::open ( "/dev/sound/mixer", O_RDWR )) >= 0 ) {
- if ( ::ioctl ( fd, MIXER_READ( 0 ), &vol ) >= 0 ) {
- Config cfg ( "qpe" );
- cfg. setGroup ( "Volume" );
-
- int volalarm = cfg. readNumEntry ( "AlarmPercent", 50 );
- if ( volalarm < 0 )
- volalarm = 0;
- else if ( volalarm > 100 )
- volalarm = 100;
- volalarm |= ( volalarm << 8 );
-
- if ( ::ioctl ( fd, MIXER_WRITE( 0 ), &volalarm ) >= 0 )
- vol_reset = true;
- }
- }
-
- snd. play();
- while ( !snd. isFinished())
- qApp->processEvents();
-
- if ( fd >= 0 ) {
- if ( vol_reset )
- ::ioctl ( fd, MIXER_WRITE( 0 ), &vol );
- ::close ( fd );
- }
+ if ( snd ){
+ changeMixerForAlarm( 0, "/dev/sound/mixer", snd );
+ snd-> play();
} else {
int fd = ::open ( "/dev/sharp_buz", O_WRONLY|O_NONBLOCK );
if ( fd >= 0 ) {
::ioctl ( fd, SHARP_BUZZER_MAKESOUND, sound );
::close ( fd );
@@ -511,13 +480,13 @@ bool Zaurus::setDisplayBrightness ( int bright )
if ( d->m_model == Model_Zaurus_SLC7x0 )
{
//qDebug( "using special treatment for devices with the corgi backlight interface" );
// special treatment for devices with the corgi backlight interface
if (( fd = ::open ( "/proc/driver/fl/corgi-bl", O_WRONLY )) >= 0 )
{
- int value = ( bright == 1 ) ? 1 : bright * ( 17.0 / 255.0 );
+ int value = ( bright == 1 ) ? 1 : static_cast<int>( bright * ( 17.0 / 255.0 ) );
char writeCommand[100];
const int count = sprintf( writeCommand, "0x%x\n", value );
res = ( ::write ( fd, writeCommand, count ) != -1 );
::close ( fd );
}
return res;