summaryrefslogtreecommitdiff
path: root/libopie/odevice.cpp
Unidiff
Diffstat (limited to 'libopie/odevice.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie/odevice.cpp111
1 files changed, 63 insertions, 48 deletions
diff --git a/libopie/odevice.cpp b/libopie/odevice.cpp
index 62dc9d4..17ae389 100644
--- a/libopie/odevice.cpp
+++ b/libopie/odevice.cpp
@@ -474,2 +474,5 @@ ODevice::~ODevice ( )
474{ 474{
475// we leak m_devicebuttons and m_cpu_frequency
476// but it's a singleton and it is not so importantant
477// -zecke
475 delete d; 478 delete d;
@@ -787,3 +790,3 @@ const QStrList &ODevice::allowedCpuFrequencies ( ) const
787 * Set desired CPU frequency 790 * Set desired CPU frequency
788 * 791 *
789 * @param index index into d->m_cpu_frequencies of the frequency to be set 792 * @param index index into d->m_cpu_frequencies of the frequency to be set
@@ -922,7 +925,5 @@ void ODevice::remapHeldAction ( int button, const OQCopMessage &action )
922} 925}
923void ODevice::virtual_hook( int id, void* data ) { 926void ODevice::virtual_hook(int, void* ){
924 Q_UNUSED(id);
925 Q_UNUSED(data);
926}
927 927
928}
928 929
@@ -1650,3 +1651,2 @@ int Zaurus::displayBrightnessResolution ( ) const
1650 1651
1651
1652/************************************************** 1652/**************************************************
@@ -1891,3 +1891,3 @@ bool SIMpad::suspend ( ) // Must override because SIMpad does NOT have apm
1891 ::sync ( ); // flush fs caches 1891 ::sync ( ); // flush fs caches
1892 res = ( ::system ( "echo > /proc/sys/pm/suspend" ) == 0 ); //TODO make better :) 1892 res = ( ::system ( "cat /dev/fb/0 >/tmp/.buffer; echo > /proc/sys/pm/suspend; cat /tmp/.buffer >/dev/fb/0" ) == 0 ); //TODO make better :)
1893 1893
@@ -1913,6 +1913,4 @@ bool SIMpad::setDisplayStatus ( bool on )
1913 1913
1914 if (( fd = ::open ( "/dev/fb0", O_RDWR )) >= 0 ) { 1914 res = ( ::system( (const char*) cmdline ) == 0 );
1915 res = ( ::system( (const char*) cmdline ) == 0 ); 1915
1916 ::close ( fd );
1917 }
1918 return res; 1916 return res;
@@ -1929,3 +1927,3 @@ bool SIMpad::setDisplayBrightness ( int bright )
1929 bright = 255; 1927 bright = 255;
1930 if ( bright < 0 ) 1928 if ( bright < 1 )
1931 bright = 0; 1929 bright = 0;
@@ -1948,12 +1946,3 @@ int SIMpad::displayBrightnessResolution ( ) const
1948{ 1946{
1949 switch ( model ( )) { 1947 return 255; // All SIMpad models share the same display
1950 case Model_SIMpad_CL4:
1951 case Model_SIMpad_SL4:
1952 case Model_SIMpad_SLC:
1953 case Model_SIMpad_TSinus:
1954 return 255; //TODO find out if this is save
1955
1956 default:
1957 return 2;
1958 }
1959} 1948}
@@ -1976,5 +1965,4 @@ void Ramses::init()
1976 1965
1977 d->m_rotation = Rot180; 1966 d->m_rotation = Rot0;
1978 d->m_direction = CW; 1967 d->m_holdtime = 1000;
1979 d->m_holdtime = 1000;
1980 1968
@@ -2036,12 +2024,4 @@ bool Ramses::setSoftSuspend(bool soft)
2036{ 2024{
2037 Q_UNUSED(soft); 2025 qDebug("Ramses::setSoftSuspend(%d)", soft);
2038 return true; 2026#if 0
2039}
2040
2041bool Ramses::suspend()
2042{
2043 //qDebug("Ramses::suspend()");
2044 if ( !isQWS() ) // only qwsserver is allowed to suspend
2045 return false;
2046
2047 bool res = false; 2027 bool res = false;
@@ -2049,7 +2029,36 @@ bool Ramses::suspend()
2049 2029
2050 if ((fd = ::open("/proc/sys/pm/suspend", O_WRONLY)) >= 0) { 2030 if (((fd = ::open("/dev/apm_bios", O_RDWR)) >= 0) ||
2051 res = ( ::write ( fd, "1", 1 ) != -1 ); 2031 ((fd = ::open("/dev/misc/apm_bios",O_RDWR)) >= 0)) {
2032
2033 int sources = ::ioctl(fd, APM_IOCGEVTSRC, 0); // get current event sources
2034
2035 if (sources >= 0) {
2036 if (soft)
2037 sources &= ~APM_EVT_POWER_BUTTON;
2038 else
2039 sources |= APM_EVT_POWER_BUTTON;
2040
2041 if (::ioctl(fd, APM_IOCSEVTSRC, sources) >= 0) // set new event sources
2042 res = true;
2043 else
2044 perror("APM_IOCGEVTSRC");
2045 }
2046 else
2047 perror("APM_IOCGEVTSRC");
2048
2052 ::close(fd); 2049 ::close(fd);
2053 } 2050 }
2054 return res; 2051 else
2052 perror("/dev/apm_bios or /dev/misc/apm_bios");
2053
2054 return res;
2055#else
2056 return true;
2057#endif
2058}
2059
2060bool Ramses::suspend ( )
2061{
2062 qDebug("Ramses::suspend");
2063 return false;
2055} 2064}
@@ -2061,3 +2070,4 @@ bool Ramses::setDisplayStatus(bool on)
2061{ 2070{
2062 //qDebug("Ramses::setDisplayStatus(%d)", on); 2071 qDebug("Ramses::setDisplayStatus(%d)", on);
2072#if 0
2063 bool res = false; 2073 bool res = false;
@@ -2065,3 +2075,3 @@ bool Ramses::setDisplayStatus(bool on)
2065 2075
2066 if ((fd = ::open ("/dev/fb/1", O_RDWR)) >= 0) { 2076 if ((fd = ::open ("/dev/fb/0", O_RDWR)) >= 0) {
2067 res = (::ioctl(fd, FBIOBLANK, on ? VESA_NO_BLANKING : VESA_POWERDOWN) == 0); 2077 res = (::ioctl(fd, FBIOBLANK, on ? VESA_NO_BLANKING : VESA_POWERDOWN) == 0);
@@ -2070,2 +2080,5 @@ bool Ramses::setDisplayStatus(bool on)
2070 return res; 2080 return res;
2081#else
2082 return true;
2083#endif
2071} 2084}
@@ -2078,3 +2091,3 @@ bool Ramses::setDisplayBrightness(int bright)
2078{ 2091{
2079 //qDebug("Ramses::setDisplayBrightness(%d)", bright); 2092 qDebug("Ramses::setDisplayBrightness(%d)", bright);
2080 bool res = false; 2093 bool res = false;
@@ -2098,4 +2111,5 @@ bool Ramses::setDisplayBrightness(int bright)
2098 // scale backlight brightness to hardware 2111 // scale backlight brightness to hardware
2099 if ((fd = ::open("/proc/sys/board/lcd_brightness", O_WRONLY)) >= 0) { 2112 bright = 500-(bright * 500 / 255);
2100 //qDebug(" %d -> pwm1", bright); 2113 if ((fd = ::open("/proc/sys/board/pwm1", O_WRONLY)) >= 0) {
2114 qDebug(" %d -> pwm1", bright);
2101 char writeCommand[100]; 2115 char writeCommand[100];
@@ -2111,3 +2125,3 @@ int Ramses::displayBrightnessResolution() const
2111{ 2125{
2112 return 256; 2126 return 32;
2113} 2127}
@@ -2116,3 +2130,3 @@ bool Ramses::setDisplayContrast(int contr)
2116{ 2130{
2117 //qDebug("Ramses::setDisplayContrast(%d)", contr); 2131 qDebug("Ramses::setDisplayContrast(%d)", contr);
2118 bool res = false; 2132 bool res = false;
@@ -2126,5 +2140,6 @@ bool Ramses::setDisplayContrast(int contr)
2126 contr = 0; 2140 contr = 0;
2141 contr = 90 - (contr * 20 / 255);
2127 2142
2128 if ((fd = ::open("/proc/sys/board/lcd_contrast", O_WRONLY)) >= 0) { 2143 if ((fd = ::open("/proc/sys/board/pwm0", O_WRONLY)) >= 0) {
2129 //qDebug(" %d -> pwm0", contr); 2144 qDebug(" %d -> pwm0", contr);
2130 char writeCommand[100]; 2145 char writeCommand[100];
@@ -2141,3 +2156,3 @@ int Ramses::displayContrastResolution() const
2141{ 2156{
2142 return 256; 2157 return 20;
2143} 2158}