summaryrefslogtreecommitdiff
path: root/libopie2/opiecore/device/odevice_simpad.cpp
Side-by-side diff
Diffstat (limited to 'libopie2/opiecore/device/odevice_simpad.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opiecore/device/odevice_simpad.cpp47
1 files changed, 9 insertions, 38 deletions
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
@@ -229,82 +229,57 @@ OLedState SIMpad::ledState ( OLed l ) const
bool SIMpad::setLedState ( OLed l, OLedState st )
{
#if 0
static int fd = ::open ( SIMPAD_BOARDCONTROL, O_RDWR | O_NONBLOCK );
/*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 * )
{
killTimer ( m_power_timer );
m_power_timer = 0;
QWSServer::sendKeyEvent ( -1, HardKey_Backlight, 0, true, false );
QWSServer::sendKeyEvent ( -1, HardKey_Backlight, 0, false, false );
}
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
{
qDebug( "ODevice for SIMpad: suspend()" );
if ( !isQWS( ) ) // only qwsserver is allowed to suspend
return false;
/*
* we need to save the screen content
@@ -326,32 +301,28 @@ bool SIMpad::suspend() // Must override because SIMpad does NOT have apm
bool SIMpad::setSoftSuspend ( bool soft )
{
qDebug( "ODevice for SIMpad: UNHANDLED setSoftSuspend(%s)", soft? "on" : "off" );
return false;
}
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 );
bool res = false;
int fd;
if ( bright > 255 )
bright = 255;
if ( bright < 1 )