summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--libopie/odevice.cpp77
1 files changed, 26 insertions, 51 deletions
diff --git a/libopie/odevice.cpp b/libopie/odevice.cpp
index 993aedf..62dc9d4 100644
--- a/libopie/odevice.cpp
+++ b/libopie/odevice.cpp
@@ -900,49 +900,50 @@ void ODevice::remapPressedAction ( int button, const OQCopMessage &action )
QCopEnvelope ( "QPE/System", "deviceButtonMappingChanged()" );
}
void ODevice::remapHeldAction ( int button, const OQCopMessage &action )
{
initButtons ( );
if ( button >= (int) d-> m_buttons-> count ( ))
return;
ODeviceButton &b = ( *d-> m_buttons ) [button];
b. setHeldAction ( action );
Config buttonFile ( "ButtonSettings" );
buttonFile. setGroup ( "Button" + QString::number ( button ));
buttonFile. writeEntry ( "HeldActionChannel", (const char *) b. heldAction ( ). channel ( ));
buttonFile. writeEntry ( "HeldActionMessage", (const char *) b. heldAction ( ). message ( ));
// buttonFile. writeEntry ( "HeldActionArgs", decodeBase64 ( b. heldAction ( ). data ( )));
QCopEnvelope ( "QPE/System", "deviceButtonMappingChanged()" );
}
void ODevice::virtual_hook( int id, void* data ) {
-
+ Q_UNUSED(id);
+ Q_UNUSED(data);
}
/**************************************************
*
* iPAQ
*
**************************************************/
void iPAQ::init ( )
{
d-> m_vendorstr = "HP";
d-> m_vendor = Vendor_HP;
QFile f ( "/proc/hal/model" );
if ( f. open ( IO_ReadOnly )) {
QTextStream ts ( &f );
d-> m_modelstr = "H" + ts. readLine ( );
if ( d-> m_modelstr == "H3100" )
d-> m_model = Model_iPAQ_H31xx;
@@ -1952,49 +1953,50 @@ int SIMpad::displayBrightnessResolution ( ) const
case Model_SIMpad_TSinus:
return 255; //TODO find out if this is save
default:
return 2;
}
}
/**************************************************
*
* Ramses
*
**************************************************/
void Ramses::init()
{
d->m_vendorstr = "M und N";
d->m_vendor = Vendor_MundN;
QFile f("/proc/sys/board/ramses");
d->m_modelstr = "Ramses";
d->m_model = Model_Ramses_MNCI;
- d->m_rotation = Rot0;
+ d->m_rotation = Rot180;
+ d->m_direction = CW;
d->m_holdtime = 1000;
f.setName("/etc/oz_version");
if (f.open(IO_ReadOnly)) {
d->m_systemstr = "OpenEmbedded/Ramses";
d->m_system = System_OpenZaurus;
QTextStream ts(&f);
ts.setDevice(&f);
d->m_sysverstr = ts.readLine();
f.close();
}
m_power_timer = 0;
#ifdef QT_QWS_ALLOW_OVERCLOCK
#warning *** Overclocking enabled - this may fry your hardware - you have been warned ***
#define OC(x...) x
#else
#define OC(x...)
#endif
@@ -2011,158 +2013,131 @@ OC( d->m_cpu_frequencies->append("354000"); ) // mem=118, run=236, turbo=354,
OC( d->m_cpu_frequencies->append("471000"); ) // mem=118, run=471, turbo=471, PXbus=236 OC'd mem/core/bus
}
bool Ramses::filter(int /*unicode*/, int keycode, int modifiers, bool isPress, bool autoRepeat)
{
Q_UNUSED( keycode );
Q_UNUSED( modifiers );
Q_UNUSED( isPress );
Q_UNUSED( autoRepeat );
return false;
}
void Ramses::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);
}
bool Ramses::setSoftSuspend(bool soft)
{
- qDebug("Ramses::setSoftSuspend(%d)", soft);
-#if 0
- bool res = false;
- int fd;
-
- if (((fd = ::open("/dev/apm_bios", O_RDWR)) >= 0) ||
- ((fd = ::open("/dev/misc/apm_bios",O_RDWR)) >= 0)) {
-
- int sources = ::ioctl(fd, APM_IOCGEVTSRC, 0); // get current event sources
-
- if (sources >= 0) {
- if (soft)
- sources &= ~APM_EVT_POWER_BUTTON;
- else
- sources |= APM_EVT_POWER_BUTTON;
-
- if (::ioctl(fd, APM_IOCSEVTSRC, sources) >= 0) // set new event sources
- res = true;
- else
- perror("APM_IOCGEVTSRC");
- }
- else
- perror("APM_IOCGEVTSRC");
-
- ::close(fd);
- }
- else
- perror("/dev/apm_bios or /dev/misc/apm_bios");
-
- return res;
-#else
+ Q_UNUSED(soft);
return true;
-#endif
}
bool Ramses::suspend ( )
{
- qDebug("Ramses::suspend");
+ //qDebug("Ramses::suspend()");
+ if ( !isQWS() ) // only qwsserver is allowed to suspend
return false;
+
+ bool res = false;
+ int fd;
+
+ if ((fd = ::open("/proc/sys/pm/suspend", O_WRONLY)) >= 0) {
+ res = ( ::write ( fd, "1", 1 ) != -1 );
+ ::close(fd);
+ }
+ return res;
}
/**
* This sets the display on or off
*/
bool Ramses::setDisplayStatus(bool on)
{
- qDebug("Ramses::setDisplayStatus(%d)", on);
-#if 0
+ //qDebug("Ramses::setDisplayStatus(%d)", on);
bool res = false;
int fd;
- if ((fd = ::open ("/dev/fb/0", O_RDWR)) >= 0) {
+ if ((fd = ::open ("/dev/fb/1", O_RDWR)) >= 0) {
res = (::ioctl(fd, FBIOBLANK, on ? VESA_NO_BLANKING : VESA_POWERDOWN) == 0);
::close(fd);
}
return res;
-#else
- return true;
-#endif
}
/*
* We get something between 0..255 into us
*/
bool Ramses::setDisplayBrightness(int bright)
{
- qDebug("Ramses::setDisplayBrightness(%d)", 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 ((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);
}
// scale backlight brightness to hardware
- bright = 500-(bright * 500 / 255);
- if ((fd = ::open("/proc/sys/board/pwm1", O_WRONLY)) >= 0) {
- qDebug(" %d -> pwm1", bright);
+ if ((fd = ::open("/proc/sys/board/lcd_brightness", O_WRONLY)) >= 0) {
+ //qDebug(" %d -> pwm1", bright);
char writeCommand[100];
const int count = sprintf(writeCommand, "%d\n", bright);
res = (::write(fd, writeCommand, count) != -1);
::close(fd);
}
return res;
}
int Ramses::displayBrightnessResolution() const
{
- return 32;
+ return 256;
}
bool Ramses::setDisplayContrast(int contr)
{
- qDebug("Ramses::setDisplayContrast(%d)", contr);
+ //qDebug("Ramses::setDisplayContrast(%d)", contr);
bool res = false;
int fd;
// pwm0 contrast: 20 steps 79..90 (dunkel->hell)
if (contr > 255 )
contr = 255;
if (contr < 0)
contr = 0;
- contr = 90 - (contr * 20 / 255);
- if ((fd = ::open("/proc/sys/board/pwm0", O_WRONLY)) >= 0) {
- qDebug(" %d -> pwm0", contr);
+ if ((fd = ::open("/proc/sys/board/lcd_contrast", O_WRONLY)) >= 0) {
+ //qDebug(" %d -> pwm0", contr);
char writeCommand[100];
const int count = sprintf(writeCommand, "%d\n", contr);
res = (::write(fd, writeCommand, count) != -1);
res = true;
::close(fd);
}
return res;
}
int Ramses::displayContrastResolution() const
{
- return 20;
+ return 256;
}