summaryrefslogtreecommitdiff
path: root/libopie/odevice.cpp
Side-by-side diff
Diffstat (limited to 'libopie/odevice.cpp') (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
@@ -923,3 +923,4 @@ void ODevice::remapHeldAction ( int button, const OQCopMessage &action )
void ODevice::virtual_hook( int id, void* data ) {
-
+ Q_UNUSED(id);
+ Q_UNUSED(data);
}
@@ -1975,3 +1976,4 @@ void Ramses::init()
- d->m_rotation = Rot0;
+ d->m_rotation = Rot180;
+ d->m_direction = CW;
d->m_holdtime = 1000;
@@ -2034,35 +2036,4 @@ 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
}
@@ -2071,4 +2042,14 @@ 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;
}
@@ -2080,4 +2061,3 @@ bool Ramses::setDisplayStatus(bool on)
{
- qDebug("Ramses::setDisplayStatus(%d)", on);
-#if 0
+ //qDebug("Ramses::setDisplayStatus(%d)", on);
bool res = false;
@@ -2085,3 +2065,3 @@ bool Ramses::setDisplayStatus(bool on)
- 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);
@@ -2090,5 +2070,2 @@ bool Ramses::setDisplayStatus(bool on)
return res;
-#else
- return true;
-#endif
}
@@ -2101,3 +2078,3 @@ bool Ramses::setDisplayBrightness(int bright)
{
- qDebug("Ramses::setDisplayBrightness(%d)", bright);
+ //qDebug("Ramses::setDisplayBrightness(%d)", bright);
bool res = false;
@@ -2121,5 +2098,4 @@ bool Ramses::setDisplayBrightness(int bright)
// 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];
@@ -2135,3 +2111,3 @@ int Ramses::displayBrightnessResolution() const
{
- return 32;
+ return 256;
}
@@ -2140,3 +2116,3 @@ bool Ramses::setDisplayContrast(int contr)
{
- qDebug("Ramses::setDisplayContrast(%d)", contr);
+ //qDebug("Ramses::setDisplayContrast(%d)", contr);
bool res = false;
@@ -2150,6 +2126,5 @@ bool Ramses::setDisplayContrast(int contr)
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];
@@ -2166,3 +2141,3 @@ int Ramses::displayContrastResolution() const
{
- return 20;
+ return 256;
}