summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opiecore/device/odevice_ipaq.cpp2
-rw-r--r--libopie2/opiecore/device/odevice_ramses.cpp2
-rw-r--r--libopie2/opiecore/device/odevice_simpad.cpp2
-rw-r--r--libopie2/opiecore/device/odevice_zaurus.cpp4
4 files changed, 8 insertions, 2 deletions
diff --git a/libopie2/opiecore/device/odevice_ipaq.cpp b/libopie2/opiecore/device/odevice_ipaq.cpp
index 7f5aa7b..6193ddc 100644
--- a/libopie2/opiecore/device/odevice_ipaq.cpp
+++ b/libopie2/opiecore/device/odevice_ipaq.cpp
@@ -286,96 +286,98 @@ bool iPAQ::filter ( int /*unicode*/, int keycode, int modifiers, bool isPress, b
// keycode - Key_Left = position of the button starting from left clockwise
// add the rotation to it and modolo. No we've the original offset
// add the offset to the Key_Left key
if ( d-> m_model == Model_iPAQ_H5xxx )
newkeycode = Key_Left + ( keycode - Key_Left + 3 ) % 4;
break;
}
// map Power Button short/long press to F34/F35
case Key_SysReq: {
if ( isPress ) {
if ( m_power_timer )
killTimer ( m_power_timer );
m_power_timer = startTimer ( 500 );
}
else if ( m_power_timer ) {
killTimer ( m_power_timer );
m_power_timer = 0;
QWSServer::sendKeyEvent ( -1, HardKey_Suspend, 0, true, false );
QWSServer::sendKeyEvent ( -1, HardKey_Suspend, 0, false, false );
}
newkeycode = Key_unknown;
break;
}
}
if ( newkeycode != keycode ) {
if ( newkeycode != Key_unknown )
QWSServer::sendKeyEvent ( -1, newkeycode, modifiers, isPress, autoRepeat );
return true;
}
else
return false;
}
void iPAQ::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 iPAQ::playAlarmSound()
{
#ifndef QT_NO_SOUND
static Sound snd ( "alarm" );
+ if(!snd.isFinished())
+ return;
changeMixerForAlarm(0, "/dev/sound/mixer", &snd );
snd. play();
#endif
}
bool iPAQ::setSoftSuspend ( bool soft )
{
bool res = false;
int fd;
if (( fd = ::open ( "/proc/sys/ts/suspend_button_mode", O_WRONLY )) >= 0 ) {
if ( ::write ( fd, soft ? "1" : "0", 1 ) == 1 )
res = true;
else
::perror ( "write to /proc/sys/ts/suspend_button_mode" );
::close ( fd );
}
else
::perror ( "/proc/sys/ts/suspend_button_mode" );
return res;
}
bool iPAQ::setDisplayBrightness ( int bright )
{
bool res = false;
int fd;
if ( bright > 255 )
bright = 255;
if ( bright < 0 )
bright = 0;
if (( fd = ::open ( "/dev/touchscreen/0", O_WRONLY )) >= 0 ) {
FLITE_IN bl;
bl. mode = 1;
bl. pwr = bright ? 1 : 0;
bl. brightness = ( bright * ( displayBrightnessResolution() - 1 ) + 127 ) / 255;
res = ( ::ioctl ( fd, FLITE_ON, &bl ) == 0 );
::close ( fd );
}
return res;
}
diff --git a/libopie2/opiecore/device/odevice_ramses.cpp b/libopie2/opiecore/device/odevice_ramses.cpp
index 0cddf85..c75ea3a 100644
--- a/libopie2/opiecore/device/odevice_ramses.cpp
+++ b/libopie2/opiecore/device/odevice_ramses.cpp
@@ -54,96 +54,98 @@
#endif
using namespace Opie::Core;
using namespace Opie::Core::Internal;
void Ramses::init(const QString&)
{
d->m_vendorstr = "M und N";
d->m_vendor = Vendor_MundN;
// with old Prototype-LCD, /proc/sys/board/lcd_type = 1
//d->m_modelstr = "Ramses";
//d->m_model = Model_Ramses_MNCI;
//d->m_rotation = Rot0;
// all current Hardware, with /proc/sys/board/lcd_type = 2
d->m_modelstr = "MNCIRX";
d->m_model = Model_Ramses_MNCIRX;
d->m_rotation = Rot90;
d->m_holdtime = 500;
// This table is true for a Intel XScale PXA 255
#ifdef QT_QWS_ALLOW_OVERCLOCK
#define OC(x...) x
#else
#define OC(x...)
#endif
d->m_cpu_frequencies->append("99000"); // mem= 99, run= 99, turbo= 99, PXbus= 50
OC(d->m_cpu_frequencies->append("118000"); ) // mem=118, run=118, turbo=118, PXbus= 59 OC'd mem
d->m_cpu_frequencies->append("199100"); // mem= 99, run=199, turbo=199, PXbus= 99
OC(d->m_cpu_frequencies->append("236000"); ) // mem=118, run=236, turbo=236, PXbus=118 OC'd mem
d->m_cpu_frequencies->append("298600"); // mem= 99, run=199, turbo=298, PXbus= 99
OC(d->m_cpu_frequencies->append("354000"); ) // mem=118, run=236, turbo=354, PXbus=118 OC'd mem
d->m_cpu_frequencies->append("398099"); // mem= 99, run=199, turbo=398, PXbus= 99
d->m_cpu_frequencies->append("398100"); // mem= 99, run=398, turbo=398, PXbus=196
OC(d->m_cpu_frequencies->append("471000"); ) // mem=118, run=471, turbo=471, PXbus=236 OC'd mem/core/bus
}
void Ramses::playAlarmSound()
{
#ifndef QT_NO_SOUND
static Sound snd ( "alarm" );
+ if(!snd.isFinished())
+ return;
changeMixerForAlarm( 0, "/dev/sound/mixer" , &snd);
snd.play();
#else
#error QT_NO_SOUND defined
#endif
}
bool Ramses::suspend()
{
if ( !isQWS( ) ) // only qwsserver is allowed to suspend
return false;
sendSuspendmsg();
::sync();
int fd;
if ((fd = ::open("/proc/sys/pm/suspend", O_WRONLY)) >= 0) {
char writeCommand[] = "1\n";
::write(fd, writeCommand, sizeof(writeCommand) );
::close(fd);
}
::usleep ( 200 * 1000 );
return true;
}
bool Ramses::setDisplayBrightness(int bright)
{
//qDebug("Ramses::setDisplayBrightness(%d)", bright);
bool res = false;
int fd;
// pwm1 brighness: 20 steps 500..0 (dunkel->hell)
if (bright > 255 )
bright = 255;
if (bright < 0)
bright = 0;
// Turn backlight completely off if brightness=0
if ((fd = ::open("/proc/sys/board/lcd_backlight", O_WRONLY)) >= 0) {
char writeCommand[10];
const int count = sprintf(writeCommand, "%d\n", bright ? 1 : 0);
res = (::write(fd, writeCommand, count) != -1);
::close(fd);
diff --git a/libopie2/opiecore/device/odevice_simpad.cpp b/libopie2/opiecore/device/odevice_simpad.cpp
index fd46b95..34876da 100644
--- a/libopie2/opiecore/device/odevice_simpad.cpp
+++ b/libopie2/opiecore/device/odevice_simpad.cpp
@@ -274,96 +274,98 @@ QValueList <OLedState> SIMpad::ledStateList ( OLed l ) const
//else if ( l == Led_Mail ) //TODO find out if LED1 is accessible anyway
//vl << Led_Off;
return vl;
}
OLedState SIMpad::ledState ( OLed l ) const
{
switch ( l ) {
case Led_Power:
return m_leds [0];
//case Led_Mail:
// return m_leds [1];
default:
return Led_Off;
}
}
bool SIMpad::setLedState ( OLed l, OLedState st )
{
if ( l == Led_Power ) {
m_leds [0] = st;
setCS3Bit(st == Led_On, SIMPAD_LED2_ON);
return true;
}
return false;
}
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" );
+ if(!snd.isFinished())
+ return;
/* save as the Sound is static! */
changeMixerForAlarm( 0, "/dev/sound/mixer" , &snd);
snd. play();
#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
* then go to suspend using ODevice::suspend
* and finally restore the screen content
*/
(void)::system( "cat /dev/fb/0 > /tmp/.buffer" );
bool res = ODevice::suspend();
/*
* restore
*/
if ( res )
::system( "cat /tmp/.buffer > /dev/fb/0" );
return res;
}
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" );
return setCS3Bit(on, SIMPAD_DISPLAY_ON);
}
bool SIMpad::setDisplayBrightness ( int bright )
diff --git a/libopie2/opiecore/device/odevice_zaurus.cpp b/libopie2/opiecore/device/odevice_zaurus.cpp
index 64fa199..733479e 100644
--- a/libopie2/opiecore/device/odevice_zaurus.cpp
+++ b/libopie2/opiecore/device/odevice_zaurus.cpp
@@ -300,100 +300,100 @@ int status; /* set new led status if you call SHARP_LED_SETSTATUS */
#define SHARP_LED_MAIL_EXISTS 9 /* mail status (exists or not) */
#define LED_MAIL_NO_UNREAD_MAIL 0 /* for SHARP_LED_MAIL_EXISTS */
#define LED_MAIL_NEWMAIL_EXISTS 1 /* for SHARP_LED_MAIL_EXISTS */
#define LED_MAIL_UNREAD_MAIL_EX 2 /* for SHARP_LED_MAIL_EXISTS */
// #include <asm/sharp_apm.h> // including kernel headers is evil ...
#define APM_IOCGEVTSRC OD_IOR( 'A', 203, int )
#define APM_IOCSEVTSRC OD_IORW( 'A', 204, int )
#define APM_EVT_POWER_BUTTON (1 << 0)
#define FL_IOCTL_STEP_CONTRAST 100
void Zaurus::buzzer ( int sound )
{
#ifndef QT_NO_SOUND
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_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 ){
+ if ( snd && snd->isFinished() ){
changeMixerForAlarm( 0, "/dev/sound/mixer", snd );
snd-> play();
- } else {
+ } else if( !snd ) {
int fd = ::open ( "/dev/sharp_buz", O_WRONLY|O_NONBLOCK );
if ( fd >= 0 ) {
::ioctl ( fd, SHARP_BUZZER_MAKESOUND, sound );
::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
{
QValueList <OLedState> vl;
if ( l == Led_Mail )
vl << Led_Off << Led_On << Led_BlinkSlow;
return vl;
}
OLedState Zaurus::ledState ( OLed which ) const
{
if ( which == Led_Mail )
return m_leds [0];